Commit aa1b9f16 authored by Uwe Kleine-König's avatar Uwe Kleine-König

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.deSigned-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
parent ba0c182e
...@@ -202,6 +202,7 @@ static const struct pwm_ops rcar_pwm_ops = { ...@@ -202,6 +202,7 @@ static const struct pwm_ops rcar_pwm_ops = {
static int rcar_pwm_probe(struct platform_device *pdev) static int rcar_pwm_probe(struct platform_device *pdev)
{ {
struct pwm_chip *chip;
struct rcar_pwm_chip *rcar_pwm; struct rcar_pwm_chip *rcar_pwm;
int ret; int ret;
...@@ -219,15 +220,16 @@ static int rcar_pwm_probe(struct platform_device *pdev) ...@@ -219,15 +220,16 @@ static int rcar_pwm_probe(struct platform_device *pdev)
return PTR_ERR(rcar_pwm->clk); 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; platform_set_drvdata(pdev, chip);
rcar_pwm->chip.ops = &rcar_pwm_ops;
rcar_pwm->chip.npwm = 1;
pm_runtime_enable(&pdev->dev); pm_runtime_enable(&pdev->dev);
ret = pwmchip_add(&rcar_pwm->chip); ret = pwmchip_add(chip);
if (ret < 0) { if (ret < 0) {
dev_err(&pdev->dev, "failed to register PWM chip: %d\n", ret); dev_err(&pdev->dev, "failed to register PWM chip: %d\n", ret);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
...@@ -239,9 +241,9 @@ static int rcar_pwm_probe(struct platform_device *pdev) ...@@ -239,9 +241,9 @@ static int rcar_pwm_probe(struct platform_device *pdev)
static void rcar_pwm_remove(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); pm_runtime_disable(&pdev->dev);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment