Skip to contentSkip to conversation

gpiolib: don't use GPIO global numbers in debugfs output

PATCH Applied Bartosz Golaszewski 2 participants 3 messages Jul 7, 2025 – Jul 13, 2025 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpiolib: don't use GPIO global numbers in debugfs output

From: Bartosz Golaszewski <[email protected]>

One of the users of global GPIO numbers in the kernel are the debugfs callbacks in GPIO drivers. Before converting any custom .dbg_show() callbacks in individual modules, let's first make GPIO core stop using GPIO base in debugfs output. Use hardware offsets instead.

---
 drivers/gpio/gpiolib.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpio/gpiolib.c +2 -3
index 7b2174b10219..62694ec12a0c 100644
@@ -5234,8 +5234,8 @@ core_initcall(gpiolib_dev_init);
 static void gpiolib_dbg_show(struct seq_file *s, struct gpio_device *gdev)
 {
 	bool active_low, is_irq, is_out;
-	unsigned int gpio = gdev->base;
 	struct gpio_desc *desc;
+	unsigned int gpio = 0;
 	struct gpio_chip *gc;
 	unsigned long flags;
 	int value;
@@ -5339,8 +5339,7 @@ static int gpiolib_seq_show(struct seq_file *s, void *v)
 		return 0;
 	}
 
-	seq_printf(s, "%s: GPIOs %u-%u", dev_name(&gdev->dev), gdev->base,
-		   gdev->base + gdev->ngpio - 1);
+	seq_printf(s, "%s: %u GPIOs", dev_name(&gdev->dev), gdev->ngpio);
 	parent = gc->parent;
 	if (parent)
 		seq_printf(s, ", parent: %s/%s",
Signature · 1 line
2.48.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

One of the users of global GPIO numbers in the kernel are the debugfs callbacks in GPIO drivers. Before converting any custom .dbg_show() callbacks in individual modules, let's first make GPIO core stop using GPIO base in debugfs output. Use hardware offsets instead.

Yours,
Linus Walleij

author Applied
#2 lore raw
In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Quoted 6 lines · Bartosz Golaszewski

One of the users of global GPIO numbers in the kernel are the debugfs callbacks in GPIO drivers. Before converting any custom .dbg_show() callbacks in individual modules, let's first make GPIO core stop using GPIO base in debugfs output. Use hardware offsets instead.

Applied, thanks!

[1/1] gpiolib: don't use GPIO global numbers in debugfs output

      https://git.kernel.org/brgl/linux/c/1bec20dfa3d81be716e7ff5a6343bdec1d29b828

Best regards,

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