Commit d0121b85 authored by Wolfram Sang's avatar Wolfram Sang Committed by Linus Walleij

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: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: default avatarSimon Horman <horms+renesas@verge.net.au>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent fa38869b
...@@ -210,15 +210,15 @@ static int gpiochip_find_base(int ngpio) ...@@ -210,15 +210,15 @@ static int gpiochip_find_base(int ngpio)
*/ */
int gpiod_get_direction(struct gpio_desc *desc) int gpiod_get_direction(struct gpio_desc *desc)
{ {
struct gpio_chip *chip; struct gpio_chip *chip;
unsigned offset; unsigned offset;
int status = -EINVAL; int status;
chip = gpiod_to_chip(desc); chip = gpiod_to_chip(desc);
offset = gpio_chip_hwgpio(desc); offset = gpio_chip_hwgpio(desc);
if (!chip->get_direction) if (!chip->get_direction)
return status; return -ENOTSUPP;
status = chip->get_direction(chip, offset); status = chip->get_direction(chip, offset);
if (status > 0) { if (status > 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment