Re: [PATCH] gpiolib: Document that GPIO line names are not globally unique
From: Linus Walleij
Date: Sat May 16 2020 - 05:41:48 EST
On Tue, May 12, 2020 at 12:43 PM Bartosz Golaszewski
<bgolaszewski@xxxxxxxxxxxx> wrote:
> pon., 11 maj 2020 o 12:18 Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
> napisaÅ(a):
> >
> > gpiochip_set_desc_names() no longer rejects GPIO line name collisions.
> > Hence GPIO line names are not guaranteed to be globally unique.
> > In case of multiple GPIO lines with the same name, gpio_name_to_desc()
> > will return the first match found.
(...)
> This makes me wonder whether I should do something about this in
> libgpiod? Looks to me like gpiod_chip_find_line() and the global
> gpiod_line_find() are no longer reliable and should probably return
> all lines whose names match.
Hm. You probably know how consumers of libgpiod work better than me.
The background is historical and this happens because gpiolib had a
mechanism to name lines before I even took over maintenance, and
that did not require line names to be unique. So
when I created the character device I had to face the fact.
We also had to deal with the fact that when naming lines, the
"NULL alternative" (no name on the line at all) is always a valid
fallback.
And all lines named NULL are still valid and all have the same name
so...
Yours,
Linus Walleij