Skip to contentSkip to conversation

pinctrl: pinmux: add function selector to pinmux-functions

PATCH In review Drew Fustini 3 participants 5 messages Jan 23, 2021 – Jan 24, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pinctrl: pinmux: add function selector to pinmux-functions

Add the function selector to the pinmux-functions debugfs output. This is an integer which is the index into the pinmux function tree. It will make it easier to correlate function name to function selector without having to count the lines in the output.

Example output of "pinmux-functions":

function 0: pinmux-uart0-pins, groups = [ pinmux-uart0-pins ] function 1: pinmux-uart1-pins, groups = [ pinmux-uart1-pins ] function 2: pinmux-uart2-pins, groups = [ pinmux-uart2-pins ] function 3: pinmux-mmc0-pins, groups = [ pinmux-mmc0-pins ] function 3: pinmux-mmc1-pins, groups = [ pinmux-mmc1-pins ] function 5: pinmux-i2c0-pins, groups = [ pinmux-i2c0-pins ] function 6: pinmux-i2c1-pins, groups = [ pinmux-i2c1-pins ] function 7: pinmux-i2c2-pins, groups = [ pinmux-i2c2-pins ] function 8: pinmux-pwm0-pins, groups = [ pinmux-pwm0-pins ] function 9: pinmux-pwm1-pins, groups = [ pinmux-pwm1-pins ] function 10: pinmux-adc-pins, groups = [ pinmux-adc-pins ]

Cc Jason Kridner <[email protected]>
Cc Robert Nelson <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Tony Lindgren <[email protected]>
Cc Andy Shevchenko <[email protected]>
Cc Alexandre Belloni <[email protected]>

---
Patch note:
This may seem trivial but I found myself coming up with series of pipes in the shell just so I could see the function selector in line with the function names. At first, I thought I could just pipe to 'cat -n' but that counts at offset 1 instead of 0. The only downside I can see to this patch would be if someone is depending on the existing format but I don't believe that is a concern for debugfs, right?

 drivers/pinctrl/pinmux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/pinmux.c +1 -1
index 326b3fc41b55..b09021b8d3ba 100644
@@ -564,7 +564,7 @@ static int pinmux_functions_show(struct seq_file *s, void *what)
 			continue;
 		}
 
-		seq_printf(s, "function: %s, groups = [ ", func);
+		seq_printf(s, "function %d: %s, groups = [ ", func_selector, func);
 		for (i = 0; i < num_groups; i++)
 			seq_printf(s, "%s ", groups[i]);
 		seq_puts(s, "]\n");
Signature · 1 line
2.25.1
#1 lore raw
Quoted 19 lines · Drew Fustini

Add the function selector to the pinmux-functions debugfs output. This is an integer which is the index into the pinmux function tree. It will make it easier to correlate function name to function selector without having to count the lines in the output.

Example output of "pinmux-functions":

function 0: pinmux-uart0-pins, groups = [ pinmux-uart0-pins ] function 1: pinmux-uart1-pins, groups = [ pinmux-uart1-pins ] function 2: pinmux-uart2-pins, groups = [ pinmux-uart2-pins ] function 3: pinmux-mmc0-pins, groups = [ pinmux-mmc0-pins ] function 3: pinmux-mmc1-pins, groups = [ pinmux-mmc1-pins ] function 5: pinmux-i2c0-pins, groups = [ pinmux-i2c0-pins ] function 6: pinmux-i2c1-pins, groups = [ pinmux-i2c1-pins ] function 7: pinmux-i2c2-pins, groups = [ pinmux-i2c2-pins ] function 8: pinmux-pwm0-pins, groups = [ pinmux-pwm0-pins ] function 9: pinmux-pwm1-pins, groups = [ pinmux-pwm1-pins ] function 10: pinmux-adc-pins, groups = [ pinmux-adc-pins ]

Quoted 7 lines
Cc Jason Kridner <[email protected]>
Cc Robert Nelson <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Tony Lindgren <[email protected]>
Cc Andy Shevchenko <[email protected]>
Cc Alexandre Belloni <[email protected]>

Good idea. Patch applied.

Yours,
Linus Walleij

#2 lore raw
In reply to Drew Fustini
Quoted 5 lines · Drew Fustini

Patch note:
This may seem trivial but I found myself coming up with series of pipes in the shell just so I could see the function selector in line with the function names. At first, I thought I could just pipe to 'cat -n' but that counts at offset 1 instead of 0.

SO advises [1] to use nl -v0 instead.

Quoted 3 lines

The only downside I can see to
this patch would be if someone is depending on the existing format but I don't believe that is a concern for debugfs, right?

Debugfs is not an ABI.

[1]: https://superuser.com/a/1433656/415970

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw
Quoted 10 lines · Andy Shevchenko
Quoted 5 lines · Drew Fustini

Patch note:
This may seem trivial but I found myself coming up with series of pipes in the shell just so I could see the function selector in line with the function names. At first, I thought I could just pipe to 'cat -n' but that counts at offset 1 instead of 0.

SO advises [1] to use nl -v0 instead.

Neat! That is a nice utility to remember. I feel bad now for piping to perl to solve the problem :)

I know this is rather trivial change but I think does seem to make sense to print the function selector along with the function name.

Quoted 12 lines
Quoted 4 lines

The only downside I can see to
this patch would be if someone is depending on the existing format but I don't believe that is a concern for debugfs, right?

Debugfs is not an ABI.

[1]: https://superuser.com/a/1433656/415970

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#4 lore raw
Quoted 9 lines · Drew Fustini
Quoted 8 lines · Andy Shevchenko
Quoted 5 lines · Drew Fustini

Patch note:
This may seem trivial but I found myself coming up with series of pipes in the shell just so I could see the function selector in line with the function names. At first, I thought I could just pipe to 'cat -n' but that counts at offset 1 instead of 0.

Quoted 7 lines
Quoted 1 line

SO advises [1] to use nl -v0 instead.

Neat! That is a nice utility to remember. I feel bad now for piping to perl to solve the problem :)

I know this is rather trivial change but I think does seem to make sense to print the function selector along with the function name.

I'm not against the patch. Simply learning shell together :)

Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

The only downside I can see to
this patch would be if someone is depending on the existing format but I don't believe that is a concern for debugfs, right?

Debugfs is not an ABI.

[1]: https://superuser.com/a/1433656/415970

Signature · 2 lines
With Best Regards,
Andy Shevchenko