From: Jacek Anaszewski <jacek.anaszewski@gmail.com>
To: Russell King - ARM Linux admin <linux@armlinux.org.uk>,
Linus Walleij <linus.walleij@linaro.org>,
Pavel Machek <pavel@ucw.cz>
Cc: linux-leds@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: "leds: gpio: Use generic support for composing LED names" breaks gpio debugfs
Date: Wed, 4 Dec 2019 21:52:49 +0100 [thread overview]
Message-ID: <fb88206c-a094-df37-04af-71a1174fb0f6@gmail.com> (raw)
In-Reply-To: <20191204110219.GV25745@shell.armlinux.org.uk>
Hi Russel,
On 12/4/19 12:02 PM, Russell King - ARM Linux admin wrote:
> Hi,
>
> Patch d7235f5feaa0 ("leds: gpio: Use generic support for composing LED
> names") changed the way labels are used.
>
> devm_fwnode_get_gpiod_from_child() is passed led.name, which used to be
> set to the label or node name, resulting in /sys/kernel/debug/gpio
> containing useful information. For example:
>
> gpio-487 ( |udpu:green:power ) out lo
> gpio-488 ( |udpu:red:power ) out hi
> gpio-489 ( |udpu:green:network ) out hi
> gpio-490 ( |udpu:red:network ) out hi
> gpio-491 ( |udpu:green:alarm ) out hi
> gpio-492 ( |udpu:red:alarm ) out hi
>
> After this commit, it now contains a rather less useful:
>
> gpio-487 ( |? ) out hi ACTIVE LOW
> gpio-488 ( |? ) out hi ACTIVE LOW
> gpio-489 ( |? ) out hi ACTIVE LOW
> gpio-490 ( |? ) out hi ACTIVE LOW
> gpio-491 ( |? ) out hi ACTIVE LOW
> gpio-492 ( |? ) out hi ACTIVE LOW
>
> This is because led.name is now NULL prior to the call to
> devm_fwnode_get_gpiod_from_child().
Ugh, my bad. But it actually has been wrong since the patch
a96aa64cb5723 ("leds/led-class: Handle LEDs with the same name"),
which enabled LED core to amend the LED name just beforehand
the registration of a LED class device.
It seem that the only proper solution would be introducing a new
pre_register_cdev(const char *name) op to the LED core, that would allow
drivers to come up with their implementation thereof. In this particular
case leds-gpio driver would need to put there gpiod initialization.
The pre_register_device op would need to be called (when available)
from the led_classdev_register_ext() after calling
led_classdev_next_name() and before device_create_with_groups().
The op would have to be passed the final_name variable then.
> While this is not an API, it is useful for debugging, and given the
> dynamic allocation of GPIOs to physical GPIOs, having the labels
> present is an advantage.
>
> Can this be fixed / old behaviour restored?
If there are no objections I can come up with a fix, but no
sooner than at the weekend.
--
Best regards,
Jacek Anaszewski
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-12-04 20:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-04 11:02 "leds: gpio: Use generic support for composing LED names" breaks gpio debugfs Russell King - ARM Linux admin
2019-12-04 20:52 ` Jacek Anaszewski [this message]
2019-12-04 23:45 ` Linus Walleij
2019-12-05 21:29 ` Jacek Anaszewski
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=fb88206c-a094-df37-04af-71a1174fb0f6@gmail.com \
--to=jacek.anaszewski@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=pavel@ucw.cz \
/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;
as well as URLs for NNTP newsgroup(s).