[03/50] x86/lib/cache-smp.c: fix missing include

Message ID 20231216024834.3510073-4-kent.overstreet@linux.dev
State New
Headers
Series big header dependency cleanup targeting sched.h |

Commit Message

Kent Overstreet Dec. 16, 2023, 2:47 a.m. UTC
  Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
---
 arch/x86/lib/cache-smp.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Sohil Mehta Dec. 18, 2023, 10:48 a.m. UTC | #1
> diff --git a/arch/x86/lib/cache-smp.c b/arch/x86/lib/cache-smp.c
> index 7c48ff4ae8d1..7af743bd3b13 100644
> --- a/arch/x86/lib/cache-smp.c
> +++ b/arch/x86/lib/cache-smp.c
> @@ -1,4 +1,5 @@
>  // SPDX-License-Identifier: GPL-2.0
> +#include <asm/paravirt.h>
>  #include <linux/smp.h>
>  #include <linux/export.h>
>  

I believe the norm is to have the linux/ includes first, followed by the
the asm/ ones. Shouldn't this case be the same?

Sohil
  
Kent Overstreet Dec. 19, 2023, 2:06 a.m. UTC | #2
On Mon, Dec 18, 2023 at 04:18:29PM +0530, Sohil Mehta wrote:
> > diff --git a/arch/x86/lib/cache-smp.c b/arch/x86/lib/cache-smp.c
> > index 7c48ff4ae8d1..7af743bd3b13 100644
> > --- a/arch/x86/lib/cache-smp.c
> > +++ b/arch/x86/lib/cache-smp.c
> > @@ -1,4 +1,5 @@
> >  // SPDX-License-Identifier: GPL-2.0
> > +#include <asm/paravirt.h>
> >  #include <linux/smp.h>
> >  #include <linux/export.h>
> >  
> 
> I believe the norm is to have the linux/ includes first, followed by the
> the asm/ ones. Shouldn't this case be the same?

I haven't seen that? I generally do the reverse, simpler includes first,
not that I have any reason for that...
  
Sohil Mehta Dec. 19, 2023, 4:04 a.m. UTC | #3
On 12/19/2023 7:36 AM, Kent Overstreet wrote:
> On Mon, Dec 18, 2023 at 04:18:29PM +0530, Sohil Mehta wrote:
>> I believe the norm is to have the linux/ includes first, followed by the
>> the asm/ ones. Shouldn't this case be the same?
> 
> I haven't seen that? I generally do the reverse, simpler includes first,
> not that I have any reason for that...

I couldn't find a kernel Documentation link handy. But, I found this
email from Boris:
https://lore.kernel.org/lkml/20190411135547.GH30080@zn.tnic/

I believe at least arch/x86 follows this for the most part. One simple
reason is to make it easier to find headers when a ton of them are
included in the same file.

Sohil
  

Patch

diff --git a/arch/x86/lib/cache-smp.c b/arch/x86/lib/cache-smp.c
index 7c48ff4ae8d1..7af743bd3b13 100644
--- a/arch/x86/lib/cache-smp.c
+++ b/arch/x86/lib/cache-smp.c
@@ -1,4 +1,5 @@ 
 // SPDX-License-Identifier: GPL-2.0
+#include <asm/paravirt.h>
 #include <linux/smp.h>
 #include <linux/export.h>