summaryrefslogtreecommitdiffstats
path: root/include/asm-generic
diff options
context:
space:
mode:
authorAlexandre Courbot <acourbot@nvidia.com>2014-03-11 15:52:09 +0900
committerLinus Walleij <linus.walleij@linaro.org>2014-03-14 10:17:03 +0100
commit23600969ff137cf4c3bc9098f77e381de334e3f7 (patch)
treead8bcad3af9b5635323b90cf0de346a1ee5db7c3 /include/asm-generic
parent6072b9dcf97870c9e840ad91862da7ff8ed680ee (diff)
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 'include/asm-generic')
0 files changed, 0 insertions, 0 deletions