diff options
author | Alexandre Courbot <acourbot@nvidia.com> | 2014-03-11 06:52:09 (GMT) |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2014-03-14 09:17:03 (GMT) |
commit | 23600969ff137cf4c3bc9098f77e381de334e3f7 (patch) | |
tree | ad8bcad3af9b5635323b90cf0de346a1ee5db7c3 /drivers/gpio/gpio-intel-mid.c | |
parent | 6072b9dcf97870c9e840ad91862da7ff8ed680ee (diff) | |
download | linux-23600969ff137cf4c3bc9098f77e381de334e3f7.tar.xz |
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 'drivers/gpio/gpio-intel-mid.c')
0 files changed, 0 insertions, 0 deletions