diff options
author | Alexandre Courbot <acourbot@nvidia.com> | 2014-03-11 07:52:09 +0100 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2014-03-14 10:17:03 +0100 |
commit | 23600969ff137cf4c3bc9098f77e381de334e3f7 (patch) | |
tree | ad8bcad3af9b5635323b90cf0de346a1ee5db7c3 /arch/hexagon | |
parent | gpio / ACPI: Rework ACPI GPIO event handling (diff) | |
download | linux-23600969ff137cf4c3bc9098f77e381de334e3f7.tar.xz linux-23600969ff137cf4c3bc9098f77e381de334e3f7.zip |
gpio: clamp returned values to the boolean range
Nothing prevents GPIO drivers from returning values outside the
boolean range, and as it turns out a few drivers are actually doing so.
These values were passed as-is to unsuspecting consumers and created
confusion.
This patch makes the internal _gpiod_get_raw_value() function return a
bool, effectively clamping the GPIO value to the boolean range no
matter what the driver does.
While we are at it, we also change the value parameter of
_gpiod_set_raw_value() to bool type before drivers start doing funny
things with it as well.
Another way to fix this would be to change the prototypes of the driver
interface to use bool directly, but this would require a huge
cross-systems patch so this simpler solution is preferred.
Changes since v1:
- Change local variable type to bool as well, use boolean values in
code
- Also change prototype of open drain/open source setting functions
since they are only called from _gpiod_set_raw_value()
This probably calls for a larger booleanization of gpiolib, but let's
keep that for a latter change - right now we need to address the issue
of non-boolean values returned by drivers.
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'arch/hexagon')
0 files changed, 0 insertions, 0 deletions