On Thu, May 30, 2013 at 4:45 AM, Sathyanarayanan Kuppuswamy <[email protected]> wrote:
> From: Andy Shevchenko <[email protected]> > > To support some (legacy) firmwares and platforms let's make life easier for > their customers. I'd like Grant to have a look at this too, if possible. > Change-Id: I39a0e3e0ed4e04a0d733801f59d46d76189195e8 We don't put Google Gerrit change-IDs into the kernel log. But fun to know you're using it... (...) > +++ b/drivers/gpio/gpiolib-sfi.c > @@ -0,0 +1,76 @@ > +/* > + * SFI helpers for GPIO API Spell out "Simple Firmware Interface helpers..." it's not like everyone knows. > +static struct sfi_gpio_table_entry *sfi_gpio_table; > +static int sfi_gpio_num_entry; > + > +int sfi_get_gpio_by_name(const char *name) > +{ > + struct sfi_gpio_table_entry *pentry = sfi_gpio_table; > + int i; > + > + if (!pentry) > + return -1; Don't you want to return a serious error code? > + > + for (i = 0; i < sfi_gpio_num_entry; i++, pentry++) { > + if (!strncmp(name, pentry->pin_name, SFI_NAME_LEN)) > + return pentry->pin_no; > + } > + > + return -1; Dito. > +} > +EXPORT_SYMBOL_GPL(sfi_get_gpio_by_name); (...) > diff --git a/include/linux/sfi_gpio.h b/include/linux/sfi_gpio.h > new file mode 100644 > index 0000000..ef7e497 > --- /dev/null > +++ b/include/linux/sfi_gpio.h > @@ -0,0 +1,27 @@ > +#ifndef _LINUX_SFI_GPIO_H_ > +#define _LINUX_SFI_GPIO_H_ > + > +#include <linux/errno.h> > +#include <linux/gpio.h> > +#include <linux/sfi.h> > + > +#ifdef CONFIG_GPIO_SFI > + > +int sfi_get_gpio_by_name(const char *name); > +int __init sfi_gpio_init(void); IIRC you do not need to tag things with __init in header files. > + > +#else /* CONFIG_GPIO_SFI */ > + > +static inline int sfi_get_gpio_by_name(const char *name); > +{ > + return -1; Why -1? -ENOTSUPP? Or some other error code? > +} > + > +static inline int __init sfi_gpio_init(void) Do not tag inline functions with __init. Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

