2005-12-21 01:27:53

by Adrian Bunk

[permalink] [raw]
Subject: [RFC: 2.6 patch] include/linux/irq.h: #include <linux/smp.h>

Jan's crosscompile page [1] shows, that one regression in 2.6.15-rc is
that the v850 defconfig does no longer compile.

The compile error is:

<-- snip -->

...
CC arch/v850/kernel/setup.o
In file included from /usr/src/ctest/rc/kernel/arch/v850/kernel/setup.c:17:
/usr/src/ctest/rc/kernel/include/linux/irq.h:13:43: asm/smp.h: No such file or directory
make[2]: *** [arch/v850/kernel/setup.o] Error 1

<-- snip -->


The #include <asm/smp.h> in irq.h was intruduced in 2.6.15-rc.

Since include/linux/irq.h needs code from asm/smp.h only in the
CONFIG_SMP=y case and linux/smp.h #include's asm/smp.h only in the
CONFIG_SMP=y case, I'm suggesting this patch to #include <linux/smp.h>
in irq.h.

I've tested the compilation with both CONFIG_SMP=y and CONFIG_SMP=n
on i386.


Signed-off-by: Adrian Bunk <[email protected]>

--- linux-2.6.15-rc6/include/linux/irq.h.old 2005-12-20 21:45:57.000000000 +0100
+++ linux-2.6.15-rc6/include/linux/irq.h 2005-12-20 21:46:08.000000000 +0100
@@ -10,7 +10,7 @@
*/

#include <linux/config.h>
-#include <asm/smp.h> /* cpu_online_map */
+#include <linux/smp.h>

#if !defined(CONFIG_ARCH_S390)




2005-12-21 10:45:04

by Andrew Morton

[permalink] [raw]
Subject: Re: [RFC: 2.6 patch] include/linux/irq.h: #include <linux/smp.h>

Adrian Bunk <[email protected]> wrote:
>
> The #include <asm/smp.h> in irq.h was intruduced in 2.6.15-rc.
>
> Since include/linux/irq.h needs code from asm/smp.h only in the
> CONFIG_SMP=y case and linux/smp.h #include's asm/smp.h only in the
> CONFIG_SMP=y case, I'm suggesting this patch to #include <linux/smp.h>
> in irq.h.
>
> I've tested the compilation with both CONFIG_SMP=y and CONFIG_SMP=n
> on i386.
>
>
> Signed-off-by: Adrian Bunk <[email protected]>
>
> --- linux-2.6.15-rc6/include/linux/irq.h.old 2005-12-20 21:45:57.000000000 +0100
> +++ linux-2.6.15-rc6/include/linux/irq.h 2005-12-20 21:46:08.000000000 +0100
> @@ -10,7 +10,7 @@
> */
>
> #include <linux/config.h>
> -#include <asm/smp.h> /* cpu_online_map */
> +#include <linux/smp.h>
>
> #if !defined(CONFIG_ARCH_S390)

Yes, it's basically always wrong to include asm/foo.h when linux/foo.h
exists.

2005-12-21 11:04:30

by Russell King

[permalink] [raw]
Subject: Re: [RFC: 2.6 patch] include/linux/irq.h: #include <linux/smp.h>

On Wed, Dec 21, 2005 at 02:41:33AM -0800, Andrew Morton wrote:
> Yes, it's basically always wrong to include asm/foo.h when linux/foo.h
> exists.

There's always an exception to every rule. linux/irq.h is that
exception for the above rule.

--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core

2005-12-21 21:33:23

by Adrian Bunk

[permalink] [raw]
Subject: Re: [RFC: 2.6 patch] include/linux/irq.h: #include <linux/smp.h>

On Wed, Dec 21, 2005 at 11:04:22AM +0000, Russell King wrote:
> On Wed, Dec 21, 2005 at 02:41:33AM -0800, Andrew Morton wrote:
> > Yes, it's basically always wrong to include asm/foo.h when linux/foo.h
> > exists.
>
> There's always an exception to every rule. linux/irq.h is that
> exception for the above rule.

Why?

> Russell King

cu
Adrian

--

"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed

2005-12-21 21:48:13

by Russell King

[permalink] [raw]
Subject: Re: [RFC: 2.6 patch] include/linux/irq.h: #include <linux/smp.h>

On Wed, Dec 21, 2005 at 10:33:21PM +0100, Adrian Bunk wrote:
> On Wed, Dec 21, 2005 at 11:04:22AM +0000, Russell King wrote:
> > On Wed, Dec 21, 2005 at 02:41:33AM -0800, Andrew Morton wrote:
> > > Yes, it's basically always wrong to include asm/foo.h when linux/foo.h
> > > exists.
> >
> > There's always an exception to every rule. linux/irq.h is that
> > exception for the above rule.
>
> Why?

