diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2024-02-14 10:32:15 +0100 |
---|---|---|
committer | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2024-02-19 11:04:13 +0100 |
commit | aa1b9f16772254a0d4b9154057992bf9fc9184bf (patch) | |
tree | 142fa795d736959ed6a86471fd0eb7f01fd29c8e /drivers/pwm/pwm-rcar.c | |
parent | ba0c182e5f276e0cb4297938824e55ffe9a88508 (diff) | |
download | lwn-aa1b9f16772254a0d4b9154057992bf9fc9184bf.tar.gz lwn-aa1b9f16772254a0d4b9154057992bf9fc9184bf.zip |
pwm: rcar: Prepare removing pwm_chip from driver data
This prepares the driver for further changes that will drop struct
pwm_chip chip from struct rcar_pwm_chip. Use the pwm_chip as driver
data instead of the rcar_pwm_chip to get access to the pwm_chip in
the .remove() callbacks without using rcar_pwm->chip.
Link: https://lore.kernel.org/r/e588e3ccdd0ac1c9c3f3a79b3e52112f83f9d71c.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-rcar.c')
-rw-r--r-- | drivers/pwm/pwm-rcar.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/pwm/pwm-rcar.c b/drivers/pwm/pwm-rcar.c index 4838762137d1..1dfcc74efcfd 100644 --- a/drivers/pwm/pwm-rcar.c +++ b/drivers/pwm/pwm-rcar.c @@ -202,6 +202,7 @@ static const struct pwm_ops rcar_pwm_ops = { static int rcar_pwm_probe(struct platform_device *pdev) { + struct pwm_chip *chip; struct rcar_pwm_chip *rcar_pwm; int ret; @@ -219,15 +220,16 @@ static int rcar_pwm_probe(struct platform_device *pdev) return PTR_ERR(rcar_pwm->clk); } - platform_set_drvdata(pdev, rcar_pwm); + chip = &rcar_pwm->chip; + chip->dev = &pdev->dev; + chip->ops = &rcar_pwm_ops; + chip->npwm = 1; - rcar_pwm->chip.dev = &pdev->dev; - rcar_pwm->chip.ops = &rcar_pwm_ops; - rcar_pwm->chip.npwm = 1; + platform_set_drvdata(pdev, chip); pm_runtime_enable(&pdev->dev); - ret = pwmchip_add(&rcar_pwm->chip); + ret = pwmchip_add(chip); if (ret < 0) { dev_err(&pdev->dev, "failed to register PWM chip: %d\n", ret); pm_runtime_disable(&pdev->dev); @@ -239,9 +241,9 @@ static int rcar_pwm_probe(struct platform_device *pdev) static void rcar_pwm_remove(struct platform_device *pdev) { - struct rcar_pwm_chip *rcar_pwm = platform_get_drvdata(pdev); + struct pwm_chip *chip = platform_get_drvdata(pdev); - pwmchip_remove(&rcar_pwm->chip); + pwmchip_remove(chip); pm_runtime_disable(&pdev->dev); } |