From: Rasmus Villemoes <ravi@prevas.dk>
To: Tom Rini <trini@konsulko.com>
Cc: u-boot@lists.denx.de
Subject: Re: [PATCH] gpio: search gpio-line-names property in dm_gpio_lookup_name
Date: Thu, 16 Oct 2025 11:17:14 +0200 [thread overview]
Message-ID: <87ikgfnr39.fsf@prevas.dk> (raw)
In-Reply-To: <20251015210812.GA748494@bill-the-cat> (Tom Rini's message of "Wed, 15 Oct 2025 15:08:12 -0600")
On Wed, Oct 15 2025, Tom Rini <trini@konsulko.com> wrote:
> On Tue, Oct 07, 2025 at 12:26:37PM +0200, Rasmus Villemoes wrote:
>
>> In scripts as well as interactively, it's much nicer to be able to
>> refer to GPIOs via their names defined in the device tree property
>> "gpio-line-names", instead of the rather opaque names derived from the
>> bank name with a _xx suffix. E.g.
>>
>> gpio read factory_reset FACTORY_RESET
>> if test $factory_reset = 1 ; then ...
>>
>> versus
>>
>> gpio read factory_reset gpio@481ac000_16
>> if test $factory_reset = 1 ; then ...
>>
>> This is also consistent with the move on the linux/userspace side towards
>> using line names instead of legacy chip+offset or the even more legacy
>> global gpio numbering in sysfs.
>>
>> As this seems to only add about ~50 bytes of code to U-Boot proper,
>> and dm_gpio_lookup_name() most often ends up being GC'ed for SPL, so
>> adds no overhead there, adding yet another config knob (or two, if it
>> also needed an SPL variant) for this does not seem warranted.
>>
>> Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
>
> On a few platforms we now get a failure to build:
> arm: + work_92105
> +(work_92105) arm-linux-gnueabi-ld: drivers/gpio/gpio-uclass.o: in function `dev_read_stringlist_search':
> +(work_92105) include/dm/read.h:1078:(.text.dm_gpio_lookup_name+0x8c): undefined reference to `ofnode_stringlist_search'
> +(work_92105) make[1]: *** [Makefile:2029: u-boot] Error 1
> +(work_92105) make: *** [Makefile:198: sub-make] Error 2
Hm, interesting. The same call is already being done in the same .c
file, and AFAICT not under any different #ifdef conditions.
But I suppose it's possible that gpio_request_by_line_name() always end
up being GC'ed on those platforms, but dm_gpio_lookup_name() (probably
via gpio_lookup_name) does not.
ofnode_stringlist_search is available whenever CONFIG_OF_CONTROL, which
probably explains why you say "a few". And I guess it kind of makes
sense to at least make this conditional on there _being_ a dt node
associated to the udevice. I'll send a v2 with the block wrapped in if
(CONFIG_IS_ENABLED(OF_CONTROL)).
Rasmus
prev parent reply other threads:[~2025-10-16 9:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-07 10:26 [PATCH] gpio: search gpio-line-names property in dm_gpio_lookup_name Rasmus Villemoes
2025-10-15 21:08 ` Tom Rini
2025-10-16 9:17 ` Rasmus Villemoes [this message]
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=87ikgfnr39.fsf@prevas.dk \
--to=ravi@prevas.dk \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/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