[PATCH v6] PPC440EPx gpio driver

David Brownell david-b at pacbell.net
Fri Oct 10 11:12:41 EST 2008


On Thursday 09 October 2008, Anton Vorontsov wrote:
> 
> > I've incorporated the other changes, with one exception.  I want
> > ppc4xx_gpio_get() to return 0 or 1 (rather than Anton's comment that any
> > non-zero value is ok), because when you use the new "export feature" in
> > sysfs, you see the raw value returned from ppc4xx_gpio_get().  So, without
> > the !!  in the return statement, you would see a strange value, like 32768
> > instead of 1:
> > 
> >       # cd gpio208
> >       # cat value
> >       32768
> > 
> > So, I think it is worth sanitizing the return value here.
> 
> I think that nonzero == high assumption is also ok for the userspace.

Actually, I was thinking that userspace might be happier
not having to deal with that ... so that's worth changing
in the sysfs glue.  I'd sign off on a patch fixing that.

I seem to recall seeing an explicit policy saying sysfs
exports booleans as 0/1, at some point, though I can't
find it just now.

- Dave




More information about the Linuxppc-dev mailing list