pwm: dwc-core: Make use of pwmchip_parent() accessor
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Wed, 14 Feb 2024 09:31:21 +0000 (10:31 +0100)
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Mon, 19 Feb 2024 10:04:08 +0000 (11:04 +0100)
struct pwm_chip::dev is about to change. To not have to touch this
driver in the same commit as struct pwm_chip::dev, use the accessor
function provided for exactly this purpose.

Link: https://lore.kernel.org/r/5240ba82ac227e3723678041bd69b9c7a9e3db43.1707900770.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
drivers/pwm/pwm-dwc-core.c

index de1d2ac..0437369 100644 (file)
@@ -105,12 +105,12 @@ static int dwc_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
 
        if (state->enabled) {
                if (!pwm->state.enabled)
-                       pm_runtime_get_sync(chip->dev);
+                       pm_runtime_get_sync(pwmchip_parent(chip));
                return __dwc_pwm_configure_timer(dwc, pwm, state);
        } else {
                if (pwm->state.enabled) {
                        __dwc_pwm_set_enable(dwc, pwm->hwpwm, false);
-                       pm_runtime_put_sync(chip->dev);
+                       pm_runtime_put_sync(pwmchip_parent(chip));
                }
        }
 
@@ -124,7 +124,7 @@ static int dwc_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
        u64 duty, period;
        u32 ctrl, ld, ld2;
 
-       pm_runtime_get_sync(chip->dev);
+       pm_runtime_get_sync(pwmchip_parent(chip));
 
        ctrl = dwc_pwm_readl(dwc, DWC_TIM_CTRL(pwm->hwpwm));
        ld = dwc_pwm_readl(dwc, DWC_TIM_LD_CNT(pwm->hwpwm));
@@ -149,7 +149,7 @@ static int dwc_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
        state->period = period;
        state->duty_cycle = duty;
 
-       pm_runtime_put_sync(chip->dev);
+       pm_runtime_put_sync(pwmchip_parent(chip));
 
        return 0;
 }