public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Mike Frysinger <vapier@gentoo.org>
Cc: Arnd Bergmann <arnd@arndb.de>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] asm-generic/gpio.h: add some forward decls of the device struct
Date: Wed, 16 Dec 2009 14:30:32 -0800	[thread overview]
Message-ID: <20091216143032.b01644b0.akpm@linux-foundation.org> (raw)
In-Reply-To: <1260359619-15618-1-git-send-email-vapier@gentoo.org>

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.

      reply	other threads:[~2009-12-16 22:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091216143032.b01644b0.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vapier@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox