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)); mutex_unlock(&sysfs_lock); return status; -- 1.7.10.4 -- 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