* [PATCH] gpiolib: Provide a definition of struct gpio for the stub gpiolib @ 2011-10-24 11:27 Mark Brown 2011-10-24 12:01 ` Grant Likely 0 siblings, 1 reply; 5+ messages in thread From: Mark Brown @ 2011-10-24 11:27 UTC (permalink / raw) To: Grant Likely; +Cc: linux-kernel, Mark Brown This makes the stub gpio_request_array() much more usable as drivers can declare struct gpio variables. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> --- include/linux/gpio.h | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/include/linux/gpio.h b/include/linux/gpio.h index 17b5a0d..e885103 100644 --- a/include/linux/gpio.h +++ b/include/linux/gpio.h @@ -24,7 +24,6 @@ #include <linux/errno.h> struct device; -struct gpio; struct gpio_chip; /* @@ -36,6 +35,12 @@ struct gpio_chip; * warning when something is wrongly called. */ +struct gpio { + unsigned gpio; + unsigned long flags; + const char *label; +}; + static inline bool gpio_is_valid(int number) { return false; -- 1.7.6.3 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] gpiolib: Provide a definition of struct gpio for the stub gpiolib 2011-10-24 11:27 [PATCH] gpiolib: Provide a definition of struct gpio for the stub gpiolib Mark Brown @ 2011-10-24 12:01 ` Grant Likely 2011-10-24 12:07 ` Mark Brown 0 siblings, 1 reply; 5+ messages in thread From: Grant Likely @ 2011-10-24 12:01 UTC (permalink / raw) To: Mark Brown; +Cc: Grant Likely, linux-kernel On Mon, Oct 24, 2011 at 01:27:29PM +0200, Mark Brown wrote: > This makes the stub gpio_request_array() much more usable as drivers can > declare struct gpio variables. > > Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Shouldn't this patch remove the definition from include/asm-generic/gpio.h at the same time? g. > --- > include/linux/gpio.h | 7 ++++++- > 1 files changed, 6 insertions(+), 1 deletions(-) > > diff --git a/include/linux/gpio.h b/include/linux/gpio.h > index 17b5a0d..e885103 100644 > --- a/include/linux/gpio.h > +++ b/include/linux/gpio.h > @@ -24,7 +24,6 @@ > #include <linux/errno.h> > > struct device; > -struct gpio; > struct gpio_chip; > > /* > @@ -36,6 +35,12 @@ struct gpio_chip; > * warning when something is wrongly called. > */ > > +struct gpio { > + unsigned gpio; > + unsigned long flags; > + const char *label; > +}; > + > static inline bool gpio_is_valid(int number) > { > return false; > -- > 1.7.6.3 > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gpiolib: Provide a definition of struct gpio for the stub gpiolib 2011-10-24 12:01 ` Grant Likely @ 2011-10-24 12:07 ` Mark Brown 2011-10-24 12:54 ` Grant Likely 0 siblings, 1 reply; 5+ messages in thread From: Mark Brown @ 2011-10-24 12:07 UTC (permalink / raw) To: Grant Likely; +Cc: Grant Likely, linux-kernel On Mon, Oct 24, 2011 at 02:01:20PM +0200, Grant Likely wrote: > On Mon, Oct 24, 2011 at 01:27:29PM +0200, Mark Brown wrote: > > This makes the stub gpio_request_array() much more usable as drivers can > > declare struct gpio variables. > > Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> > Shouldn't this patch remove the definition from > include/asm-generic/gpio.h at the same time? Both the original forward declaration and the new definition are within the !GPIOLIB case of the #defines, it's just a minimal patch moving the undefined forward declaration to a defintion. I didn't want to worry about reading the individual users to figure out if they had separate defintions separately to the work to get them all moved over to gpiolib. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gpiolib: Provide a definition of struct gpio for the stub gpiolib 2011-10-24 12:07 ` Mark Brown @ 2011-10-24 12:54 ` Grant Likely 2011-10-24 13:17 ` Mark Brown 0 siblings, 1 reply; 5+ messages in thread From: Grant Likely @ 2011-10-24 12:54 UTC (permalink / raw) To: Mark Brown; +Cc: Grant Likely, linux-kernel On Mon, Oct 24, 2011 at 02:07:06PM +0200, Mark Brown wrote: > On Mon, Oct 24, 2011 at 02:01:20PM +0200, Grant Likely wrote: > > On Mon, Oct 24, 2011 at 01:27:29PM +0200, Mark Brown wrote: > > > This makes the stub gpio_request_array() much more usable as drivers can > > > declare struct gpio variables. > > > > Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> > > > Shouldn't this patch remove the definition from > > include/asm-generic/gpio.h at the same time? > > Both the original forward declaration and the new definition are within > the !GPIOLIB case of the #defines, it's just a minimal patch moving the > undefined forward declaration to a defintion. I didn't want to worry > about reading the individual users to figure out if they had separate > defintions separately to the work to get them all moved over to gpiolib. I think it's good: $ git grep asm/gpio.h | grep '\.h:' arch/blackfin/include/asm/portmux.h:#include <asm/gpio.h> arch/sh/include/mach-common/mach/magicpanelr2.h:#include <asm/gpio.h> arch/unicore32/include/asm/gpio.h: * linux/arch/unicore32/include/asm/gpio.h include/asm-generic/gpio.h:/* A platform's <asm/gpio.h> code may want to inline the I/O calls when include/linux/gpio.h:#include <asm/gpio.h> $ git grep -e $'struct[ \t]*gpio[^_a-z]' `git grep -l asm/gpio.h` `git grep -l mach/portmux.h` `git grep -l mach/magicpanelr2.h` Documentation/gpio.txt: int gpio_request_array(struct gpio *array, size_t num); Documentation/gpio.txt: void gpio_free_array(struct gpio *array, size_t num); Documentation/gpio.txt:Further more, to ease the claim/release of multiple GPIOs, 'struct gpio' is Documentation/gpio.txt: struct gpio { Documentation/gpio.txt: static struct gpio leds_gpios[] = { include/asm-generic/gpio.h: * struct gpio - a structure describing a GPIO with configuration include/asm-generic/gpio.h:struct gpio { include/asm-generic/gpio.h:extern int gpio_request_array(const struct gpio *array, size_t num); include/asm-generic/gpio.h:extern void gpio_free_array(const struct gpio *array, size_t num); include/linux/gpio.h:struct gpio; include/linux/gpio.h:static inline int gpio_request_array(const struct gpio *array, size_t num) include/linux/gpio.h:static inline void gpio_free_array(const struct gpio *array, size_t num) You'll still need a 'struct gpio;' forward decl in asm-generic/gpio.h, but that's better than having two copies. If you craft the patch, I'll make sure some build coverage testing is performed before merging it. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gpiolib: Provide a definition of struct gpio for the stub gpiolib 2011-10-24 12:54 ` Grant Likely @ 2011-10-24 13:17 ` Mark Brown 0 siblings, 0 replies; 5+ messages in thread From: Mark Brown @ 2011-10-24 13:17 UTC (permalink / raw) To: Grant Likely; +Cc: Grant Likely, linux-kernel On Mon, Oct 24, 2011 at 02:54:49PM +0200, Grant Likely wrote: > You'll still need a 'struct gpio;' forward decl in asm-generic/gpio.h, > but that's better than having two copies. If you craft the patch, > I'll make sure some build coverage testing is performed before merging > it. Actually I don't think we don't need the forward declaration as we can just declare the struct prior to including the asm header. Patch to follow... ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-10-24 13:17 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-10-24 11:27 [PATCH] gpiolib: Provide a definition of struct gpio for the stub gpiolib Mark Brown 2011-10-24 12:01 ` Grant Likely 2011-10-24 12:07 ` Mark Brown 2011-10-24 12:54 ` Grant Likely 2011-10-24 13:17 ` Mark Brown
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.