Commit b6ce2af8 authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Thierry Reding
Browse files

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: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: default avatarThierry Reding <thierry.reding@gmail.com>
parent 14d89565
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -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));