Web lists-archives.org

Re: [PATCH soc-camera] Replace NO_GPIO with gpio_is_valid()




On Fri, 15 Feb 2008, Trent Piepho wrote:

> On Fri, 15 Feb 2008, Guennadi Liakhovetski wrote:
> > Upon suggestion by David Brownell use a gpio_is_valid() predicate
> > instead of an explicit NO_GPIO macro. The respective patch to
> > include/asm-generic/gpio.h has been accepted upstream.
> >
> >  #else
> > -	mt9m001->switch_gpio = NO_GPIO;
> > +	mt9m001->switch_gpio = -EINVAL;
> >  #endif
> 
> Is that part right?

Yes, it is right. NO_GPIO was never accepted.

> I thought there would still be a NO_GPIO value for
> when you wanted to set or return an invalid gpio number.  gpio_is_valid()
> is a predicate so it doesn't help you create a gpio number that isn't valid
> (other than something absurd like testing all unsigned ints for one that
> fails), one still needs NO_GPIO or something like it.  Using NO_GPIO seems
> like a better idea that hoping that -EINVAL happens to be invalid on every
> platform.

Well, as you know, that was also my idea at the beginning, until David 
persuaded me otherwise:-) The thing is, an invalid gpio definition is not 
platform-specific, it is a part of the API.

Thanks
Guennadi
---
Guennadi Liakhovetski

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list