diff options
author | Boris Brezillon <boris.brezillon@free-electrons.com> | 2015-07-01 04:21:47 -0400 |
---|---|---|
committer | Thierry Reding <thierry.reding@gmail.com> | 2015-07-20 03:46:06 -0400 |
commit | 5c31252c4a86dc591c23f1a951edd52ad791ef0e (patch) | |
tree | 4a955e92027bbf95cd5fc9222245c0e4c8810a43 /drivers/pwm/pwm-tegra.c | |
parent | d770e558e21961ad6cfdf0ff7df0eb5d7d4f0754 (diff) |
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-tegra.c')
-rw-r--r-- | drivers/pwm/pwm-tegra.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/pwm/pwm-tegra.c b/drivers/pwm/pwm-tegra.c index cabd7d8e05cc..d4de0607b502 100644 --- a/drivers/pwm/pwm-tegra.c +++ b/drivers/pwm/pwm-tegra.c | |||
@@ -112,7 +112,7 @@ static int tegra_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, | |||
112 | * If the PWM channel is disabled, make sure to turn on the clock | 112 | * If the PWM channel is disabled, make sure to turn on the clock |
113 | * before writing the register. Otherwise, keep it enabled. | 113 | * before writing the register. Otherwise, keep it enabled. |
114 | */ | 114 | */ |
115 | if (!test_bit(PWMF_ENABLED, &pwm->flags)) { | 115 | if (!pwm_is_enabled(pwm)) { |
116 | err = clk_prepare_enable(pc->clk); | 116 | err = clk_prepare_enable(pc->clk); |
117 | if (err < 0) | 117 | if (err < 0) |
118 | return err; | 118 | return err; |
@@ -124,7 +124,7 @@ static int tegra_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, | |||
124 | /* | 124 | /* |
125 | * If the PWM is not enabled, turn the clock off again to save power. | 125 | * If the PWM is not enabled, turn the clock off again to save power. |
126 | */ | 126 | */ |
127 | if (!test_bit(PWMF_ENABLED, &pwm->flags)) | 127 | if (!pwm_is_enabled(pwm)) |
128 | clk_disable_unprepare(pc->clk); | 128 | clk_disable_unprepare(pc->clk); |
129 | 129 | ||
130 | return 0; | 130 | return 0; |
@@ -214,7 +214,7 @@ static int tegra_pwm_remove(struct platform_device *pdev) | |||
214 | for (i = 0; i < NUM_PWM; i++) { | 214 | for (i = 0; i < NUM_PWM; i++) { |
215 | struct pwm_device *pwm = &pc->chip.pwms[i]; | 215 | struct pwm_device *pwm = &pc->chip.pwms[i]; |
216 | 216 | ||
217 | if (!test_bit(PWMF_ENABLED, &pwm->flags)) | 217 | if (!pwm_is_enabled(pwm)) |
218 | if (clk_prepare_enable(pc->clk) < 0) | 218 | if (clk_prepare_enable(pc->clk) < 0) |
219 | continue; | 219 | continue; |
220 | 220 | ||