From: "Arnd Bergmann" <arnd@arndb.de>
To: "Andy Shevchenko" <andriy.shevchenko@linux.intel.com>
Cc: "Arnd Bergmann" <arnd@kernel.org>, "Lee Jones" <lee@kernel.org>,
"Pavel Machek" <pavel@kernel.org>,
"Linus Walleij" <linusw@kernel.org>,
"Bartosz Golaszewski" <brgl@kernel.org>,
"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org,
"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>
Subject: Re: [PATCH] [v2] leds: gpio: make legacy gpiolib interface optional
Date: Tue, 05 May 2026 16:19:47 +0200 [thread overview]
Message-ID: <ffc24364-6732-47a1-8b56-e5d8b1488c57@app.fastmail.com> (raw)
In-Reply-To: <afnvtid9rSoZ2dkQ@ashevche-desk.local>
On Tue, May 5, 2026, at 15:25, Andy Shevchenko wrote:
> On Tue, May 05, 2026 at 04:19:36PM +0300, Andy Shevchenko wrote:
>> On Tue, May 05, 2026 at 03:10:28PM +0200, Arnd Bergmann wrote:
>> > On Mon, May 4, 2026, at 09:31, Andy Shevchenko wrote:
>> > struct gpio_desc *gpiod;
>> >
>> > gpiod = devm_gpiod_get_index_optional(dev, NULL, idx, GPIOD_OUT_LOW);
>>
>> > if (gpiod && !IS_ERR(gpiod));
>>
>> And this is not needed. The below is NULL-aware.
>
> To be clear
>
> struct gpio_desc *gpiod;
>
> gpiod = devm_gpiod_get_index_optional(dev, NULL, idx, GPIOD_OUT_LOW);
> if (!IS_ERR(gpiod))
> gpiod_set_consumer_name(gpiod, template->name);
>
> return gpiod;
>
> But looking at the original code, I would leave another return, so
Right, I actually had this at first, but decided to keep the NULL
check because that was used in the driver already.
I've dropped it again now.
>> > gpiod = devm_gpiod_get_index_optional(dev, template->name, i, GPIOD_OUT_LOW);
>> >
>> > Did I get that right? If so, I'll fold that in as another
>
> Nope, the con_id != consumer name. Can't be done this way.
I see. I had tried to find an existing interface that sets
the consumer name and saw that gpiod_get_index() internally
uses con_id as the label if set, but I missed that this would
break the actual lookup in gpio_desc_table_match() because the
13 lookup tables are of course all defined by index rather than
by name.
Arnd
next prev parent reply other threads:[~2026-05-05 14:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-30 9:11 [PATCH] [v2] leds: gpio: make legacy gpiolib interface optional Arnd Bergmann
2026-04-30 14:19 ` Bartosz Golaszewski
2026-05-04 7:31 ` Andy Shevchenko
2026-05-05 13:10 ` Arnd Bergmann
2026-05-05 13:19 ` Andy Shevchenko
2026-05-05 13:25 ` Andy Shevchenko
2026-05-05 14:19 ` Arnd Bergmann [this message]
2026-05-06 8:03 ` Linus Walleij
2026-05-05 12:31 ` Linus Walleij
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=ffc24364-6732-47a1-8b56-e5d8b1488c57@app.fastmail.com \
--to=arnd@arndb.de \
--cc=andriy.shevchenko@linux.intel.com \
--cc=arnd@kernel.org \
--cc=brgl@kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=lee@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=pavel@kernel.org \
/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