Re: [PATCH] gpiolib: use of_node_name if line-name is missing

From: Andy Shevchenko

Date: Thu Sep 17 2026 - 09:12:32 EST


On Thu, Sep 17, 2026 at 02:28:13PM +0200, Frank Wunderlich wrote:

> Until v7.0, GPIO hogs inherited the DT node name when no line-name
> property was specified. This was implemented as a fallback in
> of_parse_own_gpio().
>
> Commit d1d564ec4992 ("gpio: move hogs into GPIO core") moved hog parsing
> into the GPIO core and removed this fallback.
>
> Consequently, GPIO hogs without a line-name property are now displayed
> with a ? in /sys/kernel/debug/gpio. Restore the old fallback.

...

> int gpiochip_add_hog(struct gpio_chip *gc, struct fwnode_handle *fwnode)

> fwnode_property_read_string(fwnode, "line-name", &name);
>
> + if (!name && is_of_node(fwnode))
> + name = to_of_node(fwnode)->name;

Can we move it inside the loop? Yes, I understand that it will be unnecessarily
called more times than required, but gpiod_hog() is called anyway in the loop,
so I don't think it will be a big deal. With that it will allow to group
OF-specific code in one location.

> for (unsigned int i = 0; i < num_hogs; i++) {
> if (is_of_node(fwnode)) {

...somewhere inside this conditional...

> /*

--
With Best Regards,
Andy Shevchenko