diff mbox series

[net-next] net: sunhme: move asm includes to below linux includes

Message ID 20230405-sunhme-includes-fix-v1-1-bf17cc5de20d@kernel.org (mailing list archive)
State Accepted
Commit f8b648bf6628eb0a6c25be68e512bed6df2e5f24
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: sunhme: move asm includes to below linux includes | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 18 this patch: 18
netdev/cc_maintainers fail 1 blamed authors not CCed: simon.horman@corigine.com; 1 maintainers not CCed: simon.horman@corigine.com
netdev/build_clang success Errors and warnings before: 18 this patch: 18
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 18 this patch: 18
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 19 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Simon Horman April 5, 2023, 5:29 p.m. UTC
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/202304041748.0sQc4K4l-lkp@intel.com/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.

Fixes: 1ff4f42aef60 ("net: sunhme: Alphabetize includes")
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/oe-kbuild-all/202304041748.0sQc4K4l-lkp@intel.com/
Signed-off-by: Simon Horman <horms@kernel.org>
---
 drivers/net/ethernet/sun/sunhme.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Sean Anderson April 5, 2023, 5:34 p.m. UTC | #1
On 4/5/23 13:29, Simon Horman 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.
> 
> 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/202304041748.0sQc4K4l-lkp@intel.com/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

> Compile tested only.
> 
> Fixes: 1ff4f42aef60 ("net: sunhme: Alphabetize includes")
> Reported-by: kernel test robot <lkp@intel.com>
> Link: https://lore.kernel.org/oe-kbuild-all/202304041748.0sQc4K4l-lkp@intel.com/
> Signed-off-by: Simon Horman <horms@kernel.org>
> ---
>   drivers/net/ethernet/sun/sunhme.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/sunhme.c
> index ec85aef35bf9..b93613cd1994 100644
> --- a/drivers/net/ethernet/sun/sunhme.c
> +++ b/drivers/net/ethernet/sun/sunhme.c
> @@ -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 April 5, 2023, 6:02 p.m. UTC | #2
On Wed, Apr 05, 2023 at 01:34:11PM -0400, Sean Anderson wrote:
> On 4/5/23 13:29, Simon Horman 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.
> > 
> > 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/202304041748.0sQc4K4l-lkp@intel.com/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.

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?

> --Sean
> 
> > Compile tested only.
> > 
> > Fixes: 1ff4f42aef60 ("net: sunhme: Alphabetize includes")
> > Reported-by: kernel test robot <lkp@intel.com>
> > Link: https://lore.kernel.org/oe-kbuild-all/202304041748.0sQc4K4l-lkp@intel.com/
> > Signed-off-by: Simon Horman <horms@kernel.org>
> > ---
> >   drivers/net/ethernet/sun/sunhme.c | 7 ++++---
> >   1 file changed, 4 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/sunhme.c
> > index ec85aef35bf9..b93613cd1994 100644
> > --- a/drivers/net/ethernet/sun/sunhme.c
> > +++ b/drivers/net/ethernet/sun/sunhme.c
> > @@ -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>
> > 
>
Matthew Wilcox (Oracle) April 5, 2023, 6:07 p.m. UTC | #3
On Wed, Apr 05, 2023 at 08:02:37PM +0200, Simon Horman wrote:
> On Wed, Apr 05, 2023 at 01:34:11PM -0400, Sean Anderson wrote:
> > On 4/5/23 13:29, Simon Horman 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.
> > > 
> > > 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/202304041748.0sQc4K4l-lkp@intel.com/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.
> 
> 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 April 5, 2023, 6:09 p.m. UTC | #4
On 4/5/23 14:07, Matthew Wilcox wrote:
> On Wed, Apr 05, 2023 at 08:02:37PM +0200, Simon Horman wrote:
>> On Wed, Apr 05, 2023 at 01:34:11PM -0400, Sean Anderson wrote:
>>> On 4/5/23 13:29, Simon Horman 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.
>>>>
>>>> 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/202304041748.0sQc4K4l-lkp@intel.com/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.
>>
>> 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
Matthew Wilcox (Oracle) April 5, 2023, 6:34 p.m. UTC | #5
On Wed, Apr 05, 2023 at 02:09:55PM -0400, Sean Anderson wrote:
> On 4/5/23 14:07, Matthew Wilcox wrote:
> > 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 April 5, 2023, 11:25 p.m. UTC | #6
On Wed, 5 Apr 2023 19:34:38 +0100 Matthew Wilcox wrote:
> On Wed, Apr 05, 2023 at 02:09:55PM -0400, Sean Anderson wrote:
> > On 4/5/23 14:07, Matthew Wilcox wrote:  
> > > 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 :)
Geert Uytterhoeven April 6, 2023, 12:10 p.m. UTC | #7
Hi Willy,

On Wed, Apr 5, 2023 at 8:34 PM Matthew Wilcox <willy@infradead.org> wrote:
> On Wed, Apr 05, 2023 at 02:09:55PM -0400, Sean Anderson wrote:
> > On 4/5/23 14:07, Matthew Wilcox wrote:
> > > 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>)

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
patchwork-bot+netdevbpf@kernel.org April 7, 2023, 2:10 a.m. UTC | #8
Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

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!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/sunhme.c
index ec85aef35bf9..b93613cd1994 100644
--- a/drivers/net/ethernet/sun/sunhme.c
+++ b/drivers/net/ethernet/sun/sunhme.c
@@ -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>