drivers/pinctrl/renesas/pinctrl-rzg2l.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
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
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
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
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)
© 2016 - 2024 Red Hat, Inc.