Skip to contentSkip to conversation

asm-generic/gpio.h: add some forward decls of the device struct

PATCH In review Mike Frysinger 2 participants 2 messages Dec 9, 2009 – Dec 16, 2009 Generic include/asm header files

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 asm-generic/gpio.h: add some forward decls of the device struct

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.

---
 include/asm-generic/gpio.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
include/asm-generic/gpio.h +3 -0
index 66d6106..204bed3 100644
@@ -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)
Signature · 1 line
1.6.5.5
#1 lore raw
Quoted 30 lines · On Wed, 9 Dec 2009 06:53:39 -0500 Mike Frysinger <[email protected]> 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.

---
 include/asm-generic/gpio.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
include/asm-generic/gpio.h +1 -0
index 66d6106..204bed3 100644
@@ -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;
 

include/asm-generic/gpio.h static inline void gpio_set_value_cansleep(unsigned gpio, int value) · line 189

Quoted 8 lines
include/asm-generic/gpio.h +2 -0
@@ -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.