Skip to contentSkip to conversation

gpiolib: extend gpio label column width in debugfs file

PATCH In review Jarkko Nikula 3 participants 4 messages Nov 12, 2008 – Nov 14, 2008 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpiolib: extend gpio label column width in debugfs file

There are already various drivers having bigger label than 12 bytes. Most of them fit well under 20 bytes but make column width exact so that oversized labels don't mess up output alignment.

---
 drivers/gpio/gpiolib.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/gpio/gpiolib.c +1 -1
index faa1cc6..82020ab 100644
@@ -1134,7 +1134,7 @@ static void gpiolib_dbg_show(struct seq_file *s, struct gpio_chip *chip)
 			continue;
 
 		is_out = test_bit(FLAG_IS_OUT, &gdesc->flags);
-		seq_printf(s, " gpio-%-3d (%-12s) %s %s",
+		seq_printf(s, " gpio-%-3d (%-20.20s) %s %s",
 			gpio, gdesc->label,
 			is_out ? "out" : "in ",
 			chip->get
Signature · 1 line
1.5.6.5
#1 lore raw
Quoted 3 lines · On Wed, 12 Nov 2008 08:56:13 +0200 Jarkko Nikula <[email protected]>…

There are already various drivers having bigger label than 12 bytes. Most of them fit well under 20 bytes but make column width exact so that oversized labels don't mess up output alignment.

Please provide before-and-after example output for this sort of change so that we can better understand its effect.

Quoted 10 lines
---
 drivers/gpio/gpiolib.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/gpio/gpiolib.c +0 -0
index faa1cc6..82020ab 100644

drivers/gpio/gpiolib.c static void gpiolib_dbg_show(struct seq_file *s, struct gpio_chip *chip) · line 1140

Quoted 8 lines
drivers/gpio/gpiolib.c +1 -1
@@ -1134,7 +1134,7 @@ static void gpiolib_dbg_show(struct seq_file *s, struct gpio_chip *chip)
 			continue;
 
 		is_out = test_bit(FLAG_IS_OUT, &gdesc->flags);
-		seq_printf(s, " gpio-%-3d (%-12s) %s %s",
+		seq_printf(s, " gpio-%-3d (%-20.20s) %s %s",
 			gpio, gdesc->label,
 			is_out ? "out" : "in ",
 			chip->get

This is a non-backward-compatible change to a userspace interface. It looks like a pretty safe one, but this is always a fairly big deal.

If we're going to make this change then we should backport it to 2.6.27.x, 2.6.26.x and to 2.6.25.x to minimise the chance that someone will write a parser which works on one kernel version and fails on another.

David? Thoughts?

#2 lore raw
Quoted 11 lines · Andrew Morton
Quoted 3 lines · On Wed, 12 Nov 2008 08:56:13 +0200 Jarkko Nikula <[email protected]>…

There are already various drivers having bigger label than 12 bytes. Most of them fit well under 20 bytes but make column width exact so that oversized labels don't mess up output alignment.

Please provide before-and-after example output for this sort of change so that we can better understand its effect.

Quoted 1 line

I meant to send:

... thanks Jarkko.

Quoted 11 lines
Quoted 11 lines
---
 drivers/gpio/gpiolib.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/gpio/gpiolib.c +0 -0
index faa1cc6..82020ab 100644
@@ -1134,7 +1134,7 @@ static void gpiolib_dbg_show(struct seq_file *s, struct gpio_chip *chip)
 			continue;
 
Quoted 9 lines

drivers/gpio/gpiolib.c static void gpiolib_dbg_show(struct seq_file *s, struct gpio_chip *chip) · line 1140

Quoted 6 lines
drivers/gpio/gpiolib.c +1 -1
 		is_out = test_bit(FLAG_IS_OUT, &gdesc->flags);
-		seq_printf(s, " gpio-%-3d (%-12s) %s %s",
+		seq_printf(s, " gpio-%-3d (%-20.20s) %s %s",
 			gpio, gdesc->label,
 			is_out ? "out" : "in ",
 			chip->get

This is a non-backward-compatible change to a userspace interface. It looks like a pretty safe one, but this is always a fairly big deal.

Not really; this is for debugfs, and formats for debug data are not ABI-suitable. Developers need the flexibility to change that stuff ... for example, they can *already* override the default format to show pullups/pulldowns, drive strength, polarity inversion, debouncing, and other hardware-specific goodies.

Quoted 6 lines

If we're going to make this change then we should backport it to 2.6.27.x, 2.6.26.x and to 2.6.25.x to minimise the chance that someone will write a parser which works on one kernel version and fails on another.

David? Thoughts?

This is explicitly not supported for ABI-ish purposes.

If they aren't even using those parenthesis to delimit things, I'd really need to question what happened to their grey cells!

- Dave

#3 lore raw
Quoted 11 lines · On Thu, 13 Nov 2008 17:13:38 -0800 David Brownell <[email protected]> wrote:
Quoted 10 lines · Andrew Morton
Quoted 3 lines · On Wed, 12 Nov 2008 08:56:13 +0200 Jarkko Nikula <[email protected]>…

There are already various drivers having bigger label than 12 bytes. Most of them fit well under 20 bytes but make column width exact so that oversized labels don't mess up output alignment.

Please provide before-and-after example output for this sort of change so that we can better understand its effect.

Quoted 8 lines
Quoted 1 line
Quoted 1 line

I meant to send:

... thanks Jarkko.

OK.

Quoted 21 lines
Quoted 11 lines
Quoted 11 lines
---
 drivers/gpio/gpiolib.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/gpio/gpiolib.c +0 -0
index faa1cc6..82020ab 100644
@@ -1134,7 +1134,7 @@ static void gpiolib_dbg_show(struct seq_file *s, struct gpio_chip *chip)
 			continue;
 
Quoted 9 lines

drivers/gpio/gpiolib.c static void gpiolib_dbg_show(struct seq_file *s, struct gpio_chip *chip) · line 1140

Quoted 6 lines
drivers/gpio/gpiolib.c +1 -1
 		is_out = test_bit(FLAG_IS_OUT, &gdesc->flags);
-		seq_printf(s, " gpio-%-3d (%-12s) %s %s",
+		seq_printf(s, " gpio-%-3d (%-20.20s) %s %s",
 			gpio, gdesc->label,
 			is_out ? "out" : "in ",
 			chip->get

This is a non-backward-compatible change to a userspace interface. It looks like a pretty safe one, but this is always a fairly big deal.

Quoted 3 lines

Not really; this is for debugfs, and formats for debug data are not ABI-suitable. Developers need the flexibility to change that stuff ...

Well that's what we like to say, but it's delusional. If we add stuff then later change it, other people's stuff will break. Just as with sysfs, procfs, syscalls, etc.

The only difference is that with debugfs we have this weaselly excuse to get people off our backs.

Quoted 10 lines

for example, they can *already* override
the default format to show pullups/pulldowns, drive strength, polarity inversion, debouncing, and other hardware-specific goodies.

Quoted 5 lines

If we're going to make this change then we should backport it to 2.6.27.x, 2.6.26.x and to 2.6.25.x to minimise the chance that someone will write a parser which works on one kernel version and fails on another.

Quoted 6 lines
Quoted 1 line

David? Thoughts?

This is explicitly not supported for ABI-ish purposes.

If they aren't even using those parenthesis to delimit things, I'd really need to question what happened to their grey cells!

True.