Messages in this thread | | | Date | Fri, 26 Feb 2010 18:39:44 -0500 | From | Andres Salomon <> | Subject | Re: [PATCH 1/3] gpiolib: add gpio_set_direction() |
| |
On Fri, 26 Feb 2010 17:26:24 -0600 Ben Gardner <gardner.ben@gmail.com> wrote:
> Combine gpio_direction_input() and gpio_direction_output() into > gpio_set_direction(). > Add 'none' and 'inout' directions to the sysfs interface. > > Signed-off-by: Ben Gardner <gardner.ben@gmail.com> > CC: Andres Salomon <dilinger@collabora.co.uk> > CC: Andrew Morton <akpm@linux-foundation.org> > CC: David Brownell <dbrownell@users.sourceforge.net> > CC: Jani Nikula <ext-jani.1.nikula@nokia.com> > --- > drivers/gpio/gpiolib.c | 123 ++++++++++++++++++++++---------------------- > include/asm-generic/gpio.h | 6 ++ > include/linux/gpio.h | 5 ++ > 3 files changed, 73 insertions(+), 61 deletions(-) > [...] > diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h > index 485eeb6..17c7642 100644 > --- a/include/asm-generic/gpio.h > +++ b/include/asm-generic/gpio.h > @@ -41,6 +41,8 @@ struct module; > * enabling module power and clock; may sleep > * @free: optional hook for chip-specific deactivation, such as > * disabling module power and clock; may sleep > + * @set_direction: configures signal "offset" as "direction" (0-3, bit0=input, > + * bit1=output) or returns error
How about something like the following for set_direction, so we're not comparing magic bits?
/* gpio direction flags */ #define GPIO_DIR_NONE 0 #define GPIO_DIR_INPUT (1 << 0) #define GPIO_DIR_OUTPUT (1 << 1)
| |