public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gpio sysfs: add a "toggle" value
@ 2009-06-03  8:16 Mike Frysinger
  2009-06-04  7:54 ` Andrew Morton
  0 siblings, 1 reply; 13+ messages in thread
From: Mike Frysinger @ 2009-06-03  8:16 UTC (permalink / raw)
  To: David Brownell; +Cc: linux-kernel

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 drivers/gpio/gpiolib.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 51a8d41..7f79732 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -274,7 +274,12 @@ static ssize_t gpio_value_store(struct device *dev,
 	else {
 		long		value;
 
-		status = strict_strtol(buf, 0, &value);
+		if (sysfs_streq(buf, "toggle")) {
+			value = !gpio_get_value_cansleep(gpio);
+			status = 0;
+		} else
+			status = strict_strtol(buf, 0, &value);
+
 		if (status == 0) {
 			gpio_set_value_cansleep(gpio, value != 0);
 			status = size;
-- 
1.6.3.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2009-06-04 10:07 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-03  8:16 [PATCH] gpio sysfs: add a "toggle" value Mike Frysinger
2009-06-04  7:54 ` Andrew Morton
2009-06-04  8:16   ` Mike Frysinger
2009-06-04  8:27     ` David Brownell
2009-06-04  8:52       ` Mike Frysinger
2009-06-04  9:05         ` Andrew Morton
2009-06-04  9:06         ` David Brownell
2009-06-04  9:09           ` Mike Frysinger
2009-06-04  9:15             ` David Brownell
2009-06-04  9:20               ` Mike Frysinger
2009-06-04  9:48                 ` David Brownell
2009-06-04 10:06                   ` Mike Frysinger
2009-06-04  8:36     ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox