Re: [PATCH] gpio: Do not trigger WARN() with sysfs gpio export/unexport
From: Damien Le Moal <hidden>
Date: 2020-11-11 07:11:41
On Tue, 2020-11-10 at 15:40 +0100, Bartosz Golaszewski wrote:
On Tue, Nov 10, 2020 at 3:31 PM Linus Walleij [off-list ref] wrote:quoted
On Fri, Nov 6, 2020 at 12:27 PM Damien Le Moal [off-list ref] wrote:quoted
It may not be the best interface for regular end users to manipulate gpios, but it is definitely super useful for developers to do quick tests of their setup/drivers (which is what I did for my work with the Kendryte K210 RISC-V SoC support).It is a bit discouraging that RISC-V, which was invented after we already obsoleted the sysfs ABI, is deploying this for development and test. We need to think about a similar facility for users which is less damaging but fulfils the same needs. I think I saw something a while back that looked promising and added some funky files in debugfs in a hierarchical manner per-gpiochip instead. That is how debugfs should be used.Basically something like what gpio-mockup does for events? Was it something out-of-tree or was it on the mailing list? Also: quick tests have the tendency to become long-term solutions. :) Is gpioget/gpioset duo difficult/cumbersome to use? It's a serious question - I wrote it in a way that was as user-friendly as possible but maybe I'm missing something about sysfs that makes users prefer it over a command-line tool. To me sysfs was always a PITA with the global numbers etc. but it still seems to stick with others.
In my particular case, I am using a simple busybox userspace that has nothing else but a shell, so I did not have the gpioget/gpioset tools. And to be frank, I did not even know what tool to use to control GPIOs. It is the first time I am touching GPIOs with Linux and did not spent time to study what should be used once I saw that sysfs allowed controlling the pins for tests. Removing sysfs entirely would likely force people to look for these tools to do tests, and I really am an example here :) I am using buildroot to generate the toolchain and busybox userspace for the board. I now see that libgpiod and gpio tools packages are in there but for whatever reasons, I cannot select them for my RISC-V build. Will need to explore why. -- Damien Le Moal Western Digital