gpio: regmap: Use -ENOTSUPP consistently
Subsystems (2)
PATCH 1/1 gpio: regmap: Use -ENOTSUPP consistently
The GPIO library expects the drivers to return -ENOTSUPP in some cases and not using analogue POSIX code. Make the driver to follow this.
--- drivers/gpio/gpio-regmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpio-regmap.c +2 -2
@@ -129,7 +129,7 @@ static int gpio_regmap_get_direction(struct gpio_chip *chip, base =gpio_regmap_addr (gpio->reg_dir_in_base); invert =1 ; }else { -return -EOPNOTSUPP ; +return -ENOTSUPP ; } ret = gpio->reg_mask_xlate (gpio, base, offset, ®, &mask);
@@ -160,7 +160,7 @@ static int gpio_regmap_set_direction(struct gpio_chip *chip, base =gpio_regmap_addr (gpio->reg_dir_in_base); invert =1 ; }else { -return -EOPNOTSUPP ; +return -ENOTSUPP ; } ret = gpio->reg_mask_xlate (gpio, base, offset, ®, &mask);
Signature · 1 line
2.44.0
Hi Andy,
Quoted 2 lines · Andy Shevchenko
The GPIO library expects the drivers to return
-ENOTSUPPin some cases and not using analogue POSIX code. Make the driver to follow this.
I don't care too much, so if you like you can add
But.. isn't it the wrong errno and isn't it discouraged to use it because it's a NFS only errno? Thus, wouldn't it make more sense for the core to accept EOPNOTSUPP and maybe convert it to ENOTSUPP if we don't want to break userspace?
-michael
Quoted 27 lines
Signed-off-by Andy Shevchenko <[email protected]>--- drivers/gpio/gpio-regmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpio/gpio-regmap.c +2
-2@@ -129,7 +129,7 @@ static int gpio_regmap_get_direction(struct gpio_chip *chip, base =gpio_regmap_addr (gpio->reg_dir_in_base); invert =1 ; }else { -return -EOPNOTSUPP ; +return -ENOTSUPP ; } ret = gpio->reg_mask_xlate (gpio, base, offset, ®, &mask);@@ -160,7 +160,7 @@ static int gpio_regmap_set_direction(struct gpio_chip *chip, base =gpio_regmap_addr (gpio->reg_dir_in_base); invert =1 ; }else { -return -EOPNOTSUPP ; +return -ENOTSUPP ; } ret = gpio->reg_mask_xlate (gpio, base, offset, ®, &mask);
Quoted 7 lines · Michael Walle
Quoted 2 lines · Andy Shevchenko
The GPIO library expects the drivers to return
-ENOTSUPPin some cases and not using analogue POSIX code. Make the driver to follow this.I don't care too much, so if you like you can add
Reviewed-by Michael Walle <[email protected]>
Thank you!
Quoted 4 lines
But.. isn't it the wrong errno and isn't it discouraged to use it because it's a NFS only errno? Thus, wouldn't it make more sense for the core to accept EOPNOTSUPP and maybe convert it to ENOTSUPP if we don't want to break userspace?
We don't break user space as it is used purely internally to the GPIO / pin control subsystems (which are in our area of interest, unlike plenty of other users).
The decision to have this error code had been made long time ago and now somebody probably is welcome to update, but for the sake of consistency let's continue what was done by design.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 4 lines · Andy Shevchenko
The GPIO library expects the drivers to return
-ENOTSUPPin some cases and not using analogue POSIX code. Make the driver to follow this.Signed-off-by Andy Shevchenko <[email protected]>
Yours,
Linus Walleij
Bartosz Golaszewski
AppliedQuoted 32 lines · Andy Shevchenko
The GPIO library expects the drivers to return
-ENOTSUPPin some cases and not using analogue POSIX code. Make the driver to follow this.Signed-off-by Andy Shevchenko <[email protected]>--- drivers/gpio/gpio-regmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpio/gpio-regmap.c +2
-3@@ -129,7 +129,7 @@ static int gpio_regmap_get_direction(struct gpio_chip *chip, base =gpio_regmap_addr (gpio->reg_dir_in_base); invert =1 ; }else { -return -EOPNOTSUPP ; +return -ENOTSUPP ; } ret = gpio->reg_mask_xlate (gpio, base, offset, ®, &mask);@@ -160,7 +160,7 @@ static int gpio_regmap_set_direction(struct gpio_chip *chip, base =gpio_regmap_addr (gpio->reg_dir_in_base); invert =1 ; }else { -return -EOPNOTSUPP ; +return -ENOTSUPP ; } ret = gpio->reg_mask_xlate (gpio, base, offset, ®, &mask); --
Quoted 2 lines
2.44.0
Applied, thanks!
Bart