Re: [PATCH v1 2/3] gpiolib: Fix debug messaging in gpiod_find_and_request()

From: Dmitry Torokhov
Date: Tue Nov 14 2023 - 16:18:35 EST


On Tue, Nov 14, 2023 at 05:29:59PM +0200, Andy Shevchenko wrote:
> On Thu, Oct 19, 2023 at 12:21:12PM -0700, Dmitry Torokhov wrote:
> > On Thu, Oct 19, 2023 at 08:34:56PM +0300, Andy Shevchenko wrote:
> > > When consolidating GPIO lookups in ACPI code, the debug messaging
> > > had been broken and hence lost a bit of sense. Restore debug
> > > messaging in gpiod_find_and_request() when configuring the GPIO
> > > line via gpiod_configure_flags().
> >
> > Could you give an example of the before/after messages to show exavtly
> > what is being improved?
>
> Before your patch:
>
> [ 5.266823] gpio-96 (ACPI:OpRegion): no flags found for ACPI:OpRegion
> [ 14.182994] gpio-40 (?): no flags found for gpios
>
> After your patch:
>
> [ 5.085048] gpio-96 (ACPI:OpRegion): no flags found for ACPI:OpRegion
> [ 13.401402] gpio-40 (?): no flags found for (null)
>
> After this patch:
>
> [ 3.871185] gpio-96 (ACPI:OpRegion): no flags found for ACPI:OpRegion
> [ 12.491998] gpio-40 (?): no flags found for gpios
>
> ...
>
> Looking at this it's definitely a fix.

If this ("(null)" vs static "gpios" string) is important, can we reduce
the patch to:

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 76e0c38026c3..b868c016a9be 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -4151,7 +4151,7 @@ int gpiod_configure_flags(struct gpio_desc *desc, const char *con_id,

/* No particular flag request, return here... */
if (!(dflags & GPIOD_FLAGS_BIT_DIR_SET)) {
- gpiod_dbg(desc, "no flags found for %s\n", con_id);
+ gpiod_dbg(desc, "no flags found for %s\n", con_id ?: "gpios");
return 0;
}


instead of plumbing the names through?

Although this (and the original fix patch) are losing information, in
the sense that "(null)" explicitly communicates that caller used
default/NULL conn_id, and not something like "gpios-gpios".

Thanks.

--
Dmitry