diff options
author | Johan Hovold <jhovold@gmail.com> | 2013-11-12 18:09:44 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-12 22:09:21 -0500 |
commit | 5ada4550e86b081b889bced50e5ab6c510f9cdd7 (patch) | |
tree | 3797c038a7e6c3c18a04ab2561cc83fa344c85fa /drivers/video/backlight | |
parent | 7bb8abe6ed58835c58153d59e4b13513b7306802 (diff) |
backlight: atmel-pwm-bl: use gpio_is_valid
Use gpio_is_valid rather than open coding the more restrictive != -1
test.
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Acked-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/backlight')
-rw-r--r-- | drivers/video/backlight/atmel-pwm-bl.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/video/backlight/atmel-pwm-bl.c b/drivers/video/backlight/atmel-pwm-bl.c index bfd6a9680936..c2542095a04c 100644 --- a/drivers/video/backlight/atmel-pwm-bl.c +++ b/drivers/video/backlight/atmel-pwm-bl.c | |||
@@ -48,7 +48,7 @@ static int atmel_pwm_bl_set_intensity(struct backlight_device *bd) | |||
48 | pwm_duty = pwmbl->pdata->pwm_duty_min; | 48 | pwm_duty = pwmbl->pdata->pwm_duty_min; |
49 | 49 | ||
50 | if (!intensity) { | 50 | if (!intensity) { |
51 | if (pwmbl->gpio_on != -1) { | 51 | if (gpio_is_valid(pwmbl->gpio_on)) { |
52 | gpio_set_value(pwmbl->gpio_on, | 52 | gpio_set_value(pwmbl->gpio_on, |
53 | 0 ^ pwmbl->pdata->on_active_low); | 53 | 0 ^ pwmbl->pdata->on_active_low); |
54 | } | 54 | } |
@@ -57,7 +57,7 @@ static int atmel_pwm_bl_set_intensity(struct backlight_device *bd) | |||
57 | } else { | 57 | } else { |
58 | pwm_channel_enable(&pwmbl->pwmc); | 58 | pwm_channel_enable(&pwmbl->pwmc); |
59 | pwm_channel_writel(&pwmbl->pwmc, PWM_CUPD, pwm_duty); | 59 | pwm_channel_writel(&pwmbl->pwmc, PWM_CUPD, pwm_duty); |
60 | if (pwmbl->gpio_on != -1) { | 60 | if (gpio_is_valid(pwmbl->gpio_on)) { |
61 | gpio_set_value(pwmbl->gpio_on, | 61 | gpio_set_value(pwmbl->gpio_on, |
62 | 1 ^ pwmbl->pdata->on_active_low); | 62 | 1 ^ pwmbl->pdata->on_active_low); |
63 | } | 63 | } |
@@ -146,7 +146,7 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev) | |||
146 | if (retval) | 146 | if (retval) |
147 | return retval; | 147 | return retval; |
148 | 148 | ||
149 | if (pwmbl->gpio_on != -1) { | 149 | if (gpio_is_valid(pwmbl->gpio_on)) { |
150 | retval = devm_gpio_request(&pdev->dev, pwmbl->gpio_on, | 150 | retval = devm_gpio_request(&pdev->dev, pwmbl->gpio_on, |
151 | "gpio_atmel_pwm_bl"); | 151 | "gpio_atmel_pwm_bl"); |
152 | if (retval) | 152 | if (retval) |
@@ -196,7 +196,7 @@ static int atmel_pwm_bl_remove(struct platform_device *pdev) | |||
196 | { | 196 | { |
197 | struct atmel_pwm_bl *pwmbl = platform_get_drvdata(pdev); | 197 | struct atmel_pwm_bl *pwmbl = platform_get_drvdata(pdev); |
198 | 198 | ||
199 | if (pwmbl->gpio_on != -1) { | 199 | if (gpio_is_valid(pwmbl->gpio_on)) { |
200 | gpio_set_value(pwmbl->gpio_on, | 200 | gpio_set_value(pwmbl->gpio_on, |
201 | 0 ^ pwmbl->pdata->on_active_low); | 201 | 0 ^ pwmbl->pdata->on_active_low); |
202 | } | 202 | } |