Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpiolib: Add gpio name information to /sys/kernel/debug/gpio

Add some information about gpio names to the debugfs gpio file. name and
label of a GPIO are then displayed next to each other. This way it is
easy to see what the real name of GPIO is and what the driver requested
it for.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
[Dropped unsolicited sysfs ABI patch hunk]
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Markus Pargmann and committed by
Linus Walleij
ced433e2 ddd54040

+8 -3
+8 -3
drivers/gpio/gpiolib.c
··· 2378 2378 int is_irq; 2379 2379 2380 2380 for (i = 0; i < chip->ngpio; i++, gpio++, gdesc++) { 2381 - if (!test_bit(FLAG_REQUESTED, &gdesc->flags)) 2381 + if (!test_bit(FLAG_REQUESTED, &gdesc->flags)) { 2382 + if (gdesc->name) { 2383 + seq_printf(s, " gpio-%-3d (%-20.20s)\n", 2384 + gpio, gdesc->name); 2385 + } 2382 2386 continue; 2387 + } 2383 2388 2384 2389 gpiod_get_direction(gdesc); 2385 2390 is_out = test_bit(FLAG_IS_OUT, &gdesc->flags); 2386 2391 is_irq = test_bit(FLAG_USED_AS_IRQ, &gdesc->flags); 2387 - seq_printf(s, " gpio-%-3d (%-20.20s) %s %s %s", 2388 - gpio, gdesc->label, 2392 + seq_printf(s, " gpio-%-3d (%-20.20s|%-20.20s) %s %s %s", 2393 + gpio, gdesc->name ? gdesc->name : "", gdesc->label, 2389 2394 is_out ? "out" : "in ", 2390 2395 chip->get 2391 2396 ? (chip->get(chip, i) ? "hi" : "lo")