Skip to contentSkip to conversation

gpiolib: use of_node_name if line-name is missing

PATCH Applied Frank Wunderlich 3 participants 3 messages Sep 17 – Sep 18 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 gpiolib: use of_node_name if line-name is missing

From: Frank Wunderlich <[email protected]>

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")

---
v2:
- move code into loop as suggested by Andy and add comment about the reason

---
 drivers/gpio/gpiolib.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpio/gpiolib.c +7 -0
index ef8ccaf17c9c..28f7265c5d56 100644
@@ -1029,6 +1029,13 @@ int gpiochip_add_hog(struct gpio_chip *gc, struct fwnode_handle *fwnode)
 			ret = of_gpiochip_get_lflags(gc, &gpiospec, &lflags);
 			if (ret)
 				return ret;
+
+			/*
+			 * If no line-name property is present, fall back to the OF
+			 * node name as in the previous implementation.
+			 */
+			if (!name)
+				name = to_of_node(fwnode)->name;
 		} else {
 			/*
 			 * GPIO_ACTIVE_LOW is currently the only lookup flag
Signature · 1 line
2.53.0
Reviewed-by on v2 1/1
#1 lore raw
Quoted 9 lines · Frank Wunderlich

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.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw
In reply to Frank Wunderlich
Quoted 8 lines · Frank Wunderlich

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.

[...]

Applied, thanks!

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

      https://git.kernel.org/brgl/c/d54a489c8c4b627775445d54a6cbd32f209bda8f

Best regards,

Signature · 1 line
Bartosz Golaszewski <[email protected]>