[RFC] Dummy GPIO driver for use with SPI

Anton Vorontsov avorontsov at ru.mvista.com
Wed Dec 17 03:34:28 EST 2008


On Fri, Dec 12, 2008 at 01:39:45PM -0800, Trent Piepho wrote:
> On Fri, 12 Dec 2008, Anton Vorontsov wrote:
> > On Fri, Dec 12, 2008 at 11:59:13AM -0500, Steven A. Falco wrote:
> >> What do you think about having a mechanism to specify that some
> >> SPI slaves have a chip select, while others don't have to have a
> >> chip select managed by the SPI subsystem?
> >
> > Um.. do you know that you can pass '0' as a GPIO?
> >
> > For example,
> >
> > spi-controller {
> > 	gpios = <&pio1 1 0	/* cs0 */
> > 		 0		/* cs1, no GPIO */
> > 		 &pio2 2 0>;	/* cs2 */
> 
> It's ok the that middle specifier is only one word instead of three?  Seems
> like "0 0 0" would be better, so all the specifiers are the same size.
> 
> > 		normal case;
> > 	} else if (gpio == -EEXIST) {
> 
> Isn't EEXIST (pathname already exists) backward?

In my thinking it's "the GPIO is specified (exists in the list), but
it's would be an error if you try to use it". So EEXIST.

> Seems like ENOENT would
> be the right error code.  Except that's used for reading past the end...
> Maybe a reading past the end should be EINVAL or EBADF?
> 
> Or return ENODEV for the 'hole' cell?  Or ENOLINK?

I'd say it's a matter of taste, none of the errors are actually
appropriate. An appropriate errno value would be EHOLEINALIST,
but we don't have it.

Thanks,

-- 
Anton Vorontsov
email: cbouatmailru at gmail.com
irc://irc.freenode.net/bd2



More information about the Linuxppc-dev mailing list