diff mbox series

[v1,087/101] pwm: rcar: Store parent device in driver data

Message ID 20230808171931.944154-88-u.kleine-koenig@pengutronix.de
State Superseded
Headers show
Series pwm: Fix lifetime issues for pwm_chips | expand

Commit Message

Uwe Kleine-König Aug. 8, 2023, 5:19 p.m. UTC
struct pwm_chip::dev is about to change. To not have to touch this
driver in the same commit as struct pwm_chip::dev, store a pointer to
the parent device in driver data.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/pwm/pwm-rcar.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/pwm/pwm-rcar.c b/drivers/pwm/pwm-rcar.c
index 5bb7b579705d..ecbe7d2a26d7 100644
--- a/drivers/pwm/pwm-rcar.c
+++ b/drivers/pwm/pwm-rcar.c
@@ -38,6 +38,7 @@ 
 #define  RCAR_PWMCNT_PH0_SHIFT	0
 
 struct rcar_pwm_chip {
+	struct device *parent;
 	void __iomem *base;
 	struct clk *clk;
 };
@@ -131,12 +132,14 @@  static int rcar_pwm_set_counter(struct rcar_pwm_chip *rp, int div, int duty_ns,
 
 static int rcar_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm)
 {
-	return pm_runtime_get_sync(chip->dev);
+	struct rcar_pwm_chip *rp = to_rcar_pwm_chip(chip);
+	return pm_runtime_get_sync(rp->parent);
 }
 
 static void rcar_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm)
 {
-	pm_runtime_put(chip->dev);
+	struct rcar_pwm_chip *rp = to_rcar_pwm_chip(chip);
+	pm_runtime_put(rp->parent);
 }
 
 static int rcar_pwm_enable(struct rcar_pwm_chip *rp)