login
Header Space

 
 

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

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: David Brownell <david-b@...>
Cc: lkml <linux-kernel@...>, Ben Nizette <bn@...>, hartleys <hartleys@...>, Mike Frysinger <vapier.adi@...>, Bryan Wu <cooloney@...>
Date: Wednesday, April 30, 2008 - 11:41 pm

On Wed, 30 Apr 2008, David Brownell wrote:

So what are these must fix problems?  You don't want all the gpios to appear
in sysfs by default in case there are many.  So have them only appear when
they are requested by something.  Problem solved.

Someone might label the chip with a label using a '/'.  First of all, that's
nothing but speculation on a problem that will probably never happen.  Do any
existing chip labels use a '/'?  Is it really that hard to just not label the
chip that way?  But suppose someone just can't avoid it, one line of code,
that I posted, is all it takes to fix this.

Multiple chips with the same label.  That's more annoying, but still
easy to fix in a number of ways:
1) If the label isn't unique, don't register that chip with sysfs.
2) If the label isn't unique, appended a suffix to make it so.
3) Always add a sequence number the end of the chip label.  This is quite
common in fact.

The sysfs control interface won't be able to handle gpios named this way.  Or
doing so will be "too hard".  Not true, I wrote and posted code that did it. 
It was simpler than the initial code you wrote for the control interface, and
much simpler than the latest with all the gpiochip stuff.  BTW, my code also
worked for unexporting gpio 0....

You say nothing in sysfs works this way, but I don't agree.  Take a look at
/sys/class/net, you have names like "tap0", "eth0", "eth1", "lo", etc.  This
is exactly what I'm saying to do.  The first "eth" gpio chip you register is
appears as eth0 in sysfs, the second as eth1, and so on.

The directories are not just named "netdev0", "netdev1", "netdev2", with some
sort of mapping file telling you ethernet devices are using numbers 2-3.

Look at PCI, you have files like "/sys/bus/pci/devices/0000:01:05.0" and
"/bus/pci/devices/0000:00:0d.2".  It's not "pci1", "pci2", "pci3", with a
"bus0" directory telling you that the bus starts at device 3 and has 6
devices.

Look at ACPI, it's /sys/bus/acpi/devices/{LNXSLPBN:00,LNXPWRBN:00,LNXSYSTM:00}
and "device:00", "device:01".  It uses useful names before the number when
they exist, and just "device" when it doesn't.  This is what I'm saying to do
for gpios.

In fact, what you want - just naming gpios from each device sequentially as
the are dynamically assigned, and then having another set of directories that
allow one to calculate what which one belongs to a given chip - seems to be a
lot harder to find an existing example of.


It's where I started.  You say your system works for everything that matters
and just dismiss the problems I'm solving as irrelevant with a wave of your
hand.  That's very convenient for you, but where does it leave me?


Your worried about the memory usage of some extra sysfs files, but include
python on your device?  IMHO, if you can't do this simple task in 5 minutes
with just busybox, the system is making things too hard.


I seem to be doing it just fine.  I never posted the latest version of my
code since you didn't respond to my April 7th email.


What is the reason to not have the label with gpio in sysfs?


How does seeing the value, direction, and label of a gpio "muck around with
its internal state?"

Of course, one can still change a gpio via /dev/mem or i2c-dev, depending on
the source.  How is being able to do this via sysfs any different?  Yes, the
user could mess the driver up, if they don't know what they are doing.  Just
like there are a hundred other ways to do this via raw device access,
/dev/mem, i2c-dev, and so on.  I guess instead of looking down on everyone and
assuming no one else knows what they are doing and must be protected, I prefer
to assume users aren't idiots, and if they can be trusted with /dev/hda they
can be trusted with gpios in sysfs.
--
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