Commit 4405d5d9 authored by Jingoo Han's avatar Jingoo Han Committed by Linus Torvalds

backlight: corgi_lcd: use devm_gpio_request()

The devm_ functions allocate memory that is released when a driver
detaches.  This patch uses devm_gpio_request() for these functions.
Signed-off-by: default avatarJingoo Han <jg1.han@samsung.com>
Cc: Eric Miao <eric.y.miao@gmail.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 04e961fb
...@@ -492,7 +492,8 @@ static int setup_gpio_backlight(struct corgi_lcd *lcd, ...@@ -492,7 +492,8 @@ static int setup_gpio_backlight(struct corgi_lcd *lcd,
lcd->gpio_backlight_cont = -1; lcd->gpio_backlight_cont = -1;
if (gpio_is_valid(pdata->gpio_backlight_on)) { if (gpio_is_valid(pdata->gpio_backlight_on)) {
err = gpio_request(pdata->gpio_backlight_on, "BL_ON"); err = devm_gpio_request(&spi->dev, pdata->gpio_backlight_on,
"BL_ON");
if (err) { if (err) {
dev_err(&spi->dev, "failed to request GPIO%d for " dev_err(&spi->dev, "failed to request GPIO%d for "
"backlight_on\n", pdata->gpio_backlight_on); "backlight_on\n", pdata->gpio_backlight_on);
...@@ -504,11 +505,12 @@ static int setup_gpio_backlight(struct corgi_lcd *lcd, ...@@ -504,11 +505,12 @@ static int setup_gpio_backlight(struct corgi_lcd *lcd,
} }
if (gpio_is_valid(pdata->gpio_backlight_cont)) { if (gpio_is_valid(pdata->gpio_backlight_cont)) {
err = gpio_request(pdata->gpio_backlight_cont, "BL_CONT"); err = devm_gpio_request(&spi->dev, pdata->gpio_backlight_cont,
"BL_CONT");
if (err) { if (err) {
dev_err(&spi->dev, "failed to request GPIO%d for " dev_err(&spi->dev, "failed to request GPIO%d for "
"backlight_cont\n", pdata->gpio_backlight_cont); "backlight_cont\n", pdata->gpio_backlight_cont);
goto err_free_backlight_on; return err;
} }
lcd->gpio_backlight_cont = pdata->gpio_backlight_cont; lcd->gpio_backlight_cont = pdata->gpio_backlight_cont;
...@@ -525,11 +527,6 @@ static int setup_gpio_backlight(struct corgi_lcd *lcd, ...@@ -525,11 +527,6 @@ static int setup_gpio_backlight(struct corgi_lcd *lcd,
} }
} }
return 0; return 0;
err_free_backlight_on:
if (gpio_is_valid(lcd->gpio_backlight_on))
gpio_free(lcd->gpio_backlight_on);
return err;
} }
static int __devinit corgi_lcd_probe(struct spi_device *spi) static int __devinit corgi_lcd_probe(struct spi_device *spi)
...@@ -602,12 +599,6 @@ static int __devexit corgi_lcd_remove(struct spi_device *spi) ...@@ -602,12 +599,6 @@ static int __devexit corgi_lcd_remove(struct spi_device *spi)
backlight_update_status(lcd->bl_dev); backlight_update_status(lcd->bl_dev);
backlight_device_unregister(lcd->bl_dev); backlight_device_unregister(lcd->bl_dev);
if (gpio_is_valid(lcd->gpio_backlight_on))
gpio_free(lcd->gpio_backlight_on);
if (gpio_is_valid(lcd->gpio_backlight_cont))
gpio_free(lcd->gpio_backlight_cont);
corgi_lcd_set_power(lcd->lcd_dev, FB_BLANK_POWERDOWN); corgi_lcd_set_power(lcd->lcd_dev, FB_BLANK_POWERDOWN);
lcd_device_unregister(lcd->lcd_dev); lcd_device_unregister(lcd->lcd_dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment