Re: [PATCH] gpio sysfs: add a "toggle" value

From: Mike Frysinger
Date: Thu Jun 04 2009 - 04:16:29 EST


On Thu, Jun 4, 2009 at 03:54, Andrew Morton wrote:
> On Wed, Â3 Jun 2009 04:16:59 -0400 Mike Frysinger wrote:
>> Signed-off-by: Mike Frysinger <vapier@xxxxxxxxxx>
>
> -ENOCHANGELOGAGAIN

it's pretty damned self explanatory

>> 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;
>
> A suitable place to document this is Documentation/gpio.txt.

yes, but i wanted to make sure David didnt reject the idea before i
spend time writing documentation.
-mike
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/