/*
* Please do not include this file in generic code. There is currently
* no requirement for any architecture to implement anything held
* within this file.
*
* Thanks. --rmk
*/

Using linux/irq.h instead of asm/irq.h _breaks_ architectures
which do not use the generic irq code.

Basically, linux/irq.h should have been called asm-generic/irq.h.

--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core

2005-12-21 22:11:18

by Adrian Bunk

[permalink] [raw]
Subject: Re: [RFC: 2.6 patch] include/linux/irq.h: #include <linux/smp.h>

On Wed, Dec 21, 2005 at 09:48:06PM +0000, Russell King wrote:
> On Wed, Dec 21, 2005 at 10:33:21PM +0100, Adrian Bunk wrote:
> > On Wed, Dec 21, 2005 at 11:04:22AM +0000, Russell King wrote:
> > > On Wed, Dec 21, 2005 at 02:41:33AM -0800, Andrew Morton wrote:
> > > > Yes, it's basically always wrong to include asm/foo.h when linux/foo.h
> > > > exists.
> > >
> > > There's always an exception to every rule. linux/irq.h is that
> > > exception for the above rule.
> >
> > Why?
>
> /*
> * Please do not include this file in generic code. There is currently
> * no requirement for any architecture to implement anything held
> * within this file.
> *
> * Thanks. --rmk
> */
>
> Using linux/irq.h instead of asm/irq.h _breaks_ architectures
> which do not use the generic irq code.
>
> Basically, linux/irq.h should have been called asm-generic/irq.h.

I'm not getting your point.

The patch we are discussing is:

--- linux-2.6.15-rc6/include/linux/irq.h.old 2005-12-20 21:45:57.000000000 +0100
+++ linux-2.6.15-rc6/include/linux/irq.h 2005-12-20 21:46:08.000000000 +0100
@@ -10,7 +10,7 @@
*/

#include <linux/config.h>
-#include <asm/smp.h> /* cpu_online_map */
+#include <linux/smp.h>



> Russell King

cu
Adrian

--

"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed

2005-12-21 22:21:41

by Russell King

[permalink] [raw]
Subject: Re: [RFC: 2.6 patch] include/linux/irq.h: #include <linux/smp.h>

On Wed, Dec 21, 2005 at 11:11:14PM +0100, Adrian Bunk wrote:
> On Wed, Dec 21, 2005 at 09:48:06PM +0000, Russell King wrote:
> > On Wed, Dec 21, 2005 at 10:33:21PM +0100, Adrian Bunk wrote:
> > > On Wed, Dec 21, 2005 at 11:04:22AM +0000, Russell King wrote:
> > > > On Wed, Dec 21, 2005 at 02:41:33AM -0800, Andrew Morton wrote:
> > > > > Yes, it's basically always wrong to include asm/foo.h when linux/foo.h
> > > > > exists.
> > > >
> > > > There's always an exception to every rule. linux/irq.h is that
> > > > exception for the above rule.
> > >
> > > Why?
> >
> > /*
> > * Please do not include this file in generic code. There is currently
> > * no requirement for any architecture to implement anything held
> > * within this file.
> > *
> > * Thanks. --rmk
> > */
> >
> > Using linux/irq.h instead of asm/irq.h _breaks_ architectures
> > which do not use the generic irq code.
> >
> > Basically, linux/irq.h should have been called asm-generic/irq.h.
>
> I'm not getting your point.

The point is _exactly_ as the above quotation between Andrew Morton
and myself. I'm sure it's not me being thick because it's absolutely
damned obvious from the above.

Andrew said: "Yes, it's basically always wrong to include asm/foo.h
when linux/foo.h exists."

That statement is a rule. I assert that this is an incorrect statement
and I assert that there is a proven case where this statement is incorrect.

Hence, to avoid people reading Andrew's misleading statement, I followed
up on precisely _that_ point and _that_ point alone.

--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core

2005-12-21 22:33:31

by Adrian Bunk

[permalink] [raw]
Subject: Re: [RFC: 2.6 patch] include/linux/irq.h: #include <linux/smp.h>

On Wed, Dec 21, 2005 at 10:21:31PM +0000, Russell King wrote:
>
> The point is _exactly_ as the above quotation between Andrew Morton
> and myself. I'm sure it's not me being thick because it's absolutely
> damned obvious from the above.
>
> Andrew said: "Yes, it's basically always wrong to include asm/foo.h
> when linux/foo.h exists."
>
> That statement is a rule. I assert that this is an incorrect statement
> and I assert that there is a proven case where this statement is incorrect.
>
> Hence, to avoid people reading Andrew's misleading statement, I followed
> up on precisely _that_ point and _that_ point alone.

OK, now I got it:

You are arguing only against Andrew's statement of a general rule,
not against my patch.

Sorry for my misunderstading.

> Russell King

cu
Adrian

--

"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed