All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pinctrl: pinmux: add function selector to pinmux-functions
@ 2021-01-23 20:22 Drew Fustini
  2021-01-23 23:27 ` Linus Walleij
  2021-01-24 20:01 ` Andy Shevchenko
  0 siblings, 2 replies; 5+ messages in thread
From: Drew Fustini @ 2021-01-23 20:22 UTC (permalink / raw)
  To: linux-gpio
  Cc: Drew Fustini, Jason Kridner, Robert Nelson, Linus Walleij,
	Tony Lindgren, Andy Shevchenko, Alexandre Belloni

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(-)

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");
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] pinctrl: pinmux: add function selector to pinmux-functions
  2021-01-23 20:22 [PATCH] pinctrl: pinmux: add function selector to pinmux-functions Drew Fustini
@ 2021-01-23 23:27 ` Linus Walleij
  2021-01-24 20:01 ` Andy Shevchenko
  1 sibling, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2021-01-23 23:27 UTC (permalink / raw)
  To: Drew Fustini
  Cc: open list:GPIO SUBSYSTEM, Jason Kridner, Robert Nelson,
	Tony Lindgren, Andy Shevchenko, Alexandre Belloni

On Sat, Jan 23, 2021 at 9:44 PM Drew Fustini <drew@beagleboard.org> wrote:

> 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>

Good idea. Patch applied.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] pinctrl: pinmux: add function selector to pinmux-functions
  2021-01-23 20:22 [PATCH] pinctrl: pinmux: add function selector to pinmux-functions Drew Fustini
  2021-01-23 23:27 ` Linus Walleij
@ 2021-01-24 20:01 ` Andy Shevchenko
  2021-01-24 20:21   ` Drew Fustini
  1 sibling, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2021-01-24 20:01 UTC (permalink / raw)
  To: Drew Fustini
  Cc: open list:GPIO SUBSYSTEM, Jason Kridner, Robert Nelson,
	Linus Walleij, Tony Lindgren, Alexandre Belloni

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.

> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] pinctrl: pinmux: add function selector to pinmux-functions
  2021-01-24 20:01 ` Andy Shevchenko
@ 2021-01-24 20:21   ` Drew Fustini
  2021-01-24 21:13     ` Andy Shevchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Drew Fustini @ 2021-01-24 20:21 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: open list:GPIO SUBSYSTEM, Jason Kridner, Robert Nelson,
	Linus Walleij, Tony Lindgren, Alexandre Belloni

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] pinctrl: pinmux: add function selector to pinmux-functions
  2021-01-24 20:21   ` Drew Fustini
@ 2021-01-24 21:13     ` Andy Shevchenko
  0 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2021-01-24 21:13 UTC (permalink / raw)
  To: Drew Fustini
  Cc: open list:GPIO SUBSYSTEM, Jason Kridner, Robert Nelson,
	Linus Walleij, Tony Lindgren, Alexandre Belloni

On Sun, Jan 24, 2021 at 10:21 PM Drew Fustini <drew@beagleboard.org> wrote:
> 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.

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

> > > 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-01-24 21:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-23 20:22 [PATCH] pinctrl: pinmux: add function selector to pinmux-functions Drew Fustini
2021-01-23 23:27 ` Linus Walleij
2021-01-24 20:01 ` Andy Shevchenko
2021-01-24 20:21   ` Drew Fustini
2021-01-24 21:13     ` Andy Shevchenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.