lkml.org 
[lkml]   [2009]   [Jun]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] gpio sysfs: add a "toggle" value
Date
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


\
 
 \ /
  Last update: 2009-06-03 10:19    [W:0.109 / U:0.308 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site