Permissions for GPIOs [Was: [PATCH] gpio: document how to order GPIO controllers]

Linus Walleij linus.walleij at linaro.org
Fri Jul 8 04:25:40 PDT 2016


On Wed, Jul 6, 2016 at 4:12 PM, Jan Lübbe <jlu at pengutronix.de> wrote:

> This discussion caused me remember a concern regarding the chardev
> interface: Is it still be possible to give specific users/groups access
> to individual GPIOs? This is currently possible in the sysfs interface
> with chown/chmod. I don't see how per-GPIO permissions would translate
> to a per-gpiochip device.

It is not possible because it is a different model. The /dev/gpiochipN
is similar to /dev/sda for example, either you access the whole device
file not parts of it.

I think the old sysfs wrongly gives people the impression that this is
needed just because it happens to have one value per file, I can't think
of a usecase for it.

It's a bit like if we had a sysfs or similar that could give you write
permissions to just certain blocks of a disk or something using chmod.
I don't see anyone needing that other than in theory.

> Am I overlooking some better way to give non-root users granular access
> to GPIOs? Or is that intentionally out of scope for the chardev
> interface?

Intentionally out of scope I don't know, nobody raised it during review,
and I have never seen a real-world usecase.

Are there any distributions out there that ship with something like udev
files that actually go to the trouble of setting up different permissions
on GPIO sysfs files, or are we talking about hacks in a lab or even
just theoretical issues?

Yours,
Linus Walleij



More information about the linux-arm-kernel mailing list