From: David Brownell <david-b@pacbell.net>
To: "Kridner, Jason" <jdk@ti.com>
Cc: Koen Kooi <k.kooi@student.utwente.nl>,
"linux-omap@vger.kernel.org List" <linux-omap@vger.kernel.org>
Subject: Re: leds-gpio broken with current git?
Date: Mon, 23 Feb 2009 14:08:14 -0800 [thread overview]
Message-ID: <200902231408.14387.david-b@pacbell.net> (raw)
In-Reply-To: <200902231304.22137.david-b@pacbell.net>
On Monday 23 February 2009, David Brownell wrote:
>
> > Perhaps something broke with Tony's RC1 merge?
> > The LEDs are broken for me as well.
>
> Still works for me. Did you maybe not enable the twl4030
> GPIO support in Kconfig?
Oh, and if you did *not*, please give this patch a try.
I've been meaning to test it.
- Dave
==============
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.
---
drivers/leds/leds-gpio.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -90,13 +90,19 @@ static int gpio_led_probe(struct platfor
cur_led = &pdata->leds[i];
led_dat = &leds_data[i];
+ /* skip leds that aren't available */
+ led_dat->gpio = cur_led->gpio;
+ if (!gpio_is_valid(led_dat->gpio)) {
+ dev_dbg(&pdev->dev, "skipping %s\n", cur_led->name);
+ continue;
+ }
+
ret = gpio_request(cur_led->gpio, cur_led->name);
if (ret < 0)
goto err;
led_dat->cdev.name = cur_led->name;
led_dat->cdev.default_trigger = cur_led->default_trigger;
- led_dat->gpio = cur_led->gpio;
led_dat->can_sleep = gpio_cansleep(cur_led->gpio);
led_dat->active_low = cur_led->active_low;
if (pdata->gpio_blink_set) {
@@ -125,6 +131,8 @@ static int gpio_led_probe(struct platfor
err:
if (i > 0) {
for (i = i - 1; i >= 0; i--) {
+ if (!gpio_is_valid(leds_data[i].gpio))
+ continue;
led_classdev_unregister(&leds_data[i].cdev);
cancel_work_sync(&leds_data[i].work);
gpio_free(leds_data[i].gpio);
@@ -145,6 +153,8 @@ static int __devexit gpio_led_remove(str
leds_data = platform_get_drvdata(pdev);
for (i = 0; i < pdata->num_leds; i++) {
+ if (!gpio_is_valid(leds_data[i].gpio))
+ continue;
led_classdev_unregister(&leds_data[i].cdev);
cancel_work_sync(&leds_data[i].work);
gpio_free(leds_data[i].gpio);
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2009-02-23 22:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-15 14:19 leds-gpio broken with current git? Koen Kooi
2009-01-15 15:58 ` David Brownell
2009-02-23 14:30 ` Kridner, Jason
2009-02-23 21:04 ` David Brownell
2009-02-23 22:08 ` David Brownell [this message]
2009-02-25 15:45 ` Jason Kridner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200902231408.14387.david-b@pacbell.net \
--to=david-b@pacbell.net \
--cc=jdk@ti.com \
--cc=k.kooi@student.utwente.nl \
--cc=linux-omap@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.