leds: leds-lt3593: use gpio_request_one
authorJingoo Han <jg1.han@samsung.com>
Tue, 23 Oct 2012 12:17:56 +0000 (05:17 -0700)
committerBryan Wu <cooloney@gmail.com>
Mon, 26 Nov 2012 22:28:43 +0000 (14:28 -0800)
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>
drivers/leds/leds-lt3593.c

index 09a732217f6d96fd3b554d85b6127201da8db6b5..17b710c63995d795189a8e6511a3569e8538f91c 100644 (file)
@@ -94,10 +94,6 @@ static int __devinit create_lt3593_led(const struct gpio_led *template,
                return 0;
        }
 
                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;
        led_dat->cdev.name = template->name;
        led_dat->cdev.default_trigger = template->default_trigger;
        led_dat->gpio = template->gpio;
@@ -110,9 +106,10 @@ static int __devinit create_lt3593_led(const struct gpio_led *template,
        if (!template->retain_state_suspended)
                led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME;
 
        if (!template->retain_state_suspended)
                led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME;
 
-       ret = gpio_direction_output(led_dat->gpio, state);
+       ret = gpio_request_one(template->gpio, GPIOF_DIR_OUT | state,
+                               template->name);
        if (ret < 0)
        if (ret < 0)
-               goto err;
+               return ret;
 
        INIT_WORK(&led_dat->work, lt3593_led_work);
 
 
        INIT_WORK(&led_dat->work, lt3593_led_work);