Zitat von Alexandre Courbot <gnurou@xxxxxxxxx>:
On Thu, Mar 27, 2014 at 8:09 AM, Michael Heimpold <mhei@xxxxxxxxxxx> wrote:
According to Documentation/gpio/sysfs.txt:
...
"value" ... reads as either 0 (low) or 1 (high).
Since some gpio implementations return non-zero if GPIO is set
but not 1, filter the return value to fit the documentation.
Signed-off-by: Michael Heimpold <mhei@xxxxxxxxxxx>
---
drivers/gpio/gpiolib.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 50c4922..45aa695 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -376,7 +376,7 @@ static ssize_t gpio_value_show(struct device *dev,
if (!test_bit(FLAG_EXPORT, &desc->flags))
status = -EIO;
else
- status = sprintf(buf, "%d\n",
gpiod_get_value_cansleep(desc));
+ status = sprintf(buf, "%d\n",
!!gpiod_get_value_cansleep(desc));
Patch 23600969ff137cf4c3bc9098f77e381de334e3f7 ("gpio: clamp returned
values to the boolean range") in -next already takes care of this at a
lower level, so I don't expect this to be needed?
Ah... seems I missed this patch, so yes we do not need this one.
Sorry for the noise.
Regards,
Michael
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html