* [PATCH] GPIO: #include <linux/kernel.h> for might_sleep
@ 2008-04-11 8:24 Uwe Kleine-König
2008-04-11 10:46 ` Uwe Kleine-König
2008-04-11 17:05 ` David Brownell
0 siblings, 2 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2008-04-11 8:24 UTC (permalink / raw
To: David Brownell; +Cc: linux-kernel
Signed-off-by: Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
---
Hello David,
I like having headers being independend of the order of inclusion.
Usually I order all includes alphabetically (and grouped by linux/,
asm/, etc.). This doesn't work with gpio.h because then kernel.h is
included to late.
Best regards
Uwe
include/asm-generic/gpio.h | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index f29a502..4fe6207 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -97,6 +97,8 @@ extern int __gpio_cansleep(unsigned gpio);
#else
+#include <linux/kernel.h>
+
/* platforms that don't directly support access to GPIOs through I2C, SPI,
* or other blocking infrastructure can use these wrappers.
*/
--
1.5.4.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] GPIO: #include <linux/kernel.h> for might_sleep
2008-04-11 8:24 [PATCH] GPIO: #include <linux/kernel.h> for might_sleep Uwe Kleine-König
@ 2008-04-11 10:46 ` Uwe Kleine-König
2008-04-11 17:05 ` David Brownell
1 sibling, 0 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2008-04-11 10:46 UTC (permalink / raw
To: David Brownell; +Cc: linux-kernel
Hello again,
Uwe Kleine-König wrote:
> Signed-off-by: Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
> ---
> Hello David,
>
> I like having headers being independend of the order of inclusion.
> Usually I order all includes alphabetically (and grouped by linux/,
> asm/, etc.). This doesn't work with gpio.h because then kernel.h is
> included to late.
I just noticed that you need include/asm/types.h also for the
CONFIG_HAVE_GPIO_LIB=y case. So the #include can better go to the top
of include/asm-generic/gpio.h.
I won't send a new version untill you say if it's OK for you to add
#includes to that header.
Best regards
Uwe
--
Uwe Kleine-König, Software Engineer
Digi International GmbH Branch Breisach, Küferstrasse 8, 79206 Breisach, Germany
Tax: 315/5781/0242 / VAT: DE153662976 / Reg. Amtsgericht Dortmund HRB 13962
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] GPIO: #include <linux/kernel.h> for might_sleep
2008-04-11 8:24 [PATCH] GPIO: #include <linux/kernel.h> for might_sleep Uwe Kleine-König
2008-04-11 10:46 ` Uwe Kleine-König
@ 2008-04-11 17:05 ` David Brownell
2008-04-15 7:36 ` Uwe Kleine-König
1 sibling, 1 reply; 4+ messages in thread
From: David Brownell @ 2008-04-11 17:05 UTC (permalink / raw
To: Uwe Kleine-König; +Cc: linux-kernel
On Friday 11 April 2008, Uwe Kleine-König wrote:
> I like having headers being independend of the order of inclusion.
That's a pretty unusual policy. Not one that's generally
followed in the kernel, either ...
> Usually I order all includes alphabetically (and grouped by linux/,
> asm/, etc.).
If you like alphabetical, why the exception for <asm/...> ??
:)
> This doesn't work with gpio.h because then kernel.h is
> included to late.
So include <linux/kernel.h> first. There *is* a policy
of avoiding extra #includes ... extras slow down builds.
- Dave
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] GPIO: #include <linux/kernel.h> for might_sleep
2008-04-11 17:05 ` David Brownell
@ 2008-04-15 7:36 ` Uwe Kleine-König
0 siblings, 0 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2008-04-15 7:36 UTC (permalink / raw
To: David Brownell; +Cc: linux-kernel
Hello David,
David Brownell wrote:
> On Friday 11 April 2008, Uwe Kleine-König wrote:
> > I like having headers being independend of the order of inclusion.
>
> That's a pretty unusual policy. Not one that's generally
> followed in the kernel, either ...
It's usual for the system headers. IIRC I read that in the SUSV3 spec,
but I cannot find it at the moment.
> > Usually I order all includes alphabetically (and grouped by linux/,
> > asm/, etc.).
>
> If you like alphabetical, why the exception for <asm/...> ??
> :)
>
> > This doesn't work with gpio.h because then kernel.h is
> > included to late.
>
> So include <linux/kernel.h> first. There *is* a policy
> of avoiding extra #includes ... extras slow down builds.
Is it really a slow down if you need <linux/kernel.h> unconditionally?
I thought it's fine to skip #include <header2.h> in header1.h if not all
users of header1.h need header2.h.
If I try to compile a C file that only consists of an include for
<asm-generic/gpio.h> I get the error:
In file included from ...:
include/asm-generic/gpio.h:63: error: expected specifier-qualifier-list before ‘u16’
include/asm-generic/gpio.h:72: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘gpiochip_remove’
Best regards
Uwe
--
Uwe Kleine-König, Software Engineer
Digi International GmbH Branch Breisach, Küferstrasse 8, 79206 Breisach, Germany
Tax: 315/5781/0242 / VAT: DE153662976 / Reg. Amtsgericht Dortmund HRB 13962
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-04-15 7:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-11 8:24 [PATCH] GPIO: #include <linux/kernel.h> for might_sleep Uwe Kleine-König
2008-04-11 10:46 ` Uwe Kleine-König
2008-04-11 17:05 ` David Brownell
2008-04-15 7:36 ` Uwe Kleine-König
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 read-only IMAP folder(s) and NNTP newsgroup(s).