aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pwm
diff options
context:
space:
mode:
authorThierry Reding <thierry.reding@gmail.com>2016-07-11 05:08:29 -0400
committerThierry Reding <thierry.reding@gmail.com>2016-07-11 06:49:30 -0400
commitc009c56475a08fc8c0e1d4d4161bdcc76f3638b7 (patch)
treecf02b1166995229e3e12dc7d9cdc202963f8d0b4 /drivers/pwm
parentacfd92fdfb9384d54d9404101e8657e75c2372f3 (diff)
pwm: tegra: Drop NUM_PWM macro
This macro is used to initialize the ->npwm field of the PWM chip. Use a literal instead and make all other places rely on ->npwm. Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Diffstat (limited to 'drivers/pwm')
-rw-r--r--drivers/pwm/pwm-tegra.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/pwm/pwm-tegra.c b/drivers/pwm/pwm-tegra.c
index d4de0607b502..d42b636c9695 100644
--- a/drivers/pwm/pwm-tegra.c
+++ b/drivers/pwm/pwm-tegra.c
@@ -36,8 +36,6 @@
36#define PWM_SCALE_WIDTH 13 36#define PWM_SCALE_WIDTH 13
37#define PWM_SCALE_SHIFT 0 37#define PWM_SCALE_SHIFT 0
38 38
39#define NUM_PWM 4
40
41struct tegra_pwm_chip { 39struct tegra_pwm_chip {
42 struct pwm_chip chip; 40 struct pwm_chip chip;
43 struct device *dev; 41 struct device *dev;
@@ -192,7 +190,7 @@ static int tegra_pwm_probe(struct platform_device *pdev)
192 pwm->chip.dev = &pdev->dev; 190 pwm->chip.dev = &pdev->dev;
193 pwm->chip.ops = &tegra_pwm_ops; 191 pwm->chip.ops = &tegra_pwm_ops;
194 pwm->chip.base = -1; 192 pwm->chip.base = -1;
195 pwm->chip.npwm = NUM_PWM; 193 pwm->chip.npwm = 4;
196 194
197 ret = pwmchip_add(&pwm->chip); 195 ret = pwmchip_add(&pwm->chip);
198 if (ret < 0) { 196 if (ret < 0) {
@@ -206,12 +204,12 @@ static int tegra_pwm_probe(struct platform_device *pdev)
206static int tegra_pwm_remove(struct platform_device *pdev) 204static int tegra_pwm_remove(struct platform_device *pdev)
207{ 205{
208 struct tegra_pwm_chip *pc = platform_get_drvdata(pdev); 206 struct tegra_pwm_chip *pc = platform_get_drvdata(pdev);
209 int i; 207 unsigned int i;
210 208
211 if (WARN_ON(!pc)) 209 if (WARN_ON(!pc))
212 return -ENODEV; 210 return -ENODEV;
213 211
214 for (i = 0; i < NUM_PWM; i++) { 212 for (i = 0; i < pc->chip.npwm; i++) {
215 struct pwm_device *pwm = &pc->chip.pwms[i]; 213 struct pwm_device *pwm = &pc->chip.pwms[i];
216 214
217 if (!pwm_is_enabled(pwm)) 215 if (!pwm_is_enabled(pwm))