mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
gpio: modify sysfs gpio export so that "value" displays as 0 or 1
gpiolib can export GPIOs to userspace via sysfs. This patch modifies the gpio_value_show() so that any non-zero value is explicitly printed as "1", rather than whatever numerical value the lower-level driver returns. Signed-off-by: Steve Falco <[email protected]> Signed-off-by: David Brownell <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
c8fc40cd34
commit
e3274e9150
1 changed files with 1 additions and 1 deletions
|
|
@ -248,7 +248,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", gpio_get_value_cansleep(gpio));
|
||||
status = sprintf(buf, "%d\n", !!gpio_get_value_cansleep(gpio));
|
||||
|
||||
mutex_unlock(&sysfs_lock);
|
||||
return status;
|
||||
|
|
|
|||
Loading…
Reference in a new issue