All of lore.kernel.org
 help / color / mirror / Atom feed
* [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

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.