aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/video/backlight/corgi_lcd.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/drivers/video/backlight/corgi_lcd.c b/drivers/video/backlight/corgi_lcd.c
index 23d732677ba1..c781768ba892 100644
--- a/drivers/video/backlight/corgi_lcd.c
+++ b/drivers/video/backlight/corgi_lcd.c
@@ -492,7 +492,8 @@ static int setup_gpio_backlight(struct corgi_lcd *lcd,
492 lcd->gpio_backlight_cont = -1; 492 lcd->gpio_backlight_cont = -1;
493 493
494 if (gpio_is_valid(pdata->gpio_backlight_on)) { 494 if (gpio_is_valid(pdata->gpio_backlight_on)) {
495 err = gpio_request(pdata->gpio_backlight_on, "BL_ON"); 495 err = devm_gpio_request(&spi->dev, pdata->gpio_backlight_on,
496 "BL_ON");
496 if (err) { 497 if (err) {
497 dev_err(&spi->dev, "failed to request GPIO%d for " 498 dev_err(&spi->dev, "failed to request GPIO%d for "
498 "backlight_on\n", pdata->gpio_backlight_on); 499 "backlight_on\n", pdata->gpio_backlight_on);
@@ -504,11 +505,12 @@ static int setup_gpio_backlight(struct corgi_lcd *lcd,
504 } 505 }
505 506
506 if (gpio_is_valid(pdata->gpio_backlight_cont)) { 507 if (gpio_is_valid(pdata->gpio_backlight_cont)) {
507 err = gpio_request(pdata->gpio_backlight_cont, "BL_CONT"); 508 err = devm_gpio_request(&spi->dev, pdata->gpio_backlight_cont,
509 "BL_CONT");
508 if (err) { 510 if (err) {
509 dev_err(&spi->dev, "failed to request GPIO%d for " 511 dev_err(&spi->dev, "failed to request GPIO%d for "
510 "backlight_cont\n", pdata->gpio_backlight_cont); 512 "backlight_cont\n", pdata->gpio_backlight_cont);
511 goto err_free_backlight_on; 513 return err;
512 } 514 }
513 515
514 lcd->gpio_backlight_cont = pdata->gpio_backlight_cont; 516 lcd->gpio_backlight_cont = pdata->gpio_backlight_cont;
@@ -525,11 +527,6 @@ static int setup_gpio_backlight(struct corgi_lcd *lcd,
525 } 527 }
526 } 528 }
527 return 0; 529 return 0;
528
529err_free_backlight_on:
530 if (gpio_is_valid(lcd->gpio_backlight_on))
531 gpio_free(lcd->gpio_backlight_on);
532 return err;
533} 530}
534 531
535static int __devinit corgi_lcd_probe(struct spi_device *spi) 532static int __devinit corgi_lcd_probe(struct spi_device *spi)
@@ -602,12 +599,6 @@ static int __devexit corgi_lcd_remove(struct spi_device *spi)
602 backlight_update_status(lcd->bl_dev); 599 backlight_update_status(lcd->bl_dev);
603 backlight_device_unregister(lcd->bl_dev); 600 backlight_device_unregister(lcd->bl_dev);
604 601
605 if (gpio_is_valid(lcd->gpio_backlight_on))
606 gpio_free(lcd->gpio_backlight_on);
607
608 if (gpio_is_valid(lcd->gpio_backlight_cont))
609 gpio_free(lcd->gpio_backlight_cont);
610
611 corgi_lcd_set_power(lcd->lcd_dev, FB_BLANK_POWERDOWN); 602 corgi_lcd_set_power(lcd->lcd_dev, FB_BLANK_POWERDOWN);
612 lcd_device_unregister(lcd->lcd_dev); 603 lcd_device_unregister(lcd->lcd_dev);
613 604