aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpiolib.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2015-12-21 03:36:21 -0500
committerLinus Walleij <linus.walleij@linaro.org>2015-12-21 03:36:21 -0500
commit0529357f102b96f68bc199f858d1c3b07f4b674c (patch)
treeeaa047952a768099e00a5245afa0d84799df6990 /drivers/gpio/gpiolib.c
parenta9f1a3e4c1c7dc82711bc22dc52c7b0d6912ed56 (diff)
parent4ef7675344d687a0ef5b0d7c0cee12da005870c0 (diff)
Merge tag 'v4.4-rc6' into devel
Linux 4.4-rc6
Diffstat (limited to 'drivers/gpio/gpiolib.c')
-rw-r--r--drivers/gpio/gpiolib.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index e63bebc9ae60..d72ac1fdcd98 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -250,7 +250,7 @@ static struct gpio_desc *gpio_name_to_desc(const char * const name)
250 for (i = 0; i != chip->ngpio; ++i) { 250 for (i = 0; i != chip->ngpio; ++i) {
251 struct gpio_desc *gpio = &chip->desc[i]; 251 struct gpio_desc *gpio = &chip->desc[i];
252 252
253 if (!gpio->name) 253 if (!gpio->name || !name)
254 continue; 254 continue;
255 255
256 if (!strcmp(gpio->name, name)) { 256 if (!strcmp(gpio->name, name)) {
@@ -1303,7 +1303,13 @@ static int _gpiod_get_raw_value(const struct gpio_desc *desc)
1303 chip = desc->chip; 1303 chip = desc->chip;
1304 offset = gpio_chip_hwgpio(desc); 1304 offset = gpio_chip_hwgpio(desc);
1305 value = chip->get ? chip->get(chip, offset) : -EIO; 1305 value = chip->get ? chip->get(chip, offset) : -EIO;
1306 value = value < 0 ? value : !!value; 1306 /*
1307 * FIXME: fix all drivers to clamp to [0,1] or return negative,
1308 * then change this to:
1309 * value = value < 0 ? value : !!value;
1310 * so we can properly propagate error codes.
1311 */
1312 value = !!value;
1307 trace_gpio_value(desc_to_gpio(desc), 1, value); 1313 trace_gpio_value(desc_to_gpio(desc), 1, value);
1308 return value; 1314 return value;
1309} 1315}