Re: [patch 2.6.20-rc1 4/6] PXA GPIO wrappers

David Brownell
2006-12-21T19:25:53Z

On Thursday 21 December 2006 7:03 am, pHilipp Zabel wrote:
> On 12/21/06, Nicolas Pitre <nico@cam.org> wrote:

> +static inline void __gpio_set_value(unsigned gpio, int value)
> +{
> + if (value)
> + GPSR(gpio) = GPIO_bit(gpio);
> + else
> + GPCR(gpio) = GPIO_bit(gpio);
> +}
> +
> +#define gpio_set_value(gpio,value) \
> + (__builtin_constant_p(gpio) ? \

Should that be testing for _both_ gpio and value being constant?
I tend to think it should (assuming nonconstant 'variable' means
this costs more than a function call) ...

> + __gpio_set_value(gpio, value) : \
> + pxa_gpio_set_value(gpio, value))