Messages in this thread | | | From | Mike Frysinger <> | Date | Fri, 28 Oct 2011 14:15:00 +0200 | Subject | Re: [PATCH] asm-generic/gpio.h: merge basic gpiolib wrappers |
| |
On Thu, Oct 27, 2011 at 15:11, Russell King - ARM Linux wrote: > This is extremely dangerous. Consider for example this code > (see ARM mach-davinci's gpio.h):
it's interesting you highlight davinci. if i'm reading things correctly, the current davinci code is broken today and my v2 proposed patch actually fixes it.
let's see if i have this right: arch/arm/include/asm/gpio.h: ... #include <mach/gpio.h> #ifndef __ARM_GPIOLIB_COMPLEX /* The trivial gpiolib dispatchers */ #define gpio_get_value __gpio_get_value #define gpio_set_value __gpio_set_value #define gpio_cansleep __gpio_cansleep #endif ...
arch/arm/mach-davinci/include/mach/gpio.h: ... #include <asm-generic/gpio.h> ... static inline void gpio_set_value(unsigned gpio, int value) { if (__builtin_constant_p(value) && gpio < davinci_soc_info.gpio_num) { ... do some SoC checking ... } __gpio_set_value(gpio, value); } ... same thing for gpio_get_value and gpio_cansleep ... ...
since the davinci code doesn't define __ARM_GPIOLIB_COMPLEX, the common arm gpio.h will rewrite these few gpio calls to the gpiolib code all the time, and so all the inline funcs in the davinci header always get ignored.
i noticed because when comparing the compiled -mike -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |