You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
pwm: Add the pwm_is_enabled() helper
Some PWM drivers are testing the PWMF_ENABLED flag. Create a helper function to hide the logic behind enabled test. This will allow us to smoothly move from the current approach to an atomic PWM update approach. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
This commit is contained in:
committed by
Thierry Reding
parent
d770e558e2
commit
5c31252c4a
@@ -407,7 +407,7 @@ static void ehrpwm_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm)
|
||||
{
|
||||
struct ehrpwm_pwm_chip *pc = to_ehrpwm_pwm_chip(chip);
|
||||
|
||||
if (test_bit(PWMF_ENABLED, &pwm->flags)) {
|
||||
if (pwm_is_enabled(pwm)) {
|
||||
dev_warn(chip->dev, "Removing PWM device without disabling\n");
|
||||
pm_runtime_put_sync(chip->dev);
|
||||
}
|
||||
@@ -565,7 +565,7 @@ static int ehrpwm_pwm_suspend(struct device *dev)
|
||||
for (i = 0; i < pc->chip.npwm; i++) {
|
||||
struct pwm_device *pwm = &pc->chip.pwms[i];
|
||||
|
||||
if (!test_bit(PWMF_ENABLED, &pwm->flags))
|
||||
if (!pwm_is_enabled(pwm))
|
||||
continue;
|
||||
|
||||
/* Disable explicitly if PWM is running */
|
||||
@@ -582,7 +582,7 @@ static int ehrpwm_pwm_resume(struct device *dev)
|
||||
for (i = 0; i < pc->chip.npwm; i++) {
|
||||
struct pwm_device *pwm = &pc->chip.pwms[i];
|
||||
|
||||
if (!test_bit(PWMF_ENABLED, &pwm->flags))
|
||||
if (!pwm_is_enabled(pwm))
|
||||
continue;
|
||||
|
||||
/* Enable explicitly if PWM was running */
|
||||
|
||||
Reference in New Issue
Block a user