summaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpiolib.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2015-12-21 23:10:12 +0100
committerLinus Walleij <linus.walleij@linaro.org>2015-12-26 22:28:42 +0100
commit723a63034eaf10ad36eff28496667f8e2a9f5da3 (patch)
tree0c25abb62ef32b11f257af6181e8ce33ff29f0aa /drivers/gpio/gpiolib.c
parentpinctrl: sunxi: Be sure to clamp return value (diff)
downloadlinux-723a63034eaf10ad36eff28496667f8e2a9f5da3.tar.xz
linux-723a63034eaf10ad36eff28496667f8e2a9f5da3.zip
Revert "gpio: revert get() to non-errorprogating behaviour"
This reverts commit 45ad7db90b42555c8107f18ec6d6a1e9bce34860. We have fixed all the drivers that were returning ambious values not clamped to [0,1] or an error code, so return the error propagating behaviour of the API. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpiolib.c')
-rw-r--r--drivers/gpio/gpiolib.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index d72ac1fdcd98..975a548bd71e 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1303,13 +1303,7 @@ static int _gpiod_get_raw_value(const struct gpio_desc *desc)
chip = desc->chip;
offset = gpio_chip_hwgpio(desc);
value = chip->get ? chip->get(chip, offset) : -EIO;
- /*
- * FIXME: fix all drivers to clamp to [0,1] or return negative,
- * then change this to:
- * value = value < 0 ? value : !!value;
- * so we can properly propagate error codes.
- */
- value = !!value;
+ value = value < 0 ? value : !!value;
trace_gpio_value(desc_to_gpio(desc), 1, value);
return value;
}