summaryrefslogtreecommitdiffstats
path: root/drivers/leds
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2012-10-23 14:17:11 +0200
committerBryan Wu <cooloney@gmail.com>2012-11-26 23:28:43 +0100
commita99d76f9eb5336291fa6af713844d1c779484e30 (patch)
treed48484ba53d7b3fb007d57f571f4e74976493ac3 /drivers/leds
parentleds: lm355x: Return proper error for lm3556_indicator_pattern_store error path (diff)
downloadlinux-a99d76f9eb5336291fa6af713844d1c779484e30.tar.xz
linux-a99d76f9eb5336291fa6af713844d1c779484e30.zip
leds: leds-gpio: use gpio_request_one
Using gpio_request_one can make the code simpler because it can set the direction and initial value in one shot. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Bryan Wu <cooloney@gmail.com>
Diffstat (limited to 'drivers/leds')
-rw-r--r--drivers/leds/leds-gpio.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index 087d1e66f4f7..0b4185315261 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -106,10 +106,6 @@ static int __devinit create_gpio_led(const struct gpio_led *template,
return 0;
}
- ret = gpio_request(template->gpio, template->name);
- if (ret < 0)
- return ret;
-
led_dat->cdev.name = template->name;
led_dat->cdev.default_trigger = template->default_trigger;
led_dat->gpio = template->gpio;
@@ -129,10 +125,12 @@ 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_direction_output(led_dat->gpio, led_dat->active_low ^ state);
+ ret = gpio_request_one(template->gpio,
+ GPIOF_DIR_OUT | (led_dat->active_low ^ state),
+ template->name);
if (ret < 0)
- goto err;
-
+ return ret;
+
INIT_WORK(&led_dat->work, gpio_led_work);
ret = led_classdev_register(parent, &led_dat->cdev);