mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH V2] gpiolib: use dev_err() when gpiod_configure_flags failed
@ 2024-03-20  7:33 Peng Fan (OSS)
  2024-03-20 10:33 ` Andy Shevchenko
  0 siblings, 1 reply; 6+ messages in thread
From: Peng Fan (OSS) @ 2024-03-20  7:33 UTC (permalink / raw)
  To: linus.walleij, brgl, andy; +Cc: linux-gpio, linux-kernel, Peng Fan

From: Peng Fan <peng.fan@nxp.com>

When gpio-ranges property was missed to be added in the gpio node,
using dev_err() to show an error message will helping to locate issues
easier.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---

V2:
 Update commit log

 drivers/gpio/gpiolib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index ce94e37bcbee..37fe9db0bd74 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -4233,7 +4233,7 @@ struct gpio_desc *gpiod_find_and_request(struct device *consumer,
 
 	ret = gpiod_configure_flags(desc, con_id, lookupflags, flags);
 	if (ret < 0) {
-		dev_dbg(consumer, "setup of GPIO %s failed\n", con_id);
+		dev_err(consumer, "setup of GPIO %s failed: %d\n", con_id, ret);
 		gpiod_put(desc);
 		return ERR_PTR(ret);
 	}
-- 
2.37.1


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

* Re: [PATCH V2] gpiolib: use dev_err() when gpiod_configure_flags failed
  2024-03-20  7:33 [PATCH V2] gpiolib: use dev_err() when gpiod_configure_flags failed Peng Fan (OSS)
@ 2024-03-20 10:33 ` Andy Shevchenko
  2024-03-20 11:07   ` Peng Fan
  0 siblings, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2024-03-20 10:33 UTC (permalink / raw)
  To: Peng Fan (OSS)
  Cc: linus.walleij, brgl, andy, linux-gpio, linux-kernel, Peng Fan

On Wed, Mar 20, 2024 at 9:25 AM Peng Fan (OSS) <peng.fan@oss.nxp.com> wrote:
>
> From: Peng Fan <peng.fan@nxp.com>
>
> When gpio-ranges property was missed to be added in the gpio node,
> using dev_err() to show an error message will helping to locate issues
> easier.

I'm not convinced, so not my call to approve / reject, but see a remark below.

...

>         ret = gpiod_configure_flags(desc, con_id, lookupflags, flags);
>         if (ret < 0) {
> -               dev_dbg(consumer, "setup of GPIO %s failed\n", con_id);
> +               dev_err(consumer, "setup of GPIO %s failed: %d\n", con_id, ret);
>                 gpiod_put(desc);
>                 return ERR_PTR(ret);

While at it, can you move it to be after the gpiod_put()?

>         }

-- 
With Best Regards,
Andy Shevchenko

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

* RE: [PATCH V2] gpiolib: use dev_err() when gpiod_configure_flags failed
  2024-03-20 10:33 ` Andy Shevchenko
@ 2024-03-20 11:07   ` Peng Fan
  2024-03-20 11:21     ` Andy Shevchenko
  0 siblings, 1 reply; 6+ messages in thread
From: Peng Fan @ 2024-03-20 11:07 UTC (permalink / raw)
  To: Andy Shevchenko, Peng Fan (OSS)
  Cc: linus.walleij, brgl, andy, linux-gpio, linux-kernel

> Subject: Re: [PATCH V2] gpiolib: use dev_err() when gpiod_configure_flags
> failed
> 
> On Wed, Mar 20, 2024 at 9:25 AM Peng Fan (OSS) <peng.fan@oss.nxp.com>
> wrote:
> >
> > From: Peng Fan <peng.fan@nxp.com>
> >
> > When gpio-ranges property was missed to be added in the gpio node,
> > using dev_err() to show an error message will helping to locate issues
> > easier.
> 
> I'm not convinced, so not my call to approve / reject, but see a remark below.

You mean dev_err not help or else?

> 
> ...
> 
> >         ret = gpiod_configure_flags(desc, con_id, lookupflags, flags);
> >         if (ret < 0) {
> > -               dev_dbg(consumer, "setup of GPIO %s failed\n", con_id);
> > +               dev_err(consumer, "setup of GPIO %s failed: %d\n",
> > + con_id, ret);
> >                 gpiod_put(desc);
> >                 return ERR_PTR(ret);
> 
> While at it, can you move it to be after the gpiod_put()?

Does it matter?

Thanks,
Peng.

> 
> >         }
> 
> --
> With Best Regards,
> Andy Shevchenko

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

* Re: [PATCH V2] gpiolib: use dev_err() when gpiod_configure_flags failed
  2024-03-20 11:07   ` Peng Fan
@ 2024-03-20 11:21     ` Andy Shevchenko
  2024-03-21  5:40       ` Peng Fan
  0 siblings, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2024-03-20 11:21 UTC (permalink / raw)
  To: Peng Fan; +Cc: Peng Fan (OSS), linus.walleij, brgl, linux-gpio, linux-kernel

On Wed, Mar 20, 2024 at 11:07:40AM +0000, Peng Fan wrote:
> > On Wed, Mar 20, 2024 at 9:25 AM Peng Fan (OSS) <peng.fan@oss.nxp.com>
> > wrote:

...

> > > When gpio-ranges property was missed to be added in the gpio node,
> > > using dev_err() to show an error message will helping to locate issues
> > > easier.
> > 
> > I'm not convinced, so not my call to approve / reject, but see a remark below.
> 
> You mean dev_err not help or else?

Moving it to error level.
Usually developers enable CONFIG_DEBUG_GPIO for these messages to appear.

...

> > >         ret = gpiod_configure_flags(desc, con_id, lookupflags, flags);
> > >         if (ret < 0) {
> > > -               dev_dbg(consumer, "setup of GPIO %s failed\n", con_id);
> > > +               dev_err(consumer, "setup of GPIO %s failed: %d\n",
> > > + con_id, ret);
> > >                 gpiod_put(desc);
> > >                 return ERR_PTR(ret);
> > 
> > While at it, can you move it to be after the gpiod_put()?
> 
> Does it matter?

Yes, the system gives resource back as soon as possible.

-- 
With Best Regards,
Andy Shevchenko



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

* RE: [PATCH V2] gpiolib: use dev_err() when gpiod_configure_flags failed
  2024-03-20 11:21     ` Andy Shevchenko
@ 2024-03-21  5:40       ` Peng Fan
  2024-03-21 15:37         ` Bartosz Golaszewski
  0 siblings, 1 reply; 6+ messages in thread
From: Peng Fan @ 2024-03-21  5:40 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Peng Fan (OSS), linus.walleij, brgl, linux-gpio, linux-kernel

> Subject: Re: [PATCH V2] gpiolib: use dev_err() when gpiod_configure_flags
> failed
> 
> On Wed, Mar 20, 2024 at 11:07:40AM +0000, Peng Fan wrote:
> > > On Wed, Mar 20, 2024 at 9:25 AM Peng Fan (OSS)
> > > <peng.fan@oss.nxp.com>
> > > wrote:
> 
> ...
> 
> > > > When gpio-ranges property was missed to be added in the gpio node,
> > > > using dev_err() to show an error message will helping to locate
> > > > issues easier.
> > >
> > > I'm not convinced, so not my call to approve / reject, but see a remark
> below.
> >
> > You mean dev_err not help or else?
> 
> Moving it to error level.
> Usually developers enable CONFIG_DEBUG_GPIO for these messages to
> appear.

But this is a error log. Let's leave this to gpio maintainers.

> 
> ...
> 
> > > >         ret = gpiod_configure_flags(desc, con_id, lookupflags, flags);
> > > >         if (ret < 0) {
> > > > -               dev_dbg(consumer, "setup of GPIO %s failed\n", con_id);
> > > > +               dev_err(consumer, "setup of GPIO %s failed: %d\n",
> > > > + con_id, ret);
> > > >                 gpiod_put(desc);
> > > >                 return ERR_PTR(ret);
> > >
> > > While at it, can you move it to be after the gpiod_put()?
> >
> > Does it matter?
> 
> Yes, the system gives resource back as soon as possible.

Got it.

Thanks,
Peng.

> 
> --
> With Best Regards,
> Andy Shevchenko
> 


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

* Re: [PATCH V2] gpiolib: use dev_err() when gpiod_configure_flags failed
  2024-03-21  5:40       ` Peng Fan
@ 2024-03-21 15:37         ` Bartosz Golaszewski
  0 siblings, 0 replies; 6+ messages in thread
From: Bartosz Golaszewski @ 2024-03-21 15:37 UTC (permalink / raw)
  To: Peng Fan
  Cc: Andy Shevchenko, Peng Fan (OSS), linus.walleij, linux-gpio, linux-kernel

On Thu, Mar 21, 2024 at 6:40 AM Peng Fan <peng.fan@nxp.com> wrote:
> > > >
> > > > I'm not convinced, so not my call to approve / reject, but see a remark
> > below.
> > >
> > > You mean dev_err not help or else?
> >
> > Moving it to error level.
> > Usually developers enable CONFIG_DEBUG_GPIO for these messages to
> > appear.
>
> But this is a error log. Let's leave this to gpio maintainers.
>

I'm fine with this change.

> >
> > ...
> >
> > > > >         ret = gpiod_configure_flags(desc, con_id, lookupflags, flags);
> > > > >         if (ret < 0) {
> > > > > -               dev_dbg(consumer, "setup of GPIO %s failed\n", con_id);
> > > > > +               dev_err(consumer, "setup of GPIO %s failed: %d\n",
> > > > > + con_id, ret);
> > > > >                 gpiod_put(desc);
> > > > >                 return ERR_PTR(ret);
> > > >
> > > > While at it, can you move it to be after the gpiod_put()?
> > >
> > > Does it matter?
> >
> > Yes, the system gives resource back as soon as possible.
>
> Got it.
>

Please change this and resend it.

Bart

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

end of thread, other threads:[~2024-03-21 15:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-20  7:33 [PATCH V2] gpiolib: use dev_err() when gpiod_configure_flags failed Peng Fan (OSS)
2024-03-20 10:33 ` Andy Shevchenko
2024-03-20 11:07   ` Peng Fan
2024-03-20 11:21     ` Andy Shevchenko
2024-03-21  5:40       ` Peng Fan
2024-03-21 15: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

all inboxes | Powered by JetHome®