Commit ced433e2 authored by Markus Pargmann's avatar Markus Pargmann Committed by Linus Walleij

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: default avatarMarkus Pargmann <mpa@pengutronix.de>
[Dropped unsolicited sysfs ABI patch hunk]
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent ddd54040
...@@ -2378,14 +2378,19 @@ static void gpiolib_dbg_show(struct seq_file *s, struct gpio_chip *chip) ...@@ -2378,14 +2378,19 @@ static void gpiolib_dbg_show(struct seq_file *s, struct gpio_chip *chip)
int is_irq; int is_irq;
for (i = 0; i < chip->ngpio; i++, gpio++, gdesc++) { for (i = 0; i < chip->ngpio; i++, gpio++, gdesc++) {
if (!test_bit(FLAG_REQUESTED, &gdesc->flags)) if (!test_bit(FLAG_REQUESTED, &gdesc->flags)) {
if (gdesc->name) {
seq_printf(s, " gpio-%-3d (%-20.20s)\n",
gpio, gdesc->name);
}
continue; continue;
}
gpiod_get_direction(gdesc); gpiod_get_direction(gdesc);
is_out = test_bit(FLAG_IS_OUT, &gdesc->flags); is_out = test_bit(FLAG_IS_OUT, &gdesc->flags);
is_irq = test_bit(FLAG_USED_AS_IRQ, &gdesc->flags); is_irq = test_bit(FLAG_USED_AS_IRQ, &gdesc->flags);
seq_printf(s, " gpio-%-3d (%-20.20s) %s %s %s", seq_printf(s, " gpio-%-3d (%-20.20s|%-20.20s) %s %s %s",
gpio, gdesc->label, gpio, gdesc->name ? gdesc->name : "", gdesc->label,
is_out ? "out" : "in ", is_out ? "out" : "in ",
chip->get chip->get
? (chip->get(chip, i) ? "hi" : "lo") ? (chip->get(chip, i) ? "hi" : "lo")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment