* [PATCH] gpio: fix build errors for drivers not strictly requiring GPIOs
@ 2008-05-27 14:20 Anton Vorontsov
2008-05-30 3:28 ` David Brownell
0 siblings, 1 reply; 3+ messages in thread
From: Anton Vorontsov @ 2008-05-27 14:20 UTC (permalink / raw)
To: David Brownell; +Cc: linux-kernel
Since commit 7560fa60fcdcdb0da662f6a9fad9064b554ef46c (gpio: <linux/gpio.h>
and "no GPIO support here" stubs) drivers can use GPIOs if they're available,
but don't require them.
This patch actually enables this feature, otherwise drivers will stumble
against this:
include/asm-generic/gpio.h:111: error: redefinition of 'gpio_is_valid'
include/linux/gpio.h:21: error: previous definition of 'gpio_is_valid' was here
include/asm-generic/gpio.h:121: error: redefinition of 'gpio_cansleep'
include/linux/gpio.h:60: error: previous definition of 'gpio_cansleep' was here
include/asm-generic/gpio.h:126: error: redefinition of 'gpio_get_value_cansleep'
include/linux/gpio.h:67: error: previous definition of 'gpio_get_value_cansleep' was here
include/asm-generic/gpio.h:132: error: redefinition of 'gpio_set_value_cansleep'
include/linux/gpio.h:74: error: previous definition of 'gpio_set_value_cansleep' was here
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
include/asm-generic/gpio.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 9c03b71..c9bcbd6 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -105,7 +105,7 @@ extern void __gpio_set_value(unsigned gpio, int value);
extern int __gpio_cansleep(unsigned gpio);
-#else
+#elif defined(CONFIG_GENERIC_GPIO)
static inline int gpio_is_valid(int number)
{
--
1.5.5.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] gpio: fix build errors for drivers not strictly requiring GPIOs
2008-05-27 14:20 [PATCH] gpio: fix build errors for drivers not strictly requiring GPIOs Anton Vorontsov
@ 2008-05-30 3:28 ` David Brownell
2008-05-30 12:06 ` Anton Vorontsov
0 siblings, 1 reply; 3+ messages in thread
From: David Brownell @ 2008-05-30 3:28 UTC (permalink / raw)
To: Anton Vorontsov; +Cc: linux-kernel
On Tuesday 27 May 2008, Anton Vorontsov wrote:
> Since commit 7560fa60fcdcdb0da662f6a9fad9064b554ef46c (gpio: <linux/gpio.h>
> and "no GPIO support here" stubs) drivers can use GPIOs if they're available,
> but don't require them.
>
> This patch actually enables this feature, otherwise drivers will stumble
> against this:
>
> include/asm-generic/gpio.h:111: error: redefinition of 'gpio_is_valid'
> include/linux/gpio.h:21: error: previous definition of 'gpio_is_valid' was here
This looks to me like pure user error ... what was anyone doing
including <asm-generic/gpio.h> in that way? There are a *lot* of
bogus include combinations, and we don't try to "fix" them.
It should suffice to #include <linux/gpio.h> ... that causes the
definition of either (a) stubs in that file, *OR* else (b) the
platform-specific implementation of the GPIO calls, which may
(if that platform chooses) use <asm-generic/gpio.h> utilities.
NAK on this patch.
- dave
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gpio: fix build errors for drivers not strictly requiring GPIOs
2008-05-30 3:28 ` David Brownell
@ 2008-05-30 12:06 ` Anton Vorontsov
0 siblings, 0 replies; 3+ messages in thread
From: Anton Vorontsov @ 2008-05-30 12:06 UTC (permalink / raw)
To: David Brownell; +Cc: linux-kernel
On Thu, May 29, 2008 at 08:28:10PM -0700, David Brownell wrote:
> On Tuesday 27 May 2008, Anton Vorontsov wrote:
> > Since commit 7560fa60fcdcdb0da662f6a9fad9064b554ef46c (gpio: <linux/gpio.h>
> > and "no GPIO support here" stubs) drivers can use GPIOs if they're available,
> > but don't require them.
> >
> > This patch actually enables this feature, otherwise drivers will stumble
> > against this:
> >
> > include/asm-generic/gpio.h:111: error: redefinition of 'gpio_is_valid'
> > include/linux/gpio.h:21: error: previous definition of 'gpio_is_valid' was here
>
> This looks to me like pure user error ... what was anyone doing
> including <asm-generic/gpio.h> in that way? There are a *lot* of
> bogus include combinations, and we don't try to "fix" them.
This is true, partially. I saw these errors for the drivers using
linux/of_gpio.h, it includes asm/gpio.h, which includes
asm-generic/gpio.h (I submitted of_gpio.h patch before linux/gpio.h work,
though git log might say otherwise). And yes, I should fix of_gpio.h too.
The thing is, I always thought that it is _good_ practice for the nested
headers to declare/define things conditionally by themselves. That way
you'll not have to fix all combinations, everything will (should) just
work. I.e.
#include <linux/of_gpio.h>
#include <asm-generic/gpio.h>
#include <asm/gpio.h>
#include <linux/gpio.h>
^^ This insanity will work.
Though with current headers, you'll easily catch the bogus users of
the asm/gpio.h thus will discipline the users, that might be a plus
too... ;-)
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-05-30 12:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-27 14:20 [PATCH] gpio: fix build errors for drivers not strictly requiring GPIOs Anton Vorontsov
2008-05-30 3:28 ` David Brownell
2008-05-30 12:06 ` Anton Vorontsov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox