summaryrefslogtreecommitdiffstats
path: root/drivers/leds
diff options
context:
space:
mode:
authorSachin Kamat <sachin.kamat@linaro.org>2012-11-25 10:10:20 +0530
committerBryan Wu <cooloney@gmail.com>2012-11-27 14:49:24 -0800
commite3b1d44c3550e5badfa5b78ffec80e15d7d9b287 (patch)
tree180a664bdfcee84392ea82272ea2539a75a33f40 /drivers/leds
parent4401e48737c4068604144a5c0ba23a9c82ea3a37 (diff)
downloadop-kernel-dev-e3b1d44c3550e5badfa5b78ffec80e15d7d9b287.zip
op-kernel-dev-e3b1d44c3550e5badfa5b78ffec80e15d7d9b287.tar.gz
leds: leds-gpio: use devm_gpio_request_one
devm_gpio_request_one is device managed and makes error handling and cleanup simpler. Cc: Raphael Assenat <raph@8d.com> Cc: Trent Piepho <tpiepho@freescale.com> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Bryan Wu <cooloney@gmail.com>
Diffstat (limited to 'drivers/leds')
-rw-r--r--drivers/leds/leds-gpio.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index 6a21096..77e2e40 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -126,7 +126,7 @@ static int __devinit create_gpio_led(const struct gpio_led *template,
if (!template->retain_state_suspended)
led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME;
- ret = gpio_request_one(template->gpio,
+ ret = devm_gpio_request_one(parent, template->gpio,
GPIOF_DIR_OUT | (led_dat->active_low ^ state),
template->name);
if (ret < 0)
@@ -136,12 +136,9 @@ static int __devinit create_gpio_led(const struct gpio_led *template,
ret = led_classdev_register(parent, &led_dat->cdev);
if (ret < 0)
- goto err;
+ return ret;
return 0;
-err:
- gpio_free(led_dat->gpio);
- return ret;
}
static void delete_gpio_led(struct gpio_led_data *led)
@@ -150,7 +147,6 @@ static void delete_gpio_led(struct gpio_led_data *led)
return;
led_classdev_unregister(&led->cdev);
cancel_work_sync(&led->work);
- gpio_free(led->gpio);
}
struct gpio_leds_priv {
OpenPOWER on IntegriCloud