summaryrefslogtreecommitdiff
path: root/drivers/pwm/pwm-img.c
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2021-11-12 22:00:15 +0300
committerThierry Reding <thierry.reding@gmail.com>2021-11-17 19:24:28 +0300
commitb6ce2af8766c39a5b09afa466ed4d0ef2d8b5a65 (patch)
treebb6d13a0f268fcc6f4ad1968b271e03848882634 /drivers/pwm/pwm-img.c
parent14d8956548ad48574138d8fd377d434083c3c3cd (diff)
downloadlinux-b6ce2af8766c39a5b09afa466ed4d0ef2d8b5a65.tar.xz
pwm: img: Use only a single idiom to get a runtime PM reference
Currently there are two very similar approaches in use by this driver: img_pwm_config() uses pm_runtime_get_sync() and calls pm_runtime_put_autosuspend() in the error path; img_pwm_enable() calls pm_runtime_resume_and_get() which already puts the reference in its own error path. Align pm_runtime usage and use the same idiom in both locations. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Diffstat (limited to 'drivers/pwm/pwm-img.c')
-rw-r--r--drivers/pwm/pwm-img.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/pwm/pwm-img.c b/drivers/pwm/pwm-img.c
index 1f3d6346ab86..5996049f66ec 100644
--- a/drivers/pwm/pwm-img.c
+++ b/drivers/pwm/pwm-img.c
@@ -128,11 +128,9 @@ static int img_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
duty = DIV_ROUND_UP(timebase * duty_ns, period_ns);
- ret = pm_runtime_get_sync(chip->dev);
- if (ret < 0) {
- pm_runtime_put_autosuspend(chip->dev);
+ ret = pm_runtime_resume_and_get(chip->dev);
+ if (ret < 0)
return ret;
- }
val = img_pwm_readl(pwm_chip, PWM_CTRL_CFG);
val &= ~(PWM_CTRL_CFG_DIV_MASK << PWM_CTRL_CFG_DIV_SHIFT(pwm->hwpwm));