[generic:] preliminary 3.12 support
[openwrt.git] / target / linux / generic / patches-3.8 / 040-backport_led_gpio_request_fix.patch
1 --- a/drivers/leds/leds-gpio.c
2 +++ b/drivers/leds/leds-gpio.c
3 @@ -107,6 +107,10 @@ static int create_gpio_led(const struct
4                 return 0;
5         }
6  
7 +       ret = devm_gpio_request(parent, template->gpio, template->name);
8 +       if (ret < 0)
9 +               return ret;
10 +
11         led_dat->cdev.name = template->name;
12         led_dat->cdev.default_trigger = template->default_trigger;
13         led_dat->gpio = template->gpio;
14 @@ -126,10 +130,7 @@ static int create_gpio_led(const struct
15         if (!template->retain_state_suspended)
16                 led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME;
17  
18 -       ret = devm_gpio_request_one(parent, template->gpio,
19 -                                   (led_dat->active_low ^ state) ?
20 -                                   GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW,
21 -                                   template->name);
22 +       ret = gpio_direction_output(led_dat->gpio, led_dat->active_low ^ state);
23         if (ret < 0)
24                 return ret;
25