From: Bill Gatliff <bgat@billgatliff.com>
To: Bruce_Leonard@selinc.com
Cc: linuxppc-dev@lists.ozlabs.org
Subject: Re: Question about GPIO Lib
Date: Tue, 31 Jan 2012 10:39:05 -0600 [thread overview]
Message-ID: <CADkCAuvkWvBLbDwhDFBdZ0mGoPv5HyZSD-ivXPyTKbMo_9GXvg@mail.gmail.com> (raw)
In-Reply-To: <OF0788007E.17A6C7B1-ON88257996.00000E0C-88257996.00009D99@selinc.com>
Bruce:
On Mon, Jan 30, 2012 at 6:06 PM, <Bruce_Leonard@selinc.com> wrote:
> Bill Gatliff <bgat@billgatliff.com> wrote on 01/27/2012 10:42:57 AM:
>> 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 misunderstood your message, then. I was thinking that you were
already using certain pins in kernel space, and didn't want THOSE pins
exported to userspace due to the risks that users might invoke them
and cause Bad Things to happen.
> I just want to restrict
> the pins that get exported to only those that are defined in the device
> tree. =A0I don't want or need to access any of the exported pins from ker=
nel
> space and I don't want user space to access any pin not explicitly called
> out in the device tree. =A0I want it to behave like gpio-leds only with
> input as well as output capabilities.
I glanced at gpiolib.c, and I don't immediately see a way to achieve
this with the current code.
Again, you could get the same net effect by doing a gpio_request() in
kernel space on the pins you DON'T want exported, which would prevent
those pins being exportable. But that's still different from what you
are actually asking for.
> If I understand this correctly you're basically saying that gpiolib is a
> waste of time and I should just write my own driver?
I'm DEFINITELY not saying that gpiolib is generally a waste of time! :)
I'm just saying that, sadly, in many ways gpiolib is still a
work-in-progress. The userspace component has been somewhat
controversial in general over the years, and definitely lacks several
key features in addition to the one you are asking for.
Since I know others will ask :), note that the userspace component
won't give you a direction attribute for pins whose directions cannot
be changed from userspace. That's a pretty important omission, since
it prevents me from conveniently verifying (apart from debugfs, I
mean) that a pin is in fact configured in the direction I want it to
be. Whether I can change its direction is a different issue entirely.
Another omission that has struck me over the years is that it's not
straightforward for gpio_chip authors to add custom attributes in
sysfs for either the chip itself, or for the pins the chip exports.
Within /sys/class/gpio/gpio<N>/ I mean.
But even in its current state, gpiolib is awesome. Maybe someday I or
someone else will find time to make it awesomer. :)
b.g.
--=20
Bill Gatliff
bgat@billgatliff.com
next prev parent reply other threads:[~2012-01-31 16:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-27 4:31 Question about GPIO Lib Bruce_Leonard
2012-01-27 18:42 ` Bill Gatliff
2012-01-31 0:06 ` Bruce_Leonard
2012-01-31 16:39 ` Bill Gatliff [this message]
2012-01-31 17:44 ` Bruce_Leonard
2012-02-01 12:32 ` Mark Brown
2012-02-01 15:56 ` Bill Gatliff
2012-02-01 16:53 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CADkCAuvkWvBLbDwhDFBdZ0mGoPv5HyZSD-ivXPyTKbMo_9GXvg@mail.gmail.com \
--to=bgat@billgatliff.com \
--cc=Bruce_Leonard@selinc.com \
--cc=linuxppc-dev@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).