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

From: Frank Wunderlich

Date: Thu Sep 17 2026 - 08:38:06 EST


From: Frank Wunderlich <frank-w@xxxxxxxxxxxxxxx>

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.

Fixes: d1d564ec4992 ("gpio: move hogs into GPIO core")
Signed-off-by: Frank Wunderlich <frank-w@xxxxxxxxxxxxxxx>
---
drivers/gpio/gpiolib.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index ef8ccaf17c9c..acf41cfbcf10 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1013,6 +1013,9 @@ 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;
+
for (unsigned int i = 0; i < num_hogs; i++) {
if (is_of_node(fwnode)) {
/*
--
2.53.0