diff mbox series

pinctrl: pinmux: add function selector to pinmux-functions

Message ID 20210123202212.528046-1-drew@beagleboard.org
State Accepted
Commit 3bbf9b89592d18c391eafd7a5e0e7429ae2dc767
Headers show
Series pinctrl: pinmux: add function selector to pinmux-functions | expand

Commit Message

Drew Fustini Jan. 23, 2021, 8:22 p.m. UTC
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 <jkridner@beagleboard.org>
Cc: Robert Nelson <robertcnelson@beagleboard.org>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Drew Fustini <drew@beagleboard.org>
---
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(-)

Comments

Drew Fustini Jan. 24, 2021, 8:21 p.m. UTC | #1
On Sun, Jan 24, 2021 at 10:01:49PM +0200, Andy Shevchenko wrote:
> On Sat, Jan 23, 2021 at 10:44 PM Drew Fustini <drew@beagleboard.org> wrote:
> 
> 
> > 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.
> 
> > 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
> 
> -- 
> With Best Regards,
> Andy Shevchenko
diff mbox series

Patch

diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c
index 326b3fc41b55..b09021b8d3ba 100644
--- a/drivers/pinctrl/pinmux.c
+++ b/drivers/pinctrl/pinmux.c
@@ -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");