On Wed, 2008-04-30 at 15:47 -0700, Trent Piepho wrote:
We've discussed the down sides of your model. It's got up sides, eg
your use case is made very easy, but it ain't all roses.
Now, if the kernel has requested that pin and hasn't exported it you
can't touch it. This is what we want.
Otherwise you will walk the gpiochips, find your chip's base and use it
to calculate the gpio number. If the kernel's exported it then the file
will be there to use. If the kernel hasn't requested it then you can do
so by using the control file.
Yes it's longer and harder and more convoluted. It's also much more
safe.
That label was always just supposed to be a debugging aid, i.e.
something to show up in debugfs. This is used to reduce D footprint.
Maybe if the labels are being stored anyway they can be made available
through sysfs as well as debugfs?
That's very useful indeed, but if you don't want userspace to be able to
do that it's also dangerous. This is why the kernel has to explicitly
allow it.
So you want userspace to be able to clobber any gpio which is used by
the kernel? That's what this version of the interface is designed to
avoid!
The way to see it in sysfs is to have the kernel export it. This is the
point. The kernel should request it for it's own use then export it if
it wants userspace to be able to touch it as well.
If driver was using it, it will have requested it. If you are looking
at it then the kernel must have also exported it. If the kernel's
exported it then nothing you can do will unexport it. You can only
unexport gpios you've exported yourself manually and the only gpios you
can do this to are ones unused by the driver.
--