Re: [patch/rfc 2.6.25-git] gpio: sysfs interface
From: David Brownell
Date: Tue Apr 29 2008 - 18:11:34 EST
On Tuesday 29 April 2008, Trent Piepho wrote:
> > Sorry if I'm being dense; how do you want this bit to work? As I see
> > it, there are a few options:
> >
> > 1) Have the files named as you suggest and all of them always present,
> > albeit read-only until export. Very easy to use, easy to discover which
> > file is which, a decent bit of memory usage having them all listed.
>
> Well, is it really that much? There are 579 files under /sys/class/tty. But
> suppose it is too much (why isn't tty too much then?), then we can do 3.
I just ssh'd into three embedded boards I have handy, and they have
respectively four, four, and seven entries there. That "seven"
case is actually incorrect ... the other three serial ports aren't
connected to anything.
So: yes, adding a few hundred useless sysfs nodes *IS* a problem
in the target environment of embedded boards.
Note that "read-only until export" is far from straightforward
to achieve.
> > 3) Have the files named as you suggest, explicit export/request but
> > better parsing behind the control file so something like
> > echo "export pca9557-0:5" > control
> > works. Very very nice for the user, big heavy back end.
>
> The back end doesn't seem that big to me. Here's code for it.
Which fails in a common case: chip labels are not unique.
> If anything,
> the parsing code is simpler than what David has.
Apples vs oranges. Use the same command syntax if you're going
to make comparisons; I can save even more with "+export/-unexport"
syntax. For comparable syntax, your stuff *IS* bigger.
> David's code for parsing the control file plus code for generating a mapping
> range file would certainly be larger.
The #3 option presumes some file listing chips and ranges too,
since GPIOs are exported only on demand. Ditto #2 and #4...
- Dave
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/