linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pinctrl: renesas: rzg2l: Return -EINVAL if the pin doesn't support PIN_CFG_OEN
@ 2024-07-23 16:47 Prabhakar
  2024-07-25 14:39 ` claudiu beznea
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Prabhakar @ 2024-07-23 16:47 UTC (permalink / raw)
  To: Geert Uytterhoeven, Linus Walleij
  Cc: linux-renesas-soc, linux-gpio, linux-kernel, Prabhakar, Biju Das,
	Fabrizio Castro, Lad Prabhakar

From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Update the rzg2l_pinctrl_pinconf_get() function to return -EINVAL for
PIN_CONFIG_OUTPUT_ENABLE config if the pin doesn't support the PIN_CFG_OEN
configuration.

-EINVAL is a valid error when dumping the pin configurations. Returning
-EOPNOTSUPP for a pin that does not support PIN_CFG_OEN resulted in the
message 'ERROR READING CONFIG SETTING 16' being printed during dumping
pinconf-pins.

For consistency do similar change in rzg2l_pinctrl_pinconf_set() for
PIN_CONFIG_OUTPUT_ENABLE config.

Fixes: a9024a323af2 ("pinctrl: renesas: rzg2l: Clean up and refactor OEN read/write functions")
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
 drivers/pinctrl/renesas/pinctrl-rzg2l.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
index 632180570b70..3ef20f2fa88e 100644
--- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
+++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
@@ -1261,7 +1261,9 @@ static int rzg2l_pinctrl_pinconf_get(struct pinctrl_dev *pctldev,
 		break;
 
 	case PIN_CONFIG_OUTPUT_ENABLE:
-		if (!pctrl->data->oen_read || !(cfg & PIN_CFG_OEN))
+		if (!(cfg & PIN_CFG_OEN))
+			return -EINVAL;
+		if (!pctrl->data->oen_read)
 			return -EOPNOTSUPP;
 		arg = pctrl->data->oen_read(pctrl, _pin);
 		if (!arg)
@@ -1402,7 +1404,9 @@ static int rzg2l_pinctrl_pinconf_set(struct pinctrl_dev *pctldev,
 
 		case PIN_CONFIG_OUTPUT_ENABLE:
 			arg = pinconf_to_config_argument(_configs[i]);
-			if (!pctrl->data->oen_write || !(cfg & PIN_CFG_OEN))
+			if (!(cfg & PIN_CFG_OEN))
+				return -EINVAL;
+			if (!pctrl->data->oen_write)
 				return -EOPNOTSUPP;
 			ret = pctrl->data->oen_write(pctrl, _pin, !!arg);
 			if (ret)
-- 
2.34.1


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

* Re: [PATCH] pinctrl: renesas: rzg2l: Return -EINVAL if the pin doesn't support PIN_CFG_OEN
  2024-07-23 16:47 [PATCH] pinctrl: renesas: rzg2l: Return -EINVAL if the pin doesn't support PIN_CFG_OEN Prabhakar
@ 2024-07-25 14:39 ` claudiu beznea
  2024-07-29  7:58 ` Paul Barker
  2024-08-01 15:19 ` Geert Uytterhoeven
  2 siblings, 0 replies; 4+ messages in thread
From: claudiu beznea @ 2024-07-25 14:39 UTC (permalink / raw)
  To: Prabhakar, Geert Uytterhoeven, Linus Walleij
  Cc: linux-renesas-soc, linux-gpio, linux-kernel, Biju Das,
	Fabrizio Castro, Lad Prabhakar



On 23.07.2024 19:47, Prabhakar wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> 
> Update the rzg2l_pinctrl_pinconf_get() function to return -EINVAL for
> PIN_CONFIG_OUTPUT_ENABLE config if the pin doesn't support the PIN_CFG_OEN
> configuration.
> 
> -EINVAL is a valid error when dumping the pin configurations. Returning
> -EOPNOTSUPP for a pin that does not support PIN_CFG_OEN resulted in the
> message 'ERROR READING CONFIG SETTING 16' being printed during dumping
> pinconf-pins.
> 
> For consistency do similar change in rzg2l_pinctrl_pinconf_set() for
> PIN_CONFIG_OUTPUT_ENABLE config.
> 
> Fixes: a9024a323af2 ("pinctrl: renesas: rzg2l: Clean up and refactor OEN read/write functions")
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Tested-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

> ---
>  drivers/pinctrl/renesas/pinctrl-rzg2l.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> index 632180570b70..3ef20f2fa88e 100644
> --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> @@ -1261,7 +1261,9 @@ static int rzg2l_pinctrl_pinconf_get(struct pinctrl_dev *pctldev,
>  		break;
>  
>  	case PIN_CONFIG_OUTPUT_ENABLE:
> -		if (!pctrl->data->oen_read || !(cfg & PIN_CFG_OEN))
> +		if (!(cfg & PIN_CFG_OEN))
> +			return -EINVAL;
> +		if (!pctrl->data->oen_read)
>  			return -EOPNOTSUPP;
>  		arg = pctrl->data->oen_read(pctrl, _pin);
>  		if (!arg)
> @@ -1402,7 +1404,9 @@ static int rzg2l_pinctrl_pinconf_set(struct pinctrl_dev *pctldev,
>  
>  		case PIN_CONFIG_OUTPUT_ENABLE:
>  			arg = pinconf_to_config_argument(_configs[i]);
> -			if (!pctrl->data->oen_write || !(cfg & PIN_CFG_OEN))
> +			if (!(cfg & PIN_CFG_OEN))
> +				return -EINVAL;
> +			if (!pctrl->data->oen_write)
>  				return -EOPNOTSUPP;
>  			ret = pctrl->data->oen_write(pctrl, _pin, !!arg);
>  			if (ret)

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

* Re: [PATCH] pinctrl: renesas: rzg2l: Return -EINVAL if the pin doesn't support PIN_CFG_OEN
  2024-07-23 16:47 [PATCH] pinctrl: renesas: rzg2l: Return -EINVAL if the pin doesn't support PIN_CFG_OEN Prabhakar
  2024-07-25 14:39 ` claudiu beznea
@ 2024-07-29  7:58 ` Paul Barker
  2024-08-01 15:19 ` Geert Uytterhoeven
  2 siblings, 0 replies; 4+ messages in thread
From: Paul Barker @ 2024-07-29  7:58 UTC (permalink / raw)
  To: Prabhakar, Geert Uytterhoeven, Linus Walleij
  Cc: linux-renesas-soc, linux-gpio, linux-kernel, Biju Das,
	Fabrizio Castro, Lad Prabhakar


[-- Attachment #1.1.1: Type: text/plain, Size: 2072 bytes --]

On 23/07/2024 17:47, Prabhakar wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> 
> Update the rzg2l_pinctrl_pinconf_get() function to return -EINVAL for
> PIN_CONFIG_OUTPUT_ENABLE config if the pin doesn't support the PIN_CFG_OEN
> configuration.
> 
> -EINVAL is a valid error when dumping the pin configurations. Returning
> -EOPNOTSUPP for a pin that does not support PIN_CFG_OEN resulted in the
> message 'ERROR READING CONFIG SETTING 16' being printed during dumping
> pinconf-pins.
> 
> For consistency do similar change in rzg2l_pinctrl_pinconf_set() for
> PIN_CONFIG_OUTPUT_ENABLE config.
> 
> Fixes: a9024a323af2 ("pinctrl: renesas: rzg2l: Clean up and refactor OEN read/write functions")
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> ---
>  drivers/pinctrl/renesas/pinctrl-rzg2l.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> index 632180570b70..3ef20f2fa88e 100644
> --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> @@ -1261,7 +1261,9 @@ static int rzg2l_pinctrl_pinconf_get(struct pinctrl_dev *pctldev,
>  		break;
>  
>  	case PIN_CONFIG_OUTPUT_ENABLE:
> -		if (!pctrl->data->oen_read || !(cfg & PIN_CFG_OEN))
> +		if (!(cfg & PIN_CFG_OEN))
> +			return -EINVAL;
> +		if (!pctrl->data->oen_read)
>  			return -EOPNOTSUPP;
>  		arg = pctrl->data->oen_read(pctrl, _pin);
>  		if (!arg)
> @@ -1402,7 +1404,9 @@ static int rzg2l_pinctrl_pinconf_set(struct pinctrl_dev *pctldev,
>  
>  		case PIN_CONFIG_OUTPUT_ENABLE:
>  			arg = pinconf_to_config_argument(_configs[i]);
> -			if (!pctrl->data->oen_write || !(cfg & PIN_CFG_OEN))
> +			if (!(cfg & PIN_CFG_OEN))
> +				return -EINVAL;
> +			if (!pctrl->data->oen_write)
>  				return -EOPNOTSUPP;
>  			ret = pctrl->data->oen_write(pctrl, _pin, !!arg);
>  			if (ret)

Reviewed-by: Paul Barker <paul.barker.ct@bp.renesas.com>

-- 
Paul Barker

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3577 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

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

* Re: [PATCH] pinctrl: renesas: rzg2l: Return -EINVAL if the pin doesn't support PIN_CFG_OEN
  2024-07-23 16:47 [PATCH] pinctrl: renesas: rzg2l: Return -EINVAL if the pin doesn't support PIN_CFG_OEN Prabhakar
  2024-07-25 14:39 ` claudiu beznea
  2024-07-29  7:58 ` Paul Barker
@ 2024-08-01 15:19 ` Geert Uytterhoeven
  2 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2024-08-01 15:19 UTC (permalink / raw)
  To: Prabhakar
  Cc: Linus Walleij, linux-renesas-soc, linux-gpio, linux-kernel,
	Biju Das, Fabrizio Castro, Lad Prabhakar

On Tue, Jul 23, 2024 at 6:50 PM Prabhakar <prabhakar.csengg@gmail.com> wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> Update the rzg2l_pinctrl_pinconf_get() function to return -EINVAL for
> PIN_CONFIG_OUTPUT_ENABLE config if the pin doesn't support the PIN_CFG_OEN
> configuration.
>
> -EINVAL is a valid error when dumping the pin configurations. Returning
> -EOPNOTSUPP for a pin that does not support PIN_CFG_OEN resulted in the
> message 'ERROR READING CONFIG SETTING 16' being printed during dumping
> pinconf-pins.
>
> For consistency do similar change in rzg2l_pinctrl_pinconf_set() for
> PIN_CONFIG_OUTPUT_ENABLE config.
>
> Fixes: a9024a323af2 ("pinctrl: renesas: rzg2l: Clean up and refactor OEN read/write functions")
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
i.e. will queue in renesas-pinctrl for v6.12.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

end of thread, other threads:[~2024-08-01 15:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-23 16:47 [PATCH] pinctrl: renesas: rzg2l: Return -EINVAL if the pin doesn't support PIN_CFG_OEN Prabhakar
2024-07-25 14:39 ` claudiu beznea
2024-07-29  7:58 ` Paul Barker
2024-08-01 15:19 ` Geert Uytterhoeven

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