[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACRpkdZbCytqaWTK7HvfU2aMpPQVZWX2uf-NXL-rUPGJ6DQ-mQ@mail.gmail.com>
Date: Thu, 30 May 2013 20:44:17 +0200
From: Linus Walleij <linus.walleij@...aro.org>
To: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@...el.com>,
Grant Likely <grant.likely@...retlab.ca>
Cc: x86@...nel.org, Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>, Len Brown <lenb@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
mark.gross@...el.com, len.brown@...el.com,
David Cohen <david.a.cohen@...el.com>, fei.yang@...el.com,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Subject: Re: [PATCH v1 12/13] gpiolib: append SFI helpers for GPIO API
On Thu, May 30, 2013 at 4:45 AM, Sathyanarayanan Kuppuswamy
<sathyanarayanan.kuppuswamy@...el.com> wrote:
> From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
>
> 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 majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists