Message ID | 1439561466-14350-6-git-send-email-mpa@pengutronix.de |
---|---|
State | New |
Headers | show |
On Fri, Aug 14, 2015 at 7:11 AM, Markus Pargmann <mpa@pengutronix.de> wrote: > 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> PARTLY applied. > +++ b/Documentation/ABI/testing/sysfs-gpio > @@ -21,6 +21,7 @@ Description: > /value ... always readable, writes fail for input GPIOs > /direction ... r/w as: in, out (default low); write: high, low > /edge ... r/w as: none, falling, rising, both > + /name ... r/o, unique name of the GPIO This patch has nothing to do with sysfs and this is not added to the ABI. I removed this hunk from the patch. The rest is applied. Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/Documentation/ABI/testing/sysfs-gpio b/Documentation/ABI/testing/sysfs-gpio index 55ffa2df1c10..2c1e199fd4e1 100644 --- a/Documentation/ABI/testing/sysfs-gpio +++ b/Documentation/ABI/testing/sysfs-gpio @@ -21,6 +21,7 @@ Description: /value ... always readable, writes fail for input GPIOs /direction ... r/w as: in, out (default low); write: high, low /edge ... r/w as: none, falling, rising, both + /name ... r/o, unique name of the GPIO /gpiochipN ... for each gpiochip; #N is its first GPIO /base ... (r/o) same as N /label ... (r/o) descriptive, not necessarily unique diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 3908503bebfe..79a0b41ce57b 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -2344,14 +2344,19 @@ static void gpiolib_dbg_show(struct seq_file *s, struct gpio_chip *chip) int is_irq; 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; + } gpiod_get_direction(gdesc); is_out = test_bit(FLAG_IS_OUT, &gdesc->flags); is_irq = test_bit(FLAG_USED_AS_IRQ, &gdesc->flags); - seq_printf(s, " gpio-%-3d (%-20.20s) %s %s %s", - gpio, gdesc->label, + seq_printf(s, " gpio-%-3d (%-20.20s|%-20.20s) %s %s %s", + gpio, gdesc->name ? gdesc->name : "", gdesc->label, is_out ? "out" : "in ", chip->get ? (chip->get(chip, i) ? "hi" : "lo")
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> --- Documentation/ABI/testing/sysfs-gpio | 1 + drivers/gpio/gpiolib.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-)