summaryrefslogtreecommitdiff
path: root/drivers/pwm/pwm-omap-dmtimer.c
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2024-02-14 10:32:06 +0100
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>2024-02-19 11:04:12 +0100
commit623a9594b2d337818b5c1d44cd2f63280c1178a7 (patch)
tree7b879eba27aada972e8051721d8c5e2bebc65bb2 /drivers/pwm/pwm-omap-dmtimer.c
parent7fc81e231fe9a5c88ce392c0c0fe962da390464b (diff)
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>
Diffstat (limited to 'drivers/pwm/pwm-omap-dmtimer.c')
-rw-r--r--drivers/pwm/pwm-omap-dmtimer.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/pwm/pwm-omap-dmtimer.c b/drivers/pwm/pwm-omap-dmtimer.c
index 527a7aa0ce61..729d3be2a013 100644
--- a/drivers/pwm/pwm-omap-dmtimer.c
+++ b/drivers/pwm/pwm-omap-dmtimer.c
@@ -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);