login
Header Space

 
 

Re: [patch/rfc 2.6.25-git] gpio: sysfs interface

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: David Brownell <david-b@...>
Cc: lkml <linux-kernel@...>, hartleys <hartleys@...>, Ben Nizette <bn@...>, Mike Frysinger <vapier.adi@...>, Bryan Wu <cooloney@...>
Date: Tuesday, April 29, 2008 - 1:48 am

On Mon, 28 Apr 2008, David Brownell wrote:

So just fall back to "gpio" if there is no label?  The only character that's
not valid in a pathname is '/', so that's trivial to check for.

const char *label = chip->label && !strchr(chip->label, '/') ?
 	chip->label : "gpio"; /* or "generic" or "unknown", or ...*/

This means you don't need a file with number to device assignents.  It makes
shell scripting a lot easier too.  Say I want the first gpio on a pca9557 gpio
expander?  It's will be something like:  /sys/class/gpio/pca9557-0:0

You don't have to worry about dynamic assigments.  You don't have to resort to
convoluted shell script code to extract the proper range from a mapping file
and then construct the name.


It's nice to be able to see what a driver is using a gpio for.  You could also
assign labels from userspace this way.


So make them appear when something in the kernel requests them, explictly
exports them to user-space, or they are requested from user space.  The last
two can offer write access, the first only read.  I don't see why the explicit
request is necessary for something to show up in sysfs.  Nothing else in sysfs
seems to work this way.  At least, I see plenty of files in there that I
didn't have to manually make appear.


$ ls /sys/class/tty/ | wc
     579     579    4042

What's a few hundred more?


I didn't mean for gpiolib to create that device, that's obviously wrong.  What
I meant was the platform code, e.g. the code the calls gpiochip_add(), could
just call that one function and then it would have a device for the gpios to
appear under in sysfs.  You said that many systems "can't" have a device for
the gpios and I don't see how this is so.  Could you give me an example of
something that calls gpiochip_add() and can't provide a dev field in the
gpio_chip struct?


If memory allocations don't work, then gpiochip_add() can't possibly do
anything with sysfs, so having a device to parent the sysfs files from is a
moot point.


It's one line of code.


I thought you meant comments to my patch.
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[patch/rfc 2.6.25-git] gpio: sysfs interface, David Brownell, (Mon Apr 28, 3:39 pm)
Re: [patch/rfc 2.6.25-git] gpio: sysfs interface, Trent Piepho, (Mon Apr 28, 7:09 pm)
Re: [patch/rfc 2.6.25-git] gpio: sysfs interface, Ben Nizette, (Mon Apr 28, 8:47 pm)
Re: [patch/rfc 2.6.25-git] gpio: sysfs interface, David Brownell, (Mon Apr 28, 8:45 pm)
Re: [patch/rfc 2.6.25-git] gpio: sysfs interface, Trent Piepho, (Tue Apr 29, 1:48 am)
Re: [patch/rfc 2.6.25-git] gpio: sysfs interface, Ben Nizette, (Tue Apr 29, 8:35 am)
Re: [patch/rfc 2.6.25-git] gpio: sysfs interface, David Brownell, (Tue Apr 29, 5:55 pm)
Re: [patch/rfc 2.6.25-git] gpio: sysfs interface, Ben Nizette, (Tue Apr 29, 7:29 pm)
Re: [patch/rfc 2.6.25-git] gpio: sysfs interface, David Brownell, (Tue Apr 29, 9:04 pm)
Re: [patch/rfc 2.6.25-git] gpio: sysfs interface, Ben Nizette, (Tue Apr 29, 10:08 pm)
Re: [patch/rfc 2.6.25-git] gpio: sysfs interface, David Brownell, (Wed Apr 30, 1:42 pm)
[patch/rfc 2.6.25-git v2] gpio: sysfs interface, David Brownell, (Wed Apr 30, 5:34 pm)
Re: [patch/rfc 2.6.25-git v2] gpio: sysfs interface, Ben Nizette, (Wed Apr 30, 7:28 pm)
Re: [patch/rfc 2.6.25-git v2] gpio: sysfs interface, David Brownell, (Thu May 1, 5:40 pm)
Re: [patch/rfc 2.6.25-git v2] gpio: sysfs interface, Trent Piepho, (Wed Apr 30, 6:47 pm)
Re: [patch/rfc 2.6.25-git v2] gpio: sysfs interface, David Brownell, (Wed Apr 30, 10:08 pm)
Re: [patch/rfc 2.6.25-git v2] gpio: sysfs interface, Trent Piepho, (Wed Apr 30, 11:41 pm)
Re: [patch/rfc 2.6.25-git v2] gpio: sysfs interface, David Brownell, (Thu May 1, 12:35 am)
Re: [patch/rfc 2.6.25-git v2] gpio: sysfs interface, Trent Piepho, (Thu May 1, 5:16 pm)
Re: [patch/rfc 2.6.25-git v2] gpio: sysfs interface, David Brownell, (Fri May 2, 10:58 pm)
Re: [patch/rfc 2.6.25-git v2] gpio: sysfs interface, David Brownell, (Fri May 2, 11:05 pm)
Re: [patch/rfc 2.6.25-git v2] gpio: sysfs interface, Ben Nizette, (Wed Apr 30, 7:14 pm)
Re: [patch/rfc 2.6.25-git v2] gpio: sysfs interface, David Brownell, (Wed Apr 30, 10:12 pm)
Re: [patch/rfc 2.6.25-git] gpio: sysfs interface, Trent Piepho, (Tue Apr 29, 11:13 pm)
Re: [patch/rfc 2.6.25-git] gpio: sysfs interface, Ben Nizette, (Wed Apr 30, 6:33 am)
Re: [patch/rfc 2.6.25-git] gpio: sysfs interface, Trent Piepho, (Tue Apr 29, 2:15 pm)
Re: [patch/rfc 2.6.25-git] gpio: sysfs interface, David Brownell, (Tue Apr 29, 5:56 pm)
Re: [patch/rfc 2.6.25-git] gpio: sysfs interface, Trent Piepho, (Tue Apr 29, 8:49 pm)
Re: [patch/rfc 2.6.25-git] gpio: sysfs interface, David Brownell, (Wed Apr 30, 1:49 pm)
Re: [patch/rfc 2.6.25-git] gpio: sysfs interface, Ben Nizette, (Mon Apr 28, 7:01 pm)
Re: [patch/rfc 2.6.25-git] gpio: sysfs interface, David Brownell, (Mon Apr 28, 8:44 pm)
Re: [patch/rfc 2.6.25-git] gpio: sysfs interface, Ben Nizette, (Mon Apr 28, 9:58 pm)
Re: [patch/rfc 2.6.25-git] gpio: sysfs interface, David Brownell, (Mon Apr 28, 11:44 pm)
Re: [patch/rfc 2.6.25-git] gpio: sysfs interface, Trent Piepho, (Tue Apr 29, 2:17 am)
Re: [patch/rfc 2.6.25-git] gpio: sysfs interface, David Brownell, (Tue Apr 29, 6:39 pm)
Re: [patch/rfc 2.6.25-git] gpio: sysfs interface, Ben Nizette, (Tue Apr 29, 12:47 am)
Re: [patch/rfc 2.6.25-git] gpio: sysfs interface, David Brownell, (Tue Apr 29, 5:28 pm)
Re: [patch/rfc 2.6.25-git] gpio: sysfs interface, Andrew Morton, (Mon Apr 28, 4:46 pm)
Re: [patch/rfc 2.6.25-git] gpio: sysfs interface, Pavel Machek, (Fri May 2, 4:36 pm)
Re: [patch/rfc 2.6.25-git] gpio: sysfs interface, David Brownell, (Sat May 17, 6:14 pm)
Re: [patch/rfc 2.6.25-git] gpio: sysfs interface, Pavel Machek, (Mon May 19, 6:39 pm)
Re: [patch/rfc 2.6.25-git] gpio: sysfs interface, David Brownell, (Mon May 19, 9:26 pm)
Re: [patch/rfc 2.6.25-git] gpio: sysfs interface, Pavel Machek, (Tue May 20, 4:02 am)
Re: [patch/rfc 2.6.25-git] gpio: sysfs interface, Ben Nizette, (Sun May 18, 12:55 am)
[patch 2.6.26-rc2-git] gpio: sysfs interface, David Brownell, (Sat May 17, 8:36 pm)
Re: [patch 2.6.26-rc2-git] gpio: sysfs interface, Andrew Morton, (Tue May 20, 3:17 am)
Re: [patch/rfc 2.6.25-git] gpio: sysfs interface, David Brownell, (Mon Apr 28, 7:28 pm)
Re: [patch/rfc 2.6.25-git] gpio: sysfs interface, Andrew Morton, (Mon Apr 28, 10:54 pm)
Re: [patch/rfc 2.6.25-git] gpio: sysfs interface, Greg KH, (Mon Apr 28, 11:42 pm)
Re: [patch/rfc 2.6.25-git] gpio: sysfs interface, David Brownell, (Tue Apr 29, 2:45 pm)
Re: [patch/rfc 2.6.25-git] gpio: sysfs interface, Andrew Morton, (Tue Apr 29, 3:09 pm)
speck-geostationary