summaryrefslogtreecommitdiff
path: root/include/linux/gpio/consumer.h
diff options
context:
space:
mode:
authorAlexandre Courbot <acourbot@nvidia.com>2014-03-11 10:52:09 +0400
committerLinus Walleij <linus.walleij@linaro.org>2014-03-14 13:17:03 +0400
commit23600969ff137cf4c3bc9098f77e381de334e3f7 (patch)
treead8bcad3af9b5635323b90cf0de346a1ee5db7c3 /include/linux/gpio/consumer.h
parent6072b9dcf97870c9e840ad91862da7ff8ed680ee (diff)
downloadlinux-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 'include/linux/gpio/consumer.h')
0 files changed, 0 insertions, 0 deletions