Skip to content

Commit b6ce2af

Browse files
Uwe Kleine-Königthierryreding
authored andcommitted
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 <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
1 parent 14d8956 commit b6ce2af

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/pwm/pwm-img.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,9 @@ static int img_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
128128

129129
duty = DIV_ROUND_UP(timebase * duty_ns, period_ns);
130130

131-
ret = pm_runtime_get_sync(chip->dev);
132-
if (ret < 0) {
133-
pm_runtime_put_autosuspend(chip->dev);
131+
ret = pm_runtime_resume_and_get(chip->dev);
132+
if (ret < 0)
134133
return ret;
135-
}
136134

137135
val = img_pwm_readl(pwm_chip, PWM_CTRL_CFG);
138136
val &= ~(PWM_CTRL_CFG_DIV_MASK << PWM_CTRL_CFG_DIV_SHIFT(pwm->hwpwm));

0 commit comments

Comments
 (0)