2024-04-10 06:39:50

by Andy Shevchenko

[permalink] [raw]
Subject: [PATCH v1 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.

Signed-off-by: Andy Shevchenko <[email protected]>
---
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



2024-04-11 10:47:47

by Michael Walle

[permalink] [raw]
Subject: Re: [PATCH v1 1/1] gpio: regmap: Use -ENOTSUPP consistently

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 <[email protected]>

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 <[email protected]>
> ---
> 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);


Attachments:
signature.asc (305.00 B)

2024-04-11 11:28:10

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH v1 1/1] gpio: regmap: Use -ENOTSUPP consistently

On Thu, Apr 11, 2024 at 1:46 PM Michael Walle <[email protected]> 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 <[email protected]>

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

2024-04-12 10:35:19

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH v1 1/1] gpio: regmap: Use -ENOTSUPP consistently

On Wed, Apr 10, 2024 at 8:39 AM Andy Shevchenko
<[email protected]> 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 <[email protected]>

Reviewed-by: Linus Walleij <[email protected]>

Yours,
Linus Walleij

2024-04-12 19:38:11

by Bartosz Golaszewski

[permalink] [raw]
Subject: Re: [PATCH v1 1/1] gpio: regmap: Use -ENOTSUPP consistently

On Wed, Apr 10, 2024 at 8:39 AM Andy Shevchenko
<[email protected]> 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 <[email protected]>
> ---
> 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