mirror of
https://github.com/torvalds/linux.git
synced 2024-12-25 12:21:37 +00:00
pwm: atmel-hlcdc: Make use of devm_pwmchip_alloc() function
This prepares the pwm-atmel-hlcdc driver to further changes of the pwm core outlined in the commit introducing devm_pwmchip_alloc(). There is no intended semantical change and the driver should behave as before. Link: https://lore.kernel.org/r/4724c6a0f052160ac80ba5a3065c9470778b7457.1707900770.git.u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
This commit is contained in:
parent
0ba76822eb
commit
93dcf8e00e
@ -28,7 +28,6 @@ struct atmel_hlcdc_pwm_errata {
|
||||
};
|
||||
|
||||
struct atmel_hlcdc_pwm {
|
||||
struct pwm_chip chip;
|
||||
struct atmel_hlcdc *hlcdc;
|
||||
struct clk *cur_clk;
|
||||
const struct atmel_hlcdc_pwm_errata *errata;
|
||||
@ -36,7 +35,7 @@ struct atmel_hlcdc_pwm {
|
||||
|
||||
static inline struct atmel_hlcdc_pwm *to_atmel_hlcdc_pwm(struct pwm_chip *chip)
|
||||
{
|
||||
return container_of(chip, struct atmel_hlcdc_pwm, chip);
|
||||
return pwmchip_get_drvdata(chip);
|
||||
}
|
||||
|
||||
static int atmel_hlcdc_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
|
||||
@ -250,9 +249,10 @@ static int atmel_hlcdc_pwm_probe(struct platform_device *pdev)
|
||||
|
||||
hlcdc = dev_get_drvdata(dev->parent);
|
||||
|
||||
atmel = devm_kzalloc(dev, sizeof(*atmel), GFP_KERNEL);
|
||||
if (!atmel)
|
||||
return -ENOMEM;
|
||||
chip = devm_pwmchip_alloc(dev, 1, sizeof(*atmel));
|
||||
if (IS_ERR(chip))
|
||||
return PTR_ERR(chip);
|
||||
atmel = to_atmel_hlcdc_pwm(chip);
|
||||
|
||||
ret = clk_prepare_enable(hlcdc->periph_clk);
|
||||
if (ret)
|
||||
@ -263,10 +263,7 @@ static int atmel_hlcdc_pwm_probe(struct platform_device *pdev)
|
||||
atmel->errata = match->data;
|
||||
|
||||
atmel->hlcdc = hlcdc;
|
||||
chip = &atmel->chip;
|
||||
chip->ops = &atmel_hlcdc_pwm_ops;
|
||||
chip->dev = dev;
|
||||
chip->npwm = 1;
|
||||
|
||||
ret = pwmchip_add(chip);
|
||||
if (ret) {
|
||||
|
Loading…
Reference in New Issue
Block a user