summaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpiolib.c
diff options
context:
space:
mode:
authorWolfram Sang2018-07-11 18:33:19 +0200
committerLinus Walleij2018-09-14 10:45:13 +0200
commitd0121b8548bcb9a640de38c13e239493c87c44f4 (patch)
treea80858c70e5850766297912b25776330fb392c8e /drivers/gpio/gpiolib.c
parentgpiolib: Don't support irq sharing for userspace (diff)
downloadkernel-qcow2-linux-d0121b8548bcb9a640de38c13e239493c87c44f4.tar.gz
kernel-qcow2-linux-d0121b8548bcb9a640de38c13e239493c87c44f4.tar.xz
kernel-qcow2-linux-d0121b8548bcb9a640de38c13e239493c87c44f4.zip
gpiolib: use better errno if get_direction is not available
EINVAL is very generic, use ENOTSUPP in case the gpiochip does not provide this function. While removing the assignment from the 'status' variable, use better indentation in the declaration block. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Simon Horman <horms+renesas@verge.net.au> 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, 4 insertions, 4 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 8fbaea52bc1b..74f3af2d8ca0 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -210,15 +210,15 @@ static int gpiochip_find_base(int ngpio)
*/
int gpiod_get_direction(struct gpio_desc *desc)
{
- struct gpio_chip *chip;
- unsigned offset;
- int status = -EINVAL;
+ struct gpio_chip *chip;
+ unsigned offset;
+ int status;
chip = gpiod_to_chip(desc);
offset = gpio_chip_hwgpio(desc);
if (!chip->get_direction)
- return status;
+ return -ENOTSUPP;
status = chip->get_direction(chip, offset);
if (status > 0) {