[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACRpkdbxfL+1NQ73ve8Hz4VKaVMzJS-P7H50kSNVODAU9mm7QA@mail.gmail.com>
Date: Tue, 23 Oct 2012 00:23:49 +0200
From: Linus Walleij <linus.walleij@...aro.org>
To: Mathias Nyman <mathias.nyman@...ux.intel.com>
Cc: linus.walleij@...ricsson.com, grant.likely@...retlab.ca,
linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH] gpiolib: add gpio get direction support
On Mon, Oct 22, 2012 at 3:44 PM, Mathias Nyman
<mathias.nyman@...ux.intel.com> wrote:
> Add gpio_get_direction() for checking the current direction of a gpio.
> Returns 1 for input, 0 for output, or negative error.
> Gpio drivers need to set the gpio_chip .get_direction callback for this
> functionality, otherwise gpio_get_direction() returns error.
OK...
> If the .get_direction callback is set, then gpiolib will use it
> for showing correct gpio direction in sysfs and debug. If not set
> then it will work the old way; e.g. guessing everything is input
> until direction is set.
If the driver cannot report the direction setting you *could*
cache the result of all calls to gpio_direction_output()
and gpio_direction_input() somewhere. But I don't know
if it's a good idea.
Anyway, if the callback is only called internally in the GPIOlib
why are you making the function public to the entire
kernel like this?
> include/asm-generic/gpio.h
> +extern int gpio_get_direction(unsigned gpio);
> include/linux/gpio.h
> +static inline int gpio_get_direction(unsigned gpio)
> +{
> + return -ENOSYS;
> +}
> +
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