[PATCH] Introduce VPR200 board.

Uwe Kleine-König u.kleine-koenig at pengutronix.de
Fri Jan 14 05:18:20 EST 2011


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.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |



More information about the linux-arm-kernel mailing list