pwm: omap-dmtimer: Prepare removing pwm_chip from driver data
This prepares the driver for further changes that will drop struct pwm_chip chip from struct pwm_omap_dmtimer_chip. Use the pwm_chip as driver data instead of the pwm_omap_dmtimer_chip to get access to the pwm_chip in pwm_omap_dmtimer_remove() without using omap->chip. Link: https://lore.kernel.org/r/809672026f3d583ba4fc4bd92b525951df172106.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
7fc81e231f
commit
623a9594b2
@ -311,6 +311,7 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev)
|
||||
struct dmtimer_platform_data *timer_pdata;
|
||||
const struct omap_dm_timer_ops *pdata;
|
||||
struct platform_device *timer_pdev;
|
||||
struct pwm_chip *chip;
|
||||
struct pwm_omap_dmtimer_chip *omap;
|
||||
struct omap_dm_timer *dm_timer;
|
||||
struct device_node *timer;
|
||||
@ -373,6 +374,7 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev)
|
||||
ret = -ENOMEM;
|
||||
goto err_alloc_omap;
|
||||
}
|
||||
chip = &omap->chip;
|
||||
|
||||
omap->pdata = pdata;
|
||||
omap->dm_timer = dm_timer;
|
||||
@ -392,11 +394,11 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev)
|
||||
if (!of_property_read_u32(pdev->dev.of_node, "ti,clock-source", &v))
|
||||
omap->pdata->set_source(omap->dm_timer, v);
|
||||
|
||||
omap->chip.dev = &pdev->dev;
|
||||
omap->chip.ops = &pwm_omap_dmtimer_ops;
|
||||
omap->chip.npwm = 1;
|
||||
chip->dev = &pdev->dev;
|
||||
chip->ops = &pwm_omap_dmtimer_ops;
|
||||
chip->npwm = 1;
|
||||
|
||||
ret = pwmchip_add(&omap->chip);
|
||||
ret = pwmchip_add(chip);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "failed to register PWM\n");
|
||||
goto err_pwmchip_add;
|
||||
@ -404,7 +406,7 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev)
|
||||
|
||||
of_node_put(timer);
|
||||
|
||||
platform_set_drvdata(pdev, omap);
|
||||
platform_set_drvdata(pdev, chip);
|
||||
|
||||
return 0;
|
||||
|
||||
@ -432,9 +434,10 @@ err_find_timer_pdev:
|
||||
|
||||
static void pwm_omap_dmtimer_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct pwm_omap_dmtimer_chip *omap = platform_get_drvdata(pdev);
|
||||
struct pwm_chip *chip = platform_get_drvdata(pdev);
|
||||
struct pwm_omap_dmtimer_chip *omap = to_pwm_omap_dmtimer_chip(chip);
|
||||
|
||||
pwmchip_remove(&omap->chip);
|
||||
pwmchip_remove(chip);
|
||||
|
||||
if (pm_runtime_active(&omap->dm_timer_pdev->dev))
|
||||
omap->pdata->stop(omap->dm_timer);
|
||||
|
Loading…
Reference in New Issue
Block a user