summaryrefslogtreecommitdiffstats
path: root/drivers/leds
diff options
context:
space:
mode:
authorSachin Kamat <sachin.kamat@linaro.org>2012-11-25 10:14:27 +0530
committerBryan Wu <cooloney@gmail.com>2012-11-27 14:49:24 -0800
commit95a8ff835674e1156c0640f83829773f8bfe655a (patch)
treea531694c0a331162d1fc43907f4f308e6d2bd8a4 /drivers/leds
parente3b1d44c3550e5badfa5b78ffec80e15d7d9b287 (diff)
downloadblackbird-op-linux-95a8ff835674e1156c0640f83829773f8bfe655a.tar.gz
blackbird-op-linux-95a8ff835674e1156c0640f83829773f8bfe655a.zip
leds: leds-lt3593: use devm_gpio_request_one
devm_gpio_request_one is device managed and makes error handling and cleanup simpler. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Acked-by: Daniel Mack <daniel@caiaq.de> Signed-off-by: Bryan Wu <cooloney@gmail.com>
Diffstat (limited to 'drivers/leds')
-rw-r--r--drivers/leds/leds-lt3593.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/leds/leds-lt3593.c b/drivers/leds/leds-lt3593.c
index 17b710c63995..5ee6b8b7e4d3 100644
--- a/drivers/leds/leds-lt3593.c
+++ b/drivers/leds/leds-lt3593.c
@@ -106,8 +106,8 @@ static int __devinit create_lt3593_led(const struct gpio_led *template,
if (!template->retain_state_suspended)
led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME;
- ret = gpio_request_one(template->gpio, GPIOF_DIR_OUT | state,
- template->name);
+ ret = devm_gpio_request_one(parent, template->gpio,
+ GPIOF_DIR_OUT | state, template->name);
if (ret < 0)
return ret;
@@ -115,16 +115,12 @@ static int __devinit create_lt3593_led(const struct gpio_led *template,
ret = led_classdev_register(parent, &led_dat->cdev);
if (ret < 0)
- goto err;
+ return ret;
printk(KERN_INFO "%s: registered LT3593 LED '%s' at GPIO %d\n",
KBUILD_MODNAME, template->name, template->gpio);
return 0;
-
-err:
- gpio_free(led_dat->gpio);
- return ret;
}
static void delete_lt3593_led(struct lt3593_led_data *led)
@@ -134,7 +130,6 @@ static void delete_lt3593_led(struct lt3593_led_data *led)
led_classdev_unregister(&led->cdev);
cancel_work_sync(&led->work);
- gpio_free(led->gpio);
}
static int __devinit lt3593_led_probe(struct platform_device *pdev)
OpenPOWER on IntegriCloud