* [PATCH] gpiolib: Don't return -EPROBE_DEFER to sysfs, or for invalid gpios
@ 2012-10-25 11:03 Mathias Nyman
2012-10-26 7:26 ` Linus Walleij
0 siblings, 1 reply; 3+ messages in thread
From: Mathias Nyman @ 2012-10-25 11:03 UTC (permalink / raw)
To: linus.walleij; +Cc: grant.likely, broonie, linux-kernel, Mathias Nyman
gpios requested with invalid numbers, or gpios requested from userspace via sysfs
should not try to be deferred on failure.
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
---
drivers/gpio/gpiolib.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 141f793..b59d240 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -651,9 +651,11 @@ static ssize_t export_store(struct class *class,
*/
status = gpio_request(gpio, "sysfs");
- if (status < 0)
+ if (status < 0) {
+ if (status == -EPROBE_DEFER)
+ status = -ENODEV;
goto done;
-
+ }
status = gpio_export(gpio, true);
if (status < 0)
gpio_free(gpio);
@@ -1220,8 +1222,10 @@ int gpio_request(unsigned gpio, const char *label)
spin_lock_irqsave(&gpio_lock, flags);
- if (!gpio_is_valid(gpio))
+ if (!gpio_is_valid(gpio)) {
+ status = -EINVAL;
goto done;
+ }
desc = &gpio_desc[gpio];
chip = desc->chip;
if (chip == NULL)
--
1.7.4.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] gpiolib: Don't return -EPROBE_DEFER to sysfs, or for invalid gpios
2012-10-25 11:03 [PATCH] gpiolib: Don't return -EPROBE_DEFER to sysfs, or for invalid gpios Mathias Nyman
@ 2012-10-26 7:26 ` Linus Walleij
2012-10-27 21:37 ` Mark Brown
0 siblings, 1 reply; 3+ messages in thread
From: Linus Walleij @ 2012-10-26 7:26 UTC (permalink / raw)
To: Mathias Nyman; +Cc: linus.walleij, grant.likely, broonie, linux-kernel
On Thu, Oct 25, 2012 at 1:03 PM, Mathias Nyman
<mathias.nyman@linux.intel.com> wrote:
> gpios requested with invalid numbers, or gpios requested from userspace via sysfs
> should not try to be deferred on failure.
>
> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Very good catch. I applied this to my fixes branch and also
put the stable tag on this thing, it goes way back to the introduction
of deffered probe.
Mark: OK with this?
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gpiolib: Don't return -EPROBE_DEFER to sysfs, or for invalid gpios
2012-10-26 7:26 ` Linus Walleij
@ 2012-10-27 21:37 ` Mark Brown
0 siblings, 0 replies; 3+ messages in thread
From: Mark Brown @ 2012-10-27 21:37 UTC (permalink / raw)
To: Linus Walleij; +Cc: Mathias Nyman, linus.walleij, grant.likely, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 831 bytes --]
On Fri, Oct 26, 2012 at 09:26:33AM +0200, Linus Walleij wrote:
> On Thu, Oct 25, 2012 at 1:03 PM, Mathias Nyman
> > gpios requested with invalid numbers, or gpios requested from userspace via sysfs
> > should not try to be deferred on failure.
> Very good catch. I applied this to my fixes branch and also
> put the stable tag on this thing, it goes way back to the introduction
> of deffered probe.
> Mark: OK with this?
The invalid numbers thing I'm a bit meh on. It came up before and I
personally wasn't sure if the issue wasn't with gpio_is_valid() only
checking for "this number could possibly ever be a GPIO" and not doing
any checking against the GPIOs that have actually been registered. If
it's the former then ideally at some point in the future we'll remove
the big table and gpio_is_valid() will always be true.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-10-27 21:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-25 11:03 [PATCH] gpiolib: Don't return -EPROBE_DEFER to sysfs, or for invalid gpios Mathias Nyman
2012-10-26 7:26 ` Linus Walleij
2012-10-27 21:37 ` Mark Brown
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.