devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] of/gpio: add declaration of struct gpio_chip to silence warning if CONFIG_OF_GPIO=n && CONFIG_GPIOLIB=n
       [not found] ` <201205201639.21378.sfking-xS0NTnu2YfYAvxtiuMwx3w@public.gmane.org>
@ 2012-05-21 10:32   ` Anton Vorontsov
       [not found]     ` <201205210950.59719.sfking@fdwdc.com>
  0 siblings, 1 reply; 2+ messages in thread
From: Anton Vorontsov @ 2012-05-21 10:32 UTC (permalink / raw)
  To: Steven King; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Rob Herring

On Sun, May 20, 2012 at 04:39:21PM -0700, Steven King wrote:
> The stubs for when CONFIG_OF_GPIO =n reference struct gpio_chip.  If
> CONFIG_GPIOLIB=n, the warning 'include/linux/of_gpio.h:83: warning: 'struct
> gpio_chip' declared inside parameter list' is given.  Make it go away.
> 
> Signed-off-by: Steven King <sfking-xS0NTnu2YfYAvxtiuMwx3w@public.gmane.org>
> ---

Hm. We have linux/gpio.h, it should provide 'struct gpio_chip'
stub, so that the code that tries to use generic GPIO would
always work (like of_gpio.h). So, no, this forward-declration
should be provided by linux/gpio.h.

And we do provide it, for GENERIC_GPIO=n case. And it
seems that you have GPIOLIB=n, but GENERIC_GPIO=y? That's
strage. What archictecure is this? Can you tell the exact
kernel version and may be give a config file that you
used to reproduce the warning?

Thanks!

>  include/linux/of_gpio.h |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h
> index 81733d1..5b37613 100644
> --- a/include/linux/of_gpio.h
> +++ b/include/linux/of_gpio.h
> @@ -65,6 +65,8 @@ extern int of_gpio_simple_xlate(struct gpio_chip *gc,
>  
>  #else /* CONFIG_OF_GPIO */
>  
> +struct gpio_chip;
> +
>  /* Drivers may not strictly depend on the GPIO support, so let them link. */
>  static inline int of_get_named_gpio_flags(struct device_node *np,
>  		const char *list_name, int index, enum of_gpio_flags *flags)

-- 
Anton Vorontsov
Email: cbouatmailru-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

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

* Re: [PATCH] of/gpio: add declaration of struct gpio_chip to silence warning if CONFIG_OF_GPIO=n && CONFIG_GPIOLIB=n
       [not found]       ` <201205210950.59719.sfking-xS0NTnu2YfYAvxtiuMwx3w@public.gmane.org>
@ 2012-05-22  0:54         ` Anton Vorontsov
  0 siblings, 0 replies; 2+ messages in thread
From: Anton Vorontsov @ 2012-05-22  0:54 UTC (permalink / raw)
  To: Steven King; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Rob Herring

On Mon, May 21, 2012 at 09:50:59AM -0700, Steven King wrote:
[...]
> The arch is m68knommu (Coldfire).   Currently it has GENERIC_GPIO and 
> ARCH_REQUIRES_GPIOLIB but thats overkill for small, resource constrained 
> systems such as most Coldfire v2 and v3 systems (often 16 megs or less of 
> ram) that don't have any off-chip GPIO, so I was changing it to 
> ARCH_WANTS_OPTIONAL_GPIOLIB.  Which, with the appropriate patches to the 
> Coldfire GPIO code, works fine, one can select GPIOLIB=n and get the smaller 
> footprint for small systems or GPIOLIB=y and get the full implementation for 
> targets with off-chip GPIO -- with the exception of 
> drivers/net/ethernet/freescale/fec.c which gives the warning.

OK, understood. But still, adding the forward-declaration to linux/gpio.h
is preffered, i.e. something along these lines:

diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index 6155ecf..968607e 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -32,6 +32,8 @@ struct gpio {
 	const char	*label;
 };
 
+struct gpio_chip;
+
 #ifdef CONFIG_GENERIC_GPIO
 #include <asm/gpio.h>
 
@@ -43,7 +45,6 @@ struct gpio {
 #include <linux/bug.h>
 
 struct device;
-struct gpio_chip;
 
 static inline bool gpio_is_valid(int number)
 {

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

end of thread, other threads:[~2012-05-22  0:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <201205201639.21378.sfking@fdwdc.com>
     [not found] ` <201205201639.21378.sfking-xS0NTnu2YfYAvxtiuMwx3w@public.gmane.org>
2012-05-21 10:32   ` [PATCH] of/gpio: add declaration of struct gpio_chip to silence warning if CONFIG_OF_GPIO=n && CONFIG_GPIOLIB=n Anton Vorontsov
     [not found]     ` <201205210950.59719.sfking@fdwdc.com>
     [not found]       ` <201205210950.59719.sfking-xS0NTnu2YfYAvxtiuMwx3w@public.gmane.org>
2012-05-22  0:54         ` Anton Vorontsov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).