[PATCH] Introduce VPR200 board.

Marc Reilly marc at cpdesign.com.au
Fri Jan 14 18:50:38 EST 2011


On Friday, January 14, 2011 09:18:20 pm Uwe Kleine-König wrote:
> Hi Wolfram,
> 
> On Fri, Jan 14, 2011 at 11:06:40AM +0100, Wolfram Sang wrote:
> > > And to do it really correct, you need to check for errors returned by
> > > gpio_request and gpio_direction_input.
> > > 
> > > Provided you really need it, I'd do it as follows:
> > > 	int ret;
> > > 	
> > > 	#define setup_for_gpiokey(nr)					\
> > > 	
> > > 		ret = gpio_request(GPIO_BUTTON ## nr, "BUTTON" #nr);	\
> > > 		if (ret)						\
> > > 		
> > > 			return ret;					\
> > > 		
> > > 		ret = gpio_direction_input(GPIO_BUTTON ## nr);		\
> > > 		if (ret)						\
> > > 		
> > > 			return ret;					\
> > > 		
> > > 		gpio_free(GPIO_BUTTON ## nr);
> > > 	
> > > 	setup_for_gpiokey(1);
> > > 	setup_for_gpiokey(2);
> > > 	setup_for_gpiokey(3);
> > > 	setup_for_gpiokey(4);
> > > 	...
> > 
> > I'd think using gpio_request_array() is the better option ;)
> 
> didn't know that one, nice.

Thanks to all for comments on this, but as Uwe and Jamie pointed out, all of 
this is actually taken care of by the driver, so it can all go.

Cheers
Marc




More information about the linux-arm-kernel mailing list