linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio: Add TODO item for debugfs interface
@ 2020-12-04  8:35 Linus Walleij
  2020-12-04  9:47 ` Geert Uytterhoeven
  0 siblings, 1 reply; 3+ messages in thread
From: Linus Walleij @ 2020-12-04  8:35 UTC (permalink / raw)
  To: linux-gpio; +Cc: Bartosz Golaszewski, Linus Walleij, Geert Uytterhoeven

The idea to create a debugfs to replace the aging and
dangerous sysfs ABI for hacking and tinkering came up
on the list.

Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/gpio/TODO | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/drivers/gpio/TODO b/drivers/gpio/TODO
index cd04e0b60159..b49ad263c516 100644
--- a/drivers/gpio/TODO
+++ b/drivers/gpio/TODO
@@ -142,3 +142,39 @@ use of the global GPIO numbers. Once the above is complete, it may
 make sense to simply join the subsystems into one and make pin
 multiplexing, pin configuration, GPIO, etc selectable options in one
 and the same pin control and GPIO subsystem.
+
+
+Debugfs in place of sysfs
+
+The old sysfs code that enables simple uses of GPIOs from the
+command line is still popular despite the existance of the proper
+character device. The reason is that it is simple to use on
+root filesystems where you only have a minimal set of tools such
+as "cat", "echo" etc.
+
+The old sysfs still need to be strongly deprecated and removed
+as it relies on the global GPIO numberspace that assume a strict
+order of global GPIO numbers that do not change between boots
+and is independent of probe order.
+
+To solve this and provide an ABI that people can use for hacks
+and development, implement a debugfs interface to manipulate
+GPIO lines that can do everything that sysfs can do today: one
+directory per gpiochip and one file entry per line:
+
+/sys/kernel/debug/gpiochip/gpiochip0
+/sys/kernel/debug/gpiochip/gpiochip0/0
+/sys/kernel/debug/gpiochip/gpiochip0/1
+/sys/kernel/debug/gpiochip/gpiochip0/2
+/sys/kernel/debug/gpiochip/gpiochip0/3
+...
+/sys/kernel/debug/gpiochip/gpiochip1
+/sys/kernel/debug/gpiochip/gpiochip1/0
+/sys/kernel/debug/gpiochip/gpiochip1/1
+...
+
+The exact files and design of the debugfs interface can be
+discussed but the idea is to provide a low-level access point
+for debugging and hacking and to expose all lines without the
+need of any exporting. Also provide ample ammunition to shoot
+oneself in the foot, because this is debugfs after all.
-- 
2.26.2


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

* Re: [PATCH] gpio: Add TODO item for debugfs interface
  2020-12-04  8:35 [PATCH] gpio: Add TODO item for debugfs interface Linus Walleij
@ 2020-12-04  9:47 ` Geert Uytterhoeven
  2020-12-05 23:14   ` Linus Walleij
  0 siblings, 1 reply; 3+ messages in thread
From: Geert Uytterhoeven @ 2020-12-04  9:47 UTC (permalink / raw)
  To: Linus Walleij
  Cc: open list:GPIO SUBSYSTEM, Bartosz Golaszewski, Geert Uytterhoeven

Hi Linus,

On Fri, Dec 4, 2020 at 9:37 AM Linus Walleij <linus.walleij@linaro.org> wrote:
> The idea to create a debugfs to replace the aging and
> dangerous sysfs ABI for hacking and tinkering came up
> on the list.
>
> Cc: Geert Uytterhoeven <geert+renesas@glider.be>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Thanks for your patch!

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

> --- a/drivers/gpio/TODO
> +++ b/drivers/gpio/TODO
> @@ -142,3 +142,39 @@ use of the global GPIO numbers. Once the above is complete, it may
>  make sense to simply join the subsystems into one and make pin
>  multiplexing, pin configuration, GPIO, etc selectable options in one
>  and the same pin control and GPIO subsystem.
> +
> +
> +Debugfs in place of sysfs
> +
> +The old sysfs code that enables simple uses of GPIOs from the
> +command line is still popular despite the existance of the proper
> +character device. The reason is that it is simple to use on
> +root filesystems where you only have a minimal set of tools such
> +as "cat", "echo" etc.
> +
> +The old sysfs still need to be strongly deprecated and removed
> +as it relies on the global GPIO numberspace that assume a strict
> +order of global GPIO numbers that do not change between boots
> +and is independent of probe order.
> +
> +To solve this and provide an ABI that people can use for hacks
> +and development, implement a debugfs interface to manipulate
> +GPIO lines that can do everything that sysfs can do today: one
> +directory per gpiochip and one file entry per line:
> +
> +/sys/kernel/debug/gpiochip/gpiochip0
> +/sys/kernel/debug/gpiochip/gpiochip0/0

.../gpio0?

Might be a better name, if you ever want to create a symlink
to this virtual file (e.g. from the line-name)?

> +/sys/kernel/debug/gpiochip/gpiochip0/1
> +/sys/kernel/debug/gpiochip/gpiochip0/2
> +/sys/kernel/debug/gpiochip/gpiochip0/3

Plus a symlink to the device backing this gpiochip.

> +...
> +/sys/kernel/debug/gpiochip/gpiochip1
> +/sys/kernel/debug/gpiochip/gpiochip1/0
> +/sys/kernel/debug/gpiochip/gpiochip1/1
> +...
> +
> +The exact files and design of the debugfs interface can be
> +discussed but the idea is to provide a low-level access point
> +for debugging and hacking and to expose all lines without the
> +need of any exporting. Also provide ample ammunition to shoot
> +oneself in the foot, because this is debugfs after all.

(let the bikeshedding begin ;-)

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH] gpio: Add TODO item for debugfs interface
  2020-12-04  9:47 ` Geert Uytterhoeven
@ 2020-12-05 23:14   ` Linus Walleij
  0 siblings, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2020-12-05 23:14 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: open list:GPIO SUBSYSTEM, Bartosz Golaszewski, Geert Uytterhoeven

On Fri, Dec 4, 2020 at 10:47 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:

> > +/sys/kernel/debug/gpiochip/gpiochip0
> > +/sys/kernel/debug/gpiochip/gpiochip0/0
>
> .../gpio0?
>
> Might be a better name, if you ever want to create a symlink
> to this virtual file (e.g. from the line-name)?

Yeah fixed this while applying.

> > +/sys/kernel/debug/gpiochip/gpiochip0/1
> > +/sys/kernel/debug/gpiochip/gpiochip0/2
> > +/sys/kernel/debug/gpiochip/gpiochip0/3
>
> Plus a symlink to the device backing this gpiochip.

Yeah why not. Interested in the job? ;)

Yours,
Linus Walleij

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

end of thread, other threads:[~2020-12-05 23:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-04  8:35 [PATCH] gpio: Add TODO item for debugfs interface Linus Walleij
2020-12-04  9:47 ` Geert Uytterhoeven
2020-12-05 23:14   ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).