aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2013-02-21 19:43:16 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-21 20:22:21 -0500
commite2ffe8563a528a302abfbb7ed655fc1a3b79128f (patch)
tree7caca40b1053920606a0867a52f42488e9df8ba8 /drivers/video
parentd2fff29042877154c3bc051a147bc7964a2e5fe2 (diff)
backlight: ld9040: remove unnecessary NULL deference check
Removee unnecessary NULL deference check, because it was already checked in ld9040_probe(). Also, power_is_on is replaced with ld9040_power_is_on(). Signed-off-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')
-rw-r--r--drivers/video/backlight/ld9040.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/drivers/video/backlight/ld9040.c b/drivers/video/backlight/ld9040.c
index a52a6a7e572e..45f795ab4394 100644
--- a/drivers/video/backlight/ld9040.c
+++ b/drivers/video/backlight/ld9040.c
@@ -43,7 +43,6 @@
43 43
44#define MIN_BRIGHTNESS 0 44#define MIN_BRIGHTNESS 0
45#define MAX_BRIGHTNESS 24 45#define MAX_BRIGHTNESS 24
46#define power_is_on(pwr) ((pwr) <= FB_BLANK_NORMAL)
47 46
48struct ld9040 { 47struct ld9040 {
49 struct device *dev; 48 struct device *dev;
@@ -567,15 +566,17 @@ static int ld9040_ldi_disable(struct ld9040 *lcd)
567 return ret; 566 return ret;
568} 567}
569 568
569static int ld9040_power_is_on(int power)
570{
571 return power <= FB_BLANK_NORMAL;
572}
573
570static int ld9040_power_on(struct ld9040 *lcd) 574static int ld9040_power_on(struct ld9040 *lcd)
571{ 575{
572 int ret = 0; 576 int ret = 0;
573 struct lcd_platform_data *pd = NULL; 577 struct lcd_platform_data *pd;
578
574 pd = lcd->lcd_pd; 579 pd = lcd->lcd_pd;
575 if (!pd) {
576 dev_err(lcd->dev, "platform data is NULL.\n");
577 return -EFAULT;
578 }
579 580
580 /* lcd power on */ 581 /* lcd power on */
581 ld9040_regulator_enable(lcd); 582 ld9040_regulator_enable(lcd);
@@ -605,14 +606,10 @@ static int ld9040_power_on(struct ld9040 *lcd)
605 606
606static int ld9040_power_off(struct ld9040 *lcd) 607static int ld9040_power_off(struct ld9040 *lcd)
607{ 608{
608 int ret = 0; 609 int ret;
609 struct lcd_platform_data *pd = NULL; 610 struct lcd_platform_data *pd;
610 611
611 pd = lcd->lcd_pd; 612 pd = lcd->lcd_pd;
612 if (!pd) {
613 dev_err(lcd->dev, "platform data is NULL.\n");
614 return -EFAULT;
615 }
616 613
617 ret = ld9040_ldi_disable(lcd); 614 ret = ld9040_ldi_disable(lcd);
618 if (ret) { 615 if (ret) {
@@ -632,9 +629,9 @@ static int ld9040_power(struct ld9040 *lcd, int power)
632{ 629{
633 int ret = 0; 630 int ret = 0;
634 631
635 if (power_is_on(power) && !power_is_on(lcd->power)) 632 if (ld9040_power_is_on(power) && !ld9040_power_is_on(lcd->power))
636 ret = ld9040_power_on(lcd); 633 ret = ld9040_power_on(lcd);
637 else if (!power_is_on(power) && power_is_on(lcd->power)) 634 else if (!ld9040_power_is_on(power) && ld9040_power_is_on(lcd->power))
638 ret = ld9040_power_off(lcd); 635 ret = ld9040_power_off(lcd);
639 636
640 if (!ret) 637 if (!ret)
@@ -773,8 +770,9 @@ static int ld9040_probe(struct spi_device *spi)
773 lcd->power = FB_BLANK_POWERDOWN; 770 lcd->power = FB_BLANK_POWERDOWN;
774 771
775 ld9040_power(lcd, FB_BLANK_UNBLANK); 772 ld9040_power(lcd, FB_BLANK_UNBLANK);
776 } else 773 } else {
777 lcd->power = FB_BLANK_UNBLANK; 774 lcd->power = FB_BLANK_UNBLANK;
775 }
778 776
779 dev_set_drvdata(&spi->dev, lcd); 777 dev_set_drvdata(&spi->dev, lcd);
780 778