linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] gpio: regmap: Use -ENOTSUPP consistently
@ 2024-04-10  6:39 Andy Shevchenko
  2024-04-11 10:46 ` Michael Walle
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Andy Shevchenko @ 2024-04-10  6:39 UTC (permalink / raw)
  To: Andy Shevchenko, linux-gpio, linux-kernel
  Cc: Michael Walle, Linus Walleij, Bartosz Golaszewski

The GPIO library expects the drivers to return -ENOTSUPP in some cases
and not using analogue POSIX code. Make the driver to follow this.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/gpio/gpio-regmap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-regmap.c b/drivers/gpio/gpio-regmap.c
index c08c8e528867e..71684dee2ca5d 100644
--- a/drivers/gpio/gpio-regmap.c
+++ b/drivers/gpio/gpio-regmap.c
@@ -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, &reg, &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, &reg, &mask);
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 1/1] gpio: regmap: Use -ENOTSUPP consistently
  2024-04-10  6:39 [PATCH v1 1/1] gpio: regmap: Use -ENOTSUPP consistently Andy Shevchenko
@ 2024-04-11 10:46 ` Michael Walle
  2024-04-11 11:26   ` Andy Shevchenko
  2024-04-12 10:30 ` Linus Walleij
  2024-04-12 19:37 ` Bartosz Golaszewski
  2 siblings, 1 reply; 5+ messages in thread
From: Michael Walle @ 2024-04-11 10:46 UTC (permalink / raw)
  To: Andy Shevchenko, linux-gpio, linux-kernel
  Cc: Linus Walleij, Bartosz Golaszewski

[-- Attachment #1: Type: text/plain, Size: 1526 bytes --]

Hi Andy,

On Wed Apr 10, 2024 at 8:39 AM CEST, Andy Shevchenko wrote:
> The GPIO library expects the drivers to return -ENOTSUPP in 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 <mwalle@kernel.org>

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

> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> ---
>  drivers/gpio/gpio-regmap.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpio/gpio-regmap.c b/drivers/gpio/gpio-regmap.c
> index c08c8e528867e..71684dee2ca5d 100644
> --- a/drivers/gpio/gpio-regmap.c
> +++ b/drivers/gpio/gpio-regmap.c
> @@ -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, &reg, &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, &reg, &mask);


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 297 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 1/1] gpio: regmap: Use -ENOTSUPP consistently
  2024-04-11 10:46 ` Michael Walle
@ 2024-04-11 11:26   ` Andy Shevchenko
  0 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2024-04-11 11:26 UTC (permalink / raw)
  To: Michael Walle
  Cc: linux-gpio, linux-kernel, Linus Walleij, Bartosz Golaszewski

On Thu, Apr 11, 2024 at 1:46 PM Michael Walle <mwalle@kernel.org> wrote:
> On Wed Apr 10, 2024 at 8:39 AM CEST, Andy Shevchenko wrote:
> > The GPIO library expects the drivers to return -ENOTSUPP in 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 <mwalle@kernel.org>

Thank you!

> 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.

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 1/1] gpio: regmap: Use -ENOTSUPP consistently
  2024-04-10  6:39 [PATCH v1 1/1] gpio: regmap: Use -ENOTSUPP consistently Andy Shevchenko
  2024-04-11 10:46 ` Michael Walle
@ 2024-04-12 10:30 ` Linus Walleij
  2024-04-12 19:37 ` Bartosz Golaszewski
  2 siblings, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2024-04-12 10:30 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-gpio, linux-kernel, Michael Walle, Bartosz Golaszewski

On Wed, Apr 10, 2024 at 8:39 AM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:

> The GPIO library expects the drivers to return -ENOTSUPP in some cases
> and not using analogue POSIX code. Make the driver to follow this.
>
> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 1/1] gpio: regmap: Use -ENOTSUPP consistently
  2024-04-10  6:39 [PATCH v1 1/1] gpio: regmap: Use -ENOTSUPP consistently Andy Shevchenko
  2024-04-11 10:46 ` Michael Walle
  2024-04-12 10:30 ` Linus Walleij
@ 2024-04-12 19:37 ` Bartosz Golaszewski
  2 siblings, 0 replies; 5+ messages in thread
From: Bartosz Golaszewski @ 2024-04-12 19:37 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-gpio, linux-kernel, Michael Walle, Linus Walleij

On Wed, Apr 10, 2024 at 8:39 AM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
>
> The GPIO library expects the drivers to return -ENOTSUPP in some cases
> and not using analogue POSIX code. Make the driver to follow this.
>
> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> ---
>  drivers/gpio/gpio-regmap.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpio/gpio-regmap.c b/drivers/gpio/gpio-regmap.c
> index c08c8e528867e..71684dee2ca5d 100644
> --- a/drivers/gpio/gpio-regmap.c
> +++ b/drivers/gpio/gpio-regmap.c
> @@ -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, &reg, &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, &reg, &mask);
> --
> 2.44.0
>

Applied, thanks!

Bart

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-04-12 19:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-10  6:39 [PATCH v1 1/1] gpio: regmap: Use -ENOTSUPP consistently Andy Shevchenko
2024-04-11 10:46 ` Michael Walle
2024-04-11 11:26   ` Andy Shevchenko
2024-04-12 10:30 ` Linus Walleij
2024-04-12 19:37 ` Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).