Skip to content

Commit

Permalink
backlight: tosa_lcd: use devm_gpio_request()
Browse files Browse the repository at this point in the history
The devm_ functions allocate memory that is released when a driver
detaches.  This patch uses devm_gpio_request() for these functions.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Cc: Dmitry Baryshkov <dbaryshkov@gmail.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Jingoo Han authored and Linus Torvalds committed Jul 31, 2012
1 parent f673934 commit 402ff9a
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions drivers/video/backlight/tosa_lcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,15 @@ static int __devinit tosa_lcd_probe(struct spi_device *spi)
data->spi = spi;
dev_set_drvdata(&spi->dev, data);

ret = gpio_request(TOSA_GPIO_TG_ON, "tg #pwr");
ret = devm_gpio_request(&spi->dev, TOSA_GPIO_TG_ON, "tg #pwr");
if (ret < 0)
goto err_gpio_tg;

mdelay(60);

ret = gpio_direction_output(TOSA_GPIO_TG_ON, 0);
if (ret < 0)
goto err_gpio_dir;
goto err_gpio_tg;

mdelay(60);
tosa_lcd_tg_init(data);
Expand All @@ -221,8 +221,6 @@ static int __devinit tosa_lcd_probe(struct spi_device *spi)

err_register:
tosa_lcd_tg_off(data);
err_gpio_dir:
gpio_free(TOSA_GPIO_TG_ON);
err_gpio_tg:
dev_set_drvdata(&spi->dev, NULL);
return ret;
Expand All @@ -239,7 +237,6 @@ static int __devexit tosa_lcd_remove(struct spi_device *spi)

tosa_lcd_tg_off(data);

gpio_free(TOSA_GPIO_TG_ON);
dev_set_drvdata(&spi->dev, NULL);

return 0;
Expand Down

0 comments on commit 402ff9a

Please sign in to comment.