net: sunhme: move asm includes to below linux includes
Simon Horman
reviewerPATCH 1/1 net: sunhme: move asm includes to below linux includes
A recent rearrangement of includes has lead to a problem on m68k as flagged by the kernel test robot.
Resolve this by moving the block asm includes to below linux includes. A side effect i that non-Sparc asm includes are now immediately before Sparc asm includes, which seems nice.
Using sparse v0.6.4 I was able to reproduce this problem as follows using the config provided by the kernel test robot:
$ wget https://download.01.org/0day-ci/archive/20230404/[email protected]/config $ cp config .config $ make ARCH=m68k oldconfig $ make ARCH=m68k C=2 M=drivers/net/ethernet/sun CC [M] drivers/net/ethernet/sun/sunhme.o In file included from drivers/net/ethernet/sun/sunhme.c:19: ./arch/m68k/include/asm/irq.h:78:11: error: expected ‘;’ before ‘void’ 78 | asmlinkage void do_IRQ(int irq, struct pt_regs *regs); | ^~~~~ | ; ./arch/m68k/include/asm/irq.h:78:40: warning: ‘struct pt_regs’ declared inside parameter list will not be visible outside of this definition or declaration 78 | asmlinkage void do_IRQ(int irq, struct pt_regs *regs); | ^~~~~~~
Compile tested only.
--- drivers/net/ethernet/sun/sunhme.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/ethernet/sun/sunhme.c +4 -3
@@ -14,9 +14,6 @@* argument : macaddr=0x00,0x10,0x20,0x30,0x40,0x50 */ -#include <asm/byteorder.h> -#include <asm/dma.h> -#include <asm/irq.h> #include <linux/bitops.h> #include <linux/crc32.h> #include <linux/delay.h>
@@ -45,6 +42,10 @@#include <linux/types.h> #include <linux/uaccess.h> +#include <asm/byteorder.h> +#include <asm/dma.h> +#include <asm/irq.h> +#ifdef CONFIG_SPARC #include <asm/auxio.h> #include <asm/idprom.h>
Sean Anderson
maintainerQuoted 10 lines · Simon Horman
A recent rearrangement of includes has lead to a problem on m68k as flagged by the kernel test robot.
Resolve this by moving the block asm includes to below linux includes. A side effect i that non-Sparc asm includes are now immediately before Sparc asm includes, which seems nice.
Using sparse v0.6.4 I was able to reproduce this problem as follows using the config provided by the kernel test robot:
Quoted 13 lines
$ wget https://download.01.org/0day-ci/archive/20230404/[email protected]/config $ cp config .config $ make ARCH=m68k oldconfig $ make ARCH=m68k C=2 M=drivers/net/ethernet/sun CC [M] drivers/net/ethernet/sun/sunhme.o In file included from drivers/net/ethernet/sun/sunhme.c:19: ./arch/m68k/include/asm/irq.h:78:11: error: expected ‘;’ before ‘void’ 78 | asmlinkage void do_IRQ(int irq, struct pt_regs *regs); | ^~~~~ | ; ./arch/m68k/include/asm/irq.h:78:40: warning: ‘struct pt_regs’ declared inside parameter list will not be visible outside of this definition or declaration 78 | asmlinkage void do_IRQ(int irq, struct pt_regs *regs); | ^~~~~~~
This seems like a problem with the header. m68k's asm/irq.h should include linux/interrupt.h before its declarations.
--Sean
Quoted 36 lines
Compile tested only.
Fixes 1ff4f42aef60 ("net: sunhme: Alphabetize includes")Reported-by kernel test robot <[email protected]>Signed-off-by Simon Horman <[email protected]>--- drivers/net/ethernet/sun/sunhme.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/net/ethernet/sun/sunhme.c +4
-3@@ -14,9 +14,6 @@* argument : macaddr=0x00,0x10,0x20,0x30,0x40,0x50 */ -#include <asm/byteorder.h> -#include <asm/dma.h> -#include <asm/irq.h> #include <linux/bitops.h> #include <linux/crc32.h> #include <linux/delay.h> @@ -45,6 +42,10 @@#include <linux/types.h> #include <linux/uaccess.h> +#include <asm/byteorder.h> +#include <asm/dma.h> +#include <asm/irq.h> +#ifdef CONFIG_SPARC #include <asm/auxio.h> #include <asm/idprom.h>
Simon Horman
reviewerQuoted 25 lines · Sean Anderson
Quoted 10 lines · Simon Horman
A recent rearrangement of includes has lead to a problem on m68k as flagged by the kernel test robot.
Resolve this by moving the block asm includes to below linux includes. A side effect i that non-Sparc asm includes are now immediately before Sparc asm includes, which seems nice.
Using sparse v0.6.4 I was able to reproduce this problem as follows using the config provided by the kernel test robot:
Quoted 13 lines
$ wget https://download.01.org/0day-ci/archive/20230404/[email protected]/config $ cp config .config $ make ARCH=m68k oldconfig $ make ARCH=m68k C=2 M=drivers/net/ethernet/sun CC [M] drivers/net/ethernet/sun/sunhme.o In file included from drivers/net/ethernet/sun/sunhme.c:19: ./arch/m68k/include/asm/irq.h:78:11: error: expected ‘;’ before ‘void’ 78 | asmlinkage void do_IRQ(int irq, struct pt_regs *regs); | ^~~~~ | ; ./arch/m68k/include/asm/irq.h:78:40: warning: ‘struct pt_regs’ declared inside parameter list will not be visible outside of this definition or declaration 78 | asmlinkage void do_IRQ(int irq, struct pt_regs *regs); | ^~~~~~~
Quoted 1 line
This seems like a problem with the header. m68k's
asm/irq.hshould includelinux/interrupt.hbefore its declarations.
Hi Sean,
I do see your point. But TBH I'm unsure which way to go on this one. Geert, do you have any input?
Quoted 37 lines
--Sean
Quoted 34 lines
Compile tested only.
Fixes 1ff4f42aef60 ("net: sunhme: Alphabetize includes")Reported-by kernel test robot <[email protected]>Signed-off-by Simon Horman <[email protected]>--- drivers/net/ethernet/sun/sunhme.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/net/ethernet/sun/sunhme.c +4
-3@@ -14,9 +14,6 @@* argument : macaddr=0x00,0x10,0x20,0x30,0x40,0x50 */ -#include <asm/byteorder.h> -#include <asm/dma.h> -#include <asm/irq.h> #include <linux/bitops.h> #include <linux/crc32.h> #include <linux/delay.h> @@ -45,6 +42,10 @@#include <linux/types.h> #include <linux/uaccess.h> +#include <asm/byteorder.h> +#include <asm/dma.h> +#include <asm/irq.h> +#ifdef CONFIG_SPARC #include <asm/auxio.h> #include <asm/idprom.h>
Quoted 26 lines · Simon Horman
Quoted 25 lines · Sean Anderson
Quoted 23 lines · Simon Horman
A recent rearrangement of includes has lead to a problem on m68k as flagged by the kernel test robot.
Resolve this by moving the block asm includes to below linux includes. A side effect i that non-Sparc asm includes are now immediately before Sparc asm includes, which seems nice.
Using sparse v0.6.4 I was able to reproduce this problem as follows using the config provided by the kernel test robot:
$ wget https://download.01.org/0day-ci/archive/20230404/[email protected]/config $ cp config .config $ make ARCH=m68k oldconfig $ make ARCH=m68k C=2 M=drivers/net/ethernet/sun CC [M] drivers/net/ethernet/sun/sunhme.o In file included from drivers/net/ethernet/sun/sunhme.c:19: ./arch/m68k/include/asm/irq.h:78:11: error: expected ‘;’ before ‘void’ 78 | asmlinkage void do_IRQ(int irq, struct pt_regs *regs); | ^~~~~ | ; ./arch/m68k/include/asm/irq.h:78:40: warning: ‘struct pt_regs’ declared inside parameter list will not be visible outside of this definition or declaration 78 | asmlinkage void do_IRQ(int irq, struct pt_regs *regs); | ^~~~~~~
Quoted 6 lines
Quoted 1 line
This seems like a problem with the header. m68k's
asm/irq.hshould includelinux/interrupt.hbefore its declarations.Hi Sean,
I do see your point. But TBH I'm unsure which way to go on this one. Geert, do you have any input?
We always include linux/* headers before asm/*. The "sorting" of headers in this way was inappropriate.
Sean Anderson
maintainerQuoted 29 lines · Matthew Wilcox
Quoted 28 lines · Simon Horman
Quoted 26 lines · Sean Anderson
Quoted 10 lines · Simon Horman
A recent rearrangement of includes has lead to a problem on m68k as flagged by the kernel test robot.
Resolve this by moving the block asm includes to below linux includes. A side effect i that non-Sparc asm includes are now immediately before Sparc asm includes, which seems nice.
Using sparse v0.6.4 I was able to reproduce this problem as follows using the config provided by the kernel test robot:
Quoted 13 lines
$ wget https://download.01.org/0day-ci/archive/20230404/[email protected]/config $ cp config .config $ make ARCH=m68k oldconfig $ make ARCH=m68k C=2 M=drivers/net/ethernet/sun CC [M] drivers/net/ethernet/sun/sunhme.o In file included from drivers/net/ethernet/sun/sunhme.c:19: ./arch/m68k/include/asm/irq.h:78:11: error: expected ‘;’ before ‘void’ 78 | asmlinkage void do_IRQ(int irq, struct pt_regs *regs); | ^~~~~ | ; ./arch/m68k/include/asm/irq.h:78:40: warning: ‘struct pt_regs’ declared inside parameter list will not be visible outside of this definition or declaration 78 | asmlinkage void do_IRQ(int irq, struct pt_regs *regs); | ^~~~~~~This seems like a problem with the header. m68k's
asm/irq.hshould includelinux/interrupt.hbefore its declarations.
Quoted 7 lines
Quoted 4 lines
Hi Sean,
I do see your point. But TBH I'm unsure which way to go on this one. Geert, do you have any input?
We always include linux/* headers before asm/*. The "sorting" of headers in this way was inappropriate.
Is this written down anywhere? I couldn't find it in Documentation/process...
--Sean
Quoted 5 lines · Sean Anderson
Quoted 2 lines · Matthew Wilcox
We always include linux/* headers before asm/*. The "sorting" of headers in this way was inappropriate.
Is this written down anywhere? I couldn't find it in
Documentation/process...
Feel free to send a patch. Generally, it should be:
#include <linux/foo.h>
#include <linux/bar.h>
#include <asm/baz.h>
#include <asm/quux.h>
#include "local.h"
Some drivers do this a different way with a single local.h that includes all necessary includes.
Also if <linux/foo.h> and <asm/foo.h> both exist, you should include <linux/foo.h> (which almost certainly includes <asm/foo.h>)
Jakub Kicinski
maintainerQuoted 8 lines · On Wed, 5 Apr 2023 19:34:38 +0100 Matthew Wilcox wrote:
Quoted 5 lines · Sean Anderson
Quoted 2 lines · Matthew Wilcox
We always include linux/* headers before asm/*. The "sorting" of headers in this way was inappropriate.
Is this written down anywhere? I couldn't find it in
Documentation/process...Feel free to send a patch.
Patch to documentation, checkpatch or both :)
Hi Willy,
Quoted 15 lines · Matthew Wilcox
Quoted 5 lines · Sean Anderson
Quoted 2 lines · Matthew Wilcox
We always include linux/* headers before asm/*. The "sorting" of headers in this way was inappropriate.
Is this written down anywhere? I couldn't find it in
Documentation/process...Feel free to send a patch. Generally, it should be:
#include <
linux/foo.h>
#include <linux/bar.h>#include <
asm/baz.h>
#include <asm/quux.h>
Quoted 7 lines
#include "
local.h"Some drivers do this a different way with a single
local.hthat includes all necessary includes.Also if <
linux/foo.h> and <asm/foo.h> both exist, you should include <linux/foo.h> (which almost certainly includes <asm/foo.h>)
Indeed. Usually <asm/foo.h> should not be included directly, except for a few exceptions like <asm/irq.h>.
Witness e.g. the (violated a lot) comment at the top of include/linux/irq.h:
/*
* 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
*/
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Wed, 05 Apr 2023 19:29:48 +0200 you wrote:
A recent rearrangement of includes has lead to a problem on m68k as flagged by the kernel test robot.
Resolve this by moving the block asm includes to below linux includes. A side effect i that non-Sparc asm includes are now immediately before Sparc asm includes, which seems nice.
[...]
Here is the summary with links:
- [net-next] net: sunhme: move asm includes to below linux includes
https://git.kernel.org/netdev/net-next/c/f8b648bf6628
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html