Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpio: Add TODO item for debugfs interface

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

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20201204083533.65830-1-linus.walleij@linaro.org

+36
+36
drivers/gpio/TODO
··· 142 142 make sense to simply join the subsystems into one and make pin 143 143 multiplexing, pin configuration, GPIO, etc selectable options in one 144 144 and the same pin control and GPIO subsystem. 145 + 146 + 147 + Debugfs in place of sysfs 148 + 149 + The old sysfs code that enables simple uses of GPIOs from the 150 + command line is still popular despite the existance of the proper 151 + character device. The reason is that it is simple to use on 152 + root filesystems where you only have a minimal set of tools such 153 + as "cat", "echo" etc. 154 + 155 + The old sysfs still need to be strongly deprecated and removed 156 + as it relies on the global GPIO numberspace that assume a strict 157 + order of global GPIO numbers that do not change between boots 158 + and is independent of probe order. 159 + 160 + To solve this and provide an ABI that people can use for hacks 161 + and development, implement a debugfs interface to manipulate 162 + GPIO lines that can do everything that sysfs can do today: one 163 + directory per gpiochip and one file entry per line: 164 + 165 + /sys/kernel/debug/gpiochip/gpiochip0 166 + /sys/kernel/debug/gpiochip/gpiochip0/gpio0 167 + /sys/kernel/debug/gpiochip/gpiochip0/gpio1 168 + /sys/kernel/debug/gpiochip/gpiochip0/gpio2 169 + /sys/kernel/debug/gpiochip/gpiochip0/gpio3 170 + ... 171 + /sys/kernel/debug/gpiochip/gpiochip1 172 + /sys/kernel/debug/gpiochip/gpiochip1/gpio0 173 + /sys/kernel/debug/gpiochip/gpiochip1/gpio1 174 + ... 175 + 176 + The exact files and design of the debugfs interface can be 177 + discussed but the idea is to provide a low-level access point 178 + for debugging and hacking and to expose all lines without the 179 + need of any exporting. Also provide ample ammunition to shoot 180 + oneself in the foot, because this is debugfs after all.