* Re: leds: just ignore invalid GPIOs in leds-gpio [not found] <200904062059.n36Kxlum026774@hera.kernel.org> @ 2009-04-07 12:00 ` Geert Uytterhoeven 2009-04-08 0:51 ` David Brownell 0 siblings, 1 reply; 3+ messages in thread From: Geert Uytterhoeven @ 2009-04-07 12:00 UTC (permalink / raw) To: David Brownell, Richard Purdie; +Cc: Linux Kernel Development On Mon, 6 Apr 2009, Linux Kernel Mailing List wrote: > Gitweb: http://git.kernel.org/linus/d379ee8acd0719736ee7f1d1ccc3b5765880eaf8 > Commit: d379ee8acd0719736ee7f1d1ccc3b5765880eaf8 > Parent: 7fbc3a9b132e93b2ba1fd889c1ad8a4135731cc3 > Author: David Brownell <dbrownell@users.sourceforge.net> > AuthorDate: Thu Mar 5 16:46:44 2009 -0800 > Committer: Richard Purdie <rpurdie@linux.intel.com> > CommitDate: Mon Apr 6 16:06:27 2009 +0100 > > 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. > > [rpurdie@linux.intel.com: adjusted to apply against other led tree changes] > Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> > Tested-by: Diego Dompe <diego.dompe@ridgerun.com> > Signed-off-by: Richard Purdie <rpurdie@linux.intel.com> > --- > drivers/leds/leds-gpio.c | 9 +++++++++ > 1 files changed, 9 insertions(+), 0 deletions(-) > > diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c > index 8fa352a..102ef4a 100644 > --- a/drivers/leds/leds-gpio.c > +++ b/drivers/leds/leds-gpio.c > @@ -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); > + return; | drivers/leds/leds-gpio.c:85: warning: 'return' with no value, in function | returning non-void So what should we return here? -ENODEV? -EINVAL? Anything else? > + } > + > ret = gpio_request(template->gpio, template->name); > if (ret < 0) > return ret; With kind regards, Geert Uytterhoeven Software Architect Sony Techsoft Centre Europe The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium Phone: +32 (0)2 700 8453 Fax: +32 (0)2 700 8622 E-mail: Geert.Uytterhoeven@sonycom.com Internet: http://www.sony-europe.com/ A division of Sony Europe (Belgium) N.V. VAT BE 0413.825.160 · RPR Brussels Fortis · BIC GEBABEBB · IBAN BE41293037680010 ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: leds: just ignore invalid GPIOs in leds-gpio 2009-04-07 12:00 ` leds: just ignore invalid GPIOs in leds-gpio Geert Uytterhoeven @ 2009-04-08 0:51 ` David Brownell 2009-04-08 13:09 ` Richard Purdie 0 siblings, 1 reply; 3+ messages in thread From: David Brownell @ 2009-04-08 0:51 UTC (permalink / raw) To: Geert Uytterhoeven; +Cc: Richard Purdie, Linux Kernel Development On Tuesday 07 April 2009, Geert Uytterhoeven wrote: > | drivers/leds/leds-gpio.c:85: warning: 'return' with no value, in function > | returning non-void > > So what should we return here? -ENODEV? -EINVAL? Anything else? Success: 0. The point is to ignore them, not fail! See the appended. - Dave ========== CUT HERE From: David Brownell <dbrownell@users.sourceforge.net> Fix build problems with leds-gpio: CC drivers/leds/leds-gpio.o drivers/leds/leds-gpio.c: In function 'create_gpio_led': drivers/leds/leds-gpio.c:85: warning: 'return' with no value, in function returning non-void Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> --- drivers/leds/leds-gpio.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/drivers/leds/leds-gpio.c +++ b/drivers/leds/leds-gpio.c @@ -82,7 +84,7 @@ static int __devinit create_gpio_led(con if (!gpio_is_valid(template->gpio)) { printk(KERN_INFO "Skipping unavilable LED gpio %d (%s)\n", template->gpio, template->name); - return; + return 0; } ret = gpio_request(template->gpio, template->name); ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: leds: just ignore invalid GPIOs in leds-gpio 2009-04-08 0:51 ` David Brownell @ 2009-04-08 13:09 ` Richard Purdie 0 siblings, 0 replies; 3+ messages in thread From: Richard Purdie @ 2009-04-08 13:09 UTC (permalink / raw) To: David Brownell; +Cc: Geert Uytterhoeven, Linux Kernel Development On Tue, 2009-04-07 at 17:51 -0700, David Brownell wrote: > On Tuesday 07 April 2009, Geert Uytterhoeven wrote: > > | drivers/leds/leds-gpio.c:85: warning: 'return' with no value, in function > > | returning non-void > > > > So what should we return here? -ENODEV? -EINVAL? Anything else? > > Success: 0. The point is to ignore them, not fail! > > > See the appended. Agreed. I wondered about returning ENODEV and then catching it in the calling functions but that doesn't work out as very clear code. I'll queue and submit this. Cheers, Richard ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-04-08 13:12 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <200904062059.n36Kxlum026774@hera.kernel.org> 2009-04-07 12:00 ` leds: just ignore invalid GPIOs in leds-gpio Geert Uytterhoeven 2009-04-08 0:51 ` David Brownell 2009-04-08 13:09 ` Richard Purdie
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).