[PATCH] Make MMCI driver compile without gpiolib
From: Russell King - ARM Linux <hidden>
Date: 2009-09-28 20:03:26
On Mon, Sep 28, 2009 at 09:00:01PM +0200, Linus Walleij wrote:
Hm thinking back at this: 2009/9/27 Russell King - ARM Linux [off-list ref]:quoted
The real problem is that U300 doesn't implement gpio_is_valid() - which is part of the GPIO API and not specific to GPIOLIB.None of the GPIO drivers in drivers/gpio implement gpio_is_valid() though they all select GPIOLIB which in turn selects GENERIC_GPIO.
include/asm-generic/gpio.h:
#ifdef CONFIG_GPIOLIB
...
/* Platforms may implement their GPIO interface with library code,
* at a small performance cost for non-inlined operations and some
* extra memory (for code and for per-GPIO table entries).
*
* While the GPIO programming interface defines valid GPIO numbers
* to be in the range 0..MAX_INT, this library restricts them to the
* smaller range 0..ARCH_NR_GPIOS-1.
*/
#ifndef ARCH_NR_GPIOS
#define ARCH_NR_GPIOS 256
#endif
static inline int gpio_is_valid(int number)
{
/* only some non-negative numbers are valid */
return ((unsigned)number) < ARCH_NR_GPIOS;
}
So, with gpiolib enabled, gpio_is_valid() is predefined assuming that
GPIOs between 0..ARCH_NR_GPIOS are valid.