public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] asm-generic/gpio.h: add some forward decls of the device struct
@ 2009-12-09 11:53 Mike Frysinger
  2009-12-16 22:30 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Frysinger @ 2009-12-09 11:53 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: linux-kernel

After the recent commit a4177ee7f, attempting to include asm-generic/gpio.h
in otherwise "slim" code results in ugly warnings like so:

  CC      arch/blackfin/kernel/bfin_gpio.o
In file included from arch/blackfin/include/asm/gpio.h:278,
                 from arch/blackfin/kernel/bfin_gpio.c:15:
include/asm-generic/gpio.h:193: warning:
‘struct device’ declared inside parameter list
its scope is only this definition or declaration, which is probably not what you want

So add simple C forward decls of the struct device to avoid these.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 include/asm-generic/gpio.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 66d6106..204bed3 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -28,6 +28,7 @@ static inline int gpio_is_valid(int number)
 	return ((unsigned)number) < ARCH_NR_GPIOS;
 }
 
+struct device;
 struct seq_file;
 struct module;
 
@@ -181,6 +182,8 @@ static inline void gpio_set_value_cansleep(unsigned gpio, int value)
 
 #ifndef CONFIG_GPIO_SYSFS
 
+struct device;
+
 /* sysfs support is only available with gpiolib, where it's optional */
 
 static inline int gpio_export(unsigned gpio, bool direction_may_change)
-- 
1.6.5.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] asm-generic/gpio.h: add some forward decls of the device struct
  2009-12-09 11:53 [PATCH] asm-generic/gpio.h: add some forward decls of the device struct Mike Frysinger
@ 2009-12-16 22:30 ` Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2009-12-16 22:30 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: Arnd Bergmann, linux-kernel

On Wed,  9 Dec 2009 06:53:39 -0500
Mike Frysinger <vapier@gentoo.org> wrote:

> After the recent commit a4177ee7f, attempting to include asm-generic/gpio.h
> in otherwise "slim" code results in ugly warnings like so:
> 
>   CC      arch/blackfin/kernel/bfin_gpio.o
> In file included from arch/blackfin/include/asm/gpio.h:278,
>                  from arch/blackfin/kernel/bfin_gpio.c:15:
> include/asm-generic/gpio.h:193: warning:
> ___struct device___ declared inside parameter list
> its scope is only this definition or declaration, which is probably not what you want
> 
> So add simple C forward decls of the struct device to avoid these.
> 
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
>  include/asm-generic/gpio.h |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
> index 66d6106..204bed3 100644
> --- a/include/asm-generic/gpio.h
> +++ b/include/asm-generic/gpio.h
> @@ -28,6 +28,7 @@ static inline int gpio_is_valid(int number)
>  	return ((unsigned)number) < ARCH_NR_GPIOS;
>  }
>  
> +struct device;
>  struct seq_file;
>  struct module;
>  
> @@ -181,6 +182,8 @@ static inline void gpio_set_value_cansleep(unsigned gpio, int value)
>  
>  #ifndef CONFIG_GPIO_SYSFS
>  
> +struct device;
> +
>  /* sysfs support is only available with gpiolib, where it's optional */
>  
>  static inline int gpio_export(unsigned gpio, bool direction_may_change)

There was no need to add duplicated forward declarations.  Just move
them all to the top, outside ifdefs.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-12-16 22:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-09 11:53 [PATCH] asm-generic/gpio.h: add some forward decls of the device struct Mike Frysinger
2009-12-16 22:30 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox