diff options
author | Boris Brezillon <boris.brezillon@free-electrons.com> | 2015-07-01 10:21:47 +0200 |
---|---|---|
committer | Thierry Reding <thierry.reding@gmail.com> | 2015-07-20 09:46:06 +0200 |
commit | 5c31252c4a86dc591c23f1a951edd52ad791ef0e (patch) | |
tree | 4a955e92027bbf95cd5fc9222245c0e4c8810a43 /drivers/pwm/pwm-bcm-kona.c | |
parent | Linux 4.2-rc1 (diff) | |
download | linux-5c31252c4a86dc591c23f1a951edd52ad791ef0e.tar.xz linux-5c31252c4a86dc591c23f1a951edd52ad791ef0e.zip |
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>
Diffstat (limited to 'drivers/pwm/pwm-bcm-kona.c')
-rw-r--r-- | drivers/pwm/pwm-bcm-kona.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/pwm/pwm-bcm-kona.c b/drivers/pwm/pwm-bcm-kona.c index 7af8fea2dc5b..dfdcf88279ae 100644 --- a/drivers/pwm/pwm-bcm-kona.c +++ b/drivers/pwm/pwm-bcm-kona.c @@ -134,7 +134,7 @@ static int kona_pwmc_config(struct pwm_chip *chip, struct pwm_device *pwm, } /* If the PWM channel is enabled, write the settings to the HW */ - if (test_bit(PWMF_ENABLED, &pwm->flags)) { + if (pwm_is_enabled(pwm)) { value = readl(kp->base + PRESCALE_OFFSET); value &= ~PRESCALE_MASK(chan); value |= prescale << PRESCALE_SHIFT(chan); @@ -287,7 +287,7 @@ static int kona_pwmc_remove(struct platform_device *pdev) unsigned int chan; for (chan = 0; chan < kp->chip.npwm; chan++) - if (test_bit(PWMF_ENABLED, &kp->chip.pwms[chan].flags)) + if (pwm_is_enabled(&kp->chip.pwms[chan])) clk_disable_unprepare(kp->clk); return pwmchip_remove(&kp->chip); |