Skip to contentSkip to conversation

Documentation: gpiolib: sysfs: high can be any nonzero value

PATCH In review Dirk Behme 4 participants 4 messages Apr 22, 2015 – May 2, 2015

Subsystems (2)
lore
Share & tools
lore

Dirk Behme

author
#0 lore raw

PATCH 1/1 Documentation: gpiolib: sysfs: high can be any nonzero value

With the commit 79a9becda8940d ("gpiolib: export descriptor-based GPIO interface") the gpiolib can return any nonzero value for high. Not only 1. Correct this in the documentation.

---

Note: Commit 79a9becda8940d has been merged in v3.13. If this
patch is considered to be fine, please think about applying it to -stable >= v3.14, too.

 Documentation/gpio/sysfs.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/gpio/sysfs.txt +1 -1
index c2c3a97..bc7f31d 100644
@@ -69,7 +69,7 @@ and have the following read/write attributes:
 		it was exported by kernel code that didn't explicitly
 		allow userspace to reconfigure this GPIO's direction.
 
-	"value" ... reads as either 0 (low) or 1 (high). If the GPIO
+	"value" ... reads as either 0 (low) or nonzero (high). If the GPIO
 		is configured as an output, this value may be written;
 		any nonzero value is treated as high.
 
Signature · 1 line
2.3.6
#1 lore raw
Quoted 3 lines · Dirk Behme

With the commit 79a9becda8940d ("gpiolib: export descriptor-based GPIO interface") the gpiolib can return any nonzero value for high. Not only 1. Correct this in the documentation.

As _gpiod_get_raw_value returns a bool, I fail to see how that could happen.

Ah, that was fixed by commit 23600969ff13 ("gpio: clamp returned values to the boolean range") in 3.15.

Looks like that one should be backported to 3.14 instead.

Thanks,
Johan

#2 lore raw

Hi Greg,

Quoted 5 lines · Johan Hovold
Quoted 3 lines · Dirk Behme

With the commit 79a9becda8940d ("gpiolib: export descriptor-based GPIO interface") the gpiolib can return any nonzero value for high. Not only 1. Correct this in the documentation.

Quoted 8 lines

As _gpiod_get_raw_value returns a bool, I fail to see how that could happen.

Ah, that was fixed by commit 23600969ff13 ("gpio: clamp returned values to the boolean range") in 3.15.

Looks like that one should be backported to 3.14 instead.

I tested that 23600969ff13 clearly applies to 3.14.y and I confirm that it fixes the problem.

Would it be possible for you to backport this commit to LTS 3.14.y, since it fixes quite critical sysfs API regression? Or should I send the patch to [email protected] ?

Thank you in advance!

--
With best wishes,
Vladimir

#3 lore raw
Quoted 17 lines · Vladimir Zapolskiy

Hi Greg,

Quoted 5 lines · Johan Hovold
Quoted 3 lines · Dirk Behme

With the commit 79a9becda8940d ("gpiolib: export descriptor-based GPIO interface") the gpiolib can return any nonzero value for high. Not only 1. Correct this in the documentation.

Quoted 8 lines

As _gpiod_get_raw_value returns a bool, I fail to see how that could happen.

Ah, that was fixed by commit 23600969ff13 ("gpio: clamp returned values to the boolean range") in 3.15.

Looks like that one should be backported to 3.14 instead.

Quoted 6 lines

I tested that 23600969ff13 clearly applies to 3.14.y and I confirm that it fixes the problem.

Would it be possible for you to backport this commit to LTS 3.14.y, since it fixes quite critical sysfs API regression? Or should I send the patch to [email protected] ?

Normally always send this type of thing to stable@vger, but I've now picked it up, thanks.

greg k-h