Re: [PATCH] [v2] leds: gpio: make legacy gpiolib interface optional

Linus Walleij
2026-05-06T08:04:07Z

On Tue, May 5, 2026 at 4:21 PM Arnd Bergmann <arnd@arndb.de> wrote:

> >> > 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.

Oh there is
gpiod_set_consumer_name(gpiod, "name");
that you can call unconditionally to set the consumer name.
It's NULL-tolerant.

Yours,
Linus Walleij