lkml.org 
[lkml]   [2010]   [Aug]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] gpiolib: Add 'struct gpio_chip' forward declaration for !GPIOLIB case
On Tue, Aug 31, 2010 at 02:03:44AM -0600, Grant Likely wrote:
> On Tue, Aug 24, 2010 at 01:26:23PM +0400, Anton Vorontsov wrote:
> > With CONFIG_GPIOLIB=n, the 'struct gpio_chip' is not declared,
> > so the following pops up on PowerPC:
> >
> > cc1: warnings being treated as errors
> > In file included from arch/powerpc/platforms/52xx/mpc52xx_common.c:19:
> > include/linux/of_gpio.h:74: warning: 'struct gpio_chip' declared
> > inside parameter list
> > include/linux/of_gpio.h:74: warning: its scope is only this definition
> > or declaration, which is probably not what
> > you want
> > include/linux/of_gpio.h:75: warning: 'struct gpio_chip' declared
> > inside parameter list
> > make[2]: *** [arch/powerpc/platforms/52xx/mpc52xx_common.o] Error 1
> >
> > This patch fixes the issue by providing the proper forward declaration.
> >
> > Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
>
> This doesn't actually solve the problem, and gpiochip should
> remain undefined when CONFIG_GPIOLIB=n to catch exactly these
> build failures. The real problem is that I merged a change
> into the mpc5200 code that required CONFIG_GPIOLIB be enabled
> without reflecting that requirement in Kconfig.

No, look closer. The error is in of_gpio.h, and it's perfectly
fine to include it w/o GPIOLIB=y.

> > ---
> >
> > On Tue, Aug 24, 2010 at 04:26:08PM +1000, Benjamin Herrenschmidt wrote:
> > > I get that with my current stuff:
> > >
> > > cc1: warnings being treated as errors
> > > In file included from [..]/mpc52xx_common.c:19:
> > > of_gpio.h:74: error: ‘struct gpio_chip’ declared inside parameter list
> > [...]
> > > make[3]: *** Waiting for unfinished jobs....
> >
> > That's because with GPIOCHIP=n no one declares struct gpio_chip.
> >
> > It should be either of_gpio.h or gpio.h. Let's make it gpio.h, as
> > this feels more generic, and we already have some !GPIOLIB handling
> > in there.
> >
> > include/linux/gpio.h | 6 ++++++
> > 1 files changed, 6 insertions(+), 0 deletions(-)
> >
> > diff --git a/include/linux/gpio.h b/include/linux/gpio.h
> > index 03f616b..85207d2 100644
> > --- a/include/linux/gpio.h
> > +++ b/include/linux/gpio.h
> > @@ -15,6 +15,12 @@
> > struct device;
> >
> > /*
> > + * Some code might rely on the declaration. Still, it is illegal
> > + * to dereference it for !GPIOLIB case.
> > + */
> > +struct gpio_chip;
> > +
> > +/*
> > * Some platforms don't support the GPIO programming interface.
> > *
> > * In case some driver uses it anyway (it should normally have
> > --
> > 1.7.0.5
> >

--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2010-08-31 10:39    [W:1.315 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site