
On Wednesday, March 26, 2014 at 09:33:01 AM, Ian Campbell wrote:
On Mon, 2014-03-24 at 21:54 +0100, Marek Vasut wrote:
+int sunxi_gpio_set_cfgpin(u32 pin, u32 val); +int sunxi_gpio_get_cfgpin(u32 pin); +int sunxi_gpio_set_drv(u32 pin, u32 val); +int sunxi_gpio_set_pull(u32 pin, u32 val); +int name_to_gpio(const char *name); +#define name_to_gpio name_to_gpio
What is this ugly define doing here ?
common/cmd_gpio.c uses the #ifndef name_to_gpio pattern to provide (or not) a default fallback implementation. I think this is a reasonably (but not very) common idiom for such cases where the non-default variant is not best expressed as a macro.
This should be fixed, the name_to_gpio() there should be replaced by a __weak function. (patch is welcome)
Nonetheless, in your case, please don't do #define FOO FOO, but choose some sensible name for the function.
Best regards, Marek Vasut