Commit 519fe2ec authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'leds-fixes-3.10' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds

Pull LED subsystem fix from Bryan Wu.

* 'leds-fixes-3.10' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds:
  leds: leds-gpio: reserve gpio before using it
parents e748a385 803d19d5
...@@ -107,6 +107,10 @@ static int create_gpio_led(const struct gpio_led *template, ...@@ -107,6 +107,10 @@ static int create_gpio_led(const struct gpio_led *template,
return 0; return 0;
} }
ret = devm_gpio_request(parent, template->gpio, template->name);
if (ret < 0)
return ret;
led_dat->cdev.name = template->name; led_dat->cdev.name = template->name;
led_dat->cdev.default_trigger = template->default_trigger; led_dat->cdev.default_trigger = template->default_trigger;
led_dat->gpio = template->gpio; led_dat->gpio = template->gpio;
...@@ -126,10 +130,7 @@ static int create_gpio_led(const struct gpio_led *template, ...@@ -126,10 +130,7 @@ static int create_gpio_led(const struct gpio_led *template,
if (!template->retain_state_suspended) if (!template->retain_state_suspended)
led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME; led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME;
ret = devm_gpio_request_one(parent, template->gpio, ret = gpio_direction_output(led_dat->gpio, led_dat->active_low ^ state);
(led_dat->active_low ^ state) ?
GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW,
template->name);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment