mirror of
https://github.com/torvalds/linux.git
synced 2026-05-24 23:22:31 +02:00
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>
This commit is contained in:
parent
ba0c182e5f
commit
aa1b9f1677
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user