Commit d379ee8a authored by David Brownell's avatar David Brownell Committed by Richard Purdie

leds: just ignore invalid GPIOs in leds-gpio

Sometimes it's awkward to make sure that the array in the
platform_data handed to the leds-gpio driver has only valid
data ... some leds may not be always available, and coping
with that currently requires patching or rebuilding the array.

This patch fixes that by making it be OK to pass an invalid
GPIO (such as "-EINVAL") ... such table entries are skipped.

[ adjusted to apply against other led tree changes]
Signed-off-by: default avatarDavid Brownell <>
Tested-by: default avatarDiego Dompe <>
Signed-off-by: default avatarRichard Purdie <>
parent 7fbc3a9b
......@@ -78,6 +78,13 @@ static int __devinit create_gpio_led(const struct gpio_led *template,
int ret;
/* skip leds that aren't available */
if (!gpio_is_valid(template->gpio)) {
printk(KERN_INFO "Skipping unavilable LED gpio %d (%s)\n",
template->gpio, template->name);
ret = gpio_request(template->gpio, template->name);
if (ret < 0)
return ret;
......@@ -114,6 +121,8 @@ static int __devinit create_gpio_led(const struct gpio_led *template,
static void delete_gpio_led(struct gpio_led_data *led)
if (!gpio_is_valid(led->gpio))
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