Question about GPIO Lib

Bruce_Leonard at Bruce_Leonard at
Tue Jan 31 11:06:43 EST 2012


Bill Gatliff <bgat at> wrote on 01/27/2012 10:42:57 AM:

> On Fri, Jan 27, 2012 at 5:31 AM,  <Bruce_Leonard at> wrote:
> >
> > The problem is we've got a number of other things hooked up to the 
> > pins that it would be very bad if someone from user space played with
> > them, like our FPGA configuration pin.  Some one toggles that and our 
> > goes stupid.  So what I'm wondering is if there's a way, preferably 
> > the device tree, to limit the GPIOs that GPIO Lib exposes to user 
> Sounds like you DON'T want to merely export that GPIO pin to userspace.

Well, yes I do want to just export to userspace, I just want to restrict 
the pins that get exported to only those that are defined in the device 
tree.  I don't want or need to access any of the exported pins from kernel 
space and I don't want user space to access any pin not explicitly called 
out in the device tree.  I want it to behave like gpio-leds only with 
input as well as output capabilities.

> If you have anything in kernel space doing a gpio_request() on that
> pin, it won't be exportable to userspace anyway.  Regardless, you are
> probably better off implement a DEVICE_ATTR that, in its store()
> method, treads lightly on said pin.  And then do a gpio_request() in
> kernel space so that users can't ever see the pin directly.
> Just my $0.02.

If I understand this correctly you're basically saying that gpiolib is a 
waste of time and I should just write my own driver?


More information about the Linuxppc-dev mailing list