From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>,
Linus Walleij <linus.walleij@linaro.org>,
linux-gpio@vger.kernel.org, linux-acpi@vger.kernel.org,
linux-kernel@vger.kernel.org,
Mika Westerberg <mika.westerberg@linux.intel.com>,
Bartosz Golaszewski <brgl@bgdev.pl>,
Hans de Goede <hdegoede@redhat.com>,
Ferry Toth <ftoth@exalondelft.nl>
Subject: Re: [PATCH v1 2/3] gpiolib: Fix debug messaging in gpiod_find_and_request()
Date: Wed, 20 Mar 2024 17:05:46 +0200 [thread overview]
Message-ID: <Zfr7Sut9G0x14lDN@smile.fi.intel.com> (raw)
In-Reply-To: <ZVTcQnH_BEEFJ2Ut@google.com>
On Wed, Nov 15, 2023 at 02:57:06PM +0000, Dmitry Torokhov wrote:
> On Wed, Nov 15, 2023 at 03:37:58AM +0200, andy.shevchenko@gmail.com wrote:
> > Tue, Nov 14, 2023 at 09:18:24PM +0000, Dmitry Torokhov kirjoitti:
> > > 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:
Sorry for the late reply. Took me a bit to go through other things first.
...
> > > > > > 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?
> >
> > Definitely no, because how can you guess that this is "gpios" and not "gpio"?
> >
> > > 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".
> >
> > This is not true, there was no such information before your patch and NULL
> > pointer printing is simply a bad style programming. We already had the cases
> > when users were scary by "NULL device *" and other similar stuff when it's
> > practically no problems in the flow. This has to be fixed anyway.
> >
> > And what's the practical meaning of gpios-gpios / gpio-gpios / gpios-gpio /
> > gpio-gpio? I believe they are so weird that thinking about them would be lowest
> > priority over the issues with the messaging there.
>
> Well, I think we should try to communicate better what it is that we are
> printing. Consider your example:
>
> "gpio-40 (?): no flags found for gpios"
>
> what gpios mean here? You need to go into the code to figure out that it
> is connection id (whatever it is for a person who is not ultimately
> familiar with gpio subsystem) and not "gpios" in a generic sense. Plus
> with your patch you need to ascend a couple of layers up to figure out
> that it is connection id and not something else. With "(null)" we at
> least did not obfuscate things just so they are visually pleasing to a
> random user.
>
> How about we change a message a bit:
>
> gpiod_dbg(desc, "no flags found for %s gpios\n",
> con_id ?: "default");
>
> We can argue if "default" should be "unnamed" or "unspecified" or
> something else.
We can use something with a space that would definitely may not be a connection
ID (in the DT/ACPI/swnode[?]).
Let me figure out, but yes, can be a workaround as a quickfix.
> And finally what would help most is having a consumer device for which
> we are carrying out the operation. You can figure it out from the
> sequence of debug messages, but having it right here would be better.
Maybe, but it's out of scope of this fix.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2024-03-20 15:05 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-19 17:34 [PATCH v1 0/3] gpiolib: acpi: More fixes to the consolidation rework Andy Shevchenko
2023-10-19 17:34 ` [PATCH v1 1/3] gpiolib: acpi: Add missing memset(0) to acpi_get_gpiod_from_data() Andy Shevchenko
2023-10-19 19:20 ` Dmitry Torokhov
2023-10-20 9:25 ` Bartosz Golaszewski
2023-10-19 17:34 ` [PATCH v1 2/3] gpiolib: Fix debug messaging in gpiod_find_and_request() Andy Shevchenko
2023-10-19 19:21 ` Dmitry Torokhov
2023-11-14 15:29 ` Andy Shevchenko
2023-11-14 21:18 ` Dmitry Torokhov
2023-11-15 1:37 ` andy.shevchenko
2023-11-15 14:57 ` Dmitry Torokhov
2024-03-20 15:05 ` Andy Shevchenko [this message]
2023-11-14 20:26 ` Linus Walleij
2023-10-19 17:34 ` [PATCH v1 3/3] gpiolib: Make debug messages in gpiod_find_by_fwnode() less confusing Andy Shevchenko
2023-11-14 20:29 ` Linus Walleij
2023-10-20 11:50 ` [PATCH v1 0/3] gpiolib: acpi: More fixes to the consolidation rework Ferry Toth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zfr7Sut9G0x14lDN@smile.fi.intel.com \
--to=andy.shevchenko@gmail.com \
--cc=bartosz.golaszewski@linaro.org \
--cc=brgl@bgdev.pl \
--cc=dmitry.torokhov@gmail.com \
--cc=ftoth@exalondelft.nl \
--cc=hdegoede@redhat.com \
--cc=linus.walleij@linaro.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome