2022-08-21 11:39:55

by Conor Dooley

[permalink] [raw]
Subject: [PATCH 5/6] sparc: use the asm-generic version of cpuinfo_op

From: Conor Dooley <[email protected]>

There's little point in duplicating the declaration of cpuinfo_op now
that there's a shared version of it, so drop it & include the generic
header.

Signed-off-by: Conor Dooley <[email protected]>
---
arch/sparc/include/asm/cpudata.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/sparc/include/asm/cpudata.h b/arch/sparc/include/asm/cpudata.h
index d213165ee713..af6ef3c028a9 100644
--- a/arch/sparc/include/asm/cpudata.h
+++ b/arch/sparc/include/asm/cpudata.h
@@ -6,8 +6,7 @@

#include <linux/threads.h>
#include <linux/percpu.h>
-
-extern const struct seq_operations cpuinfo_op;
+#include <asm-generic/processor.h>

#endif /* !(__ASSEMBLY__) */

--
2.37.1


2022-08-26 15:08:16

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH 5/6] sparc: use the asm-generic version of cpuinfo_op

Hi Conor.

Thanks for this nice simplification, but I think you can make it even
better.

On Sun, Aug 21, 2022 at 12:35:12PM +0100, Conor Dooley wrote:
> From: Conor Dooley <[email protected]>
>
> There's little point in duplicating the declaration of cpuinfo_op now
> that there's a shared version of it, so drop it & include the generic
> header.
>
> Signed-off-by: Conor Dooley <[email protected]>
> ---
> arch/sparc/include/asm/cpudata.h | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/arch/sparc/include/asm/cpudata.h b/arch/sparc/include/asm/cpudata.h
> index d213165ee713..af6ef3c028a9 100644
> --- a/arch/sparc/include/asm/cpudata.h
> +++ b/arch/sparc/include/asm/cpudata.h
> @@ -6,8 +6,7 @@
>
> #include <linux/threads.h>
> #include <linux/percpu.h>
> -
> -extern const struct seq_operations cpuinfo_op;
> +#include <asm-generic/processor.h>

Since the header file did not need <asm-generic/processor.h> then it
should not need it now after deleting stuff.
The better fix is to add the missing include to arch/sparc/kernel/cpu.c,
where we have the user of it.

A header file should include what it needs, and no more.

I looked only at this patch, this comment may also be relevant for the
other patches.

Sam

2022-08-26 16:05:11

by Conor Dooley

[permalink] [raw]
Subject: Re: [PATCH 5/6] sparc: use the asm-generic version of cpuinfo_op

On 26/08/2022 15:47, Sam Ravnborg wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> Hi Conor.
>
> Thanks for this nice simplification, but I think you can make it even
> better.
>
> On Sun, Aug 21, 2022 at 12:35:12PM +0100, Conor Dooley wrote:
>> From: Conor Dooley <[email protected]>
>>
>> There's little point in duplicating the declaration of cpuinfo_op now
>> that there's a shared version of it, so drop it & include the generic
>> header.
>>
>> Signed-off-by: Conor Dooley <[email protected]>
>> ---
>> arch/sparc/include/asm/cpudata.h | 3 +--
>> 1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/arch/sparc/include/asm/cpudata.h b/arch/sparc/include/asm/cpudata.h
>> index d213165ee713..af6ef3c028a9 100644
>> --- a/arch/sparc/include/asm/cpudata.h
>> +++ b/arch/sparc/include/asm/cpudata.h
>> @@ -6,8 +6,7 @@
>>
>> #include <linux/threads.h>
>> #include <linux/percpu.h>
>> -
>> -extern const struct seq_operations cpuinfo_op;
>> +#include <asm-generic/processor.h>
>
> Since the header file did not need <asm-generic/processor.h> then it
> should not need it now after deleting stuff.
> The better fix is to add the missing include to arch/sparc/kernel/cpu.c,
> where we have the user of it.
>
> A header file should include what it needs, and no more.
>
> I looked only at this patch, this comment may also be relevant for the
> other patches.

Hey Sam, thanks for your feedback.
As per Geert's suggestion, submitted a v2:
https://lore.kernel.org/linux-riscv/[email protected]/T/#u

In v2, I included linux/processor.h instead of an asm-generic header.
The diff for sparc became:

diff --git a/arch/sparc/include/asm/cpudata.h b/arch/sparc/include/asm/cpudata.h
index d213165ee713..f7e690a7860b 100644
--- a/arch/sparc/include/asm/cpudata.h
+++ b/arch/sparc/include/asm/cpudata.h
@@ -7,8 +7,6 @@
#include <linux/threads.h>
#include <linux/percpu.h>

-extern const struct seq_operations cpuinfo_op;
-
#endif /* !(__ASSEMBLY__) */

#if defined(__sparc__) && defined(__arch64__)
diff --git a/arch/sparc/kernel/cpu.c b/arch/sparc/kernel/cpu.c
index 79cd6ccfeac0..ffdc7a825b80 100644
--- a/arch/sparc/kernel/cpu.c
+++ b/arch/sparc/kernel/cpu.c
@@ -12,6 +12,7 @@
#include <linux/smp.h>
#include <linux/threads.h>
#include <linux/pgtable.h>
+#include <linux/processor.h>

#include <asm/spitfire.h>
#include <asm/oplib.h>

Hopefully that is more appealing to you!
Thanks,
Conor.

2022-08-26 18:08:53

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH 5/6] sparc: use the asm-generic version of cpuinfo_op

On Fri, Aug 26, 2022 at 03:37:40PM +0000, [email protected] wrote:
> On 26/08/2022 15:47, Sam Ravnborg wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> >
> > Hi Conor.
> >
> > Thanks for this nice simplification, but I think you can make it even
> > better.
> >
> > On Sun, Aug 21, 2022 at 12:35:12PM +0100, Conor Dooley wrote:
> >> From: Conor Dooley <[email protected]>
> >>
> >> There's little point in duplicating the declaration of cpuinfo_op now
> >> that there's a shared version of it, so drop it & include the generic
> >> header.
> >>
> >> Signed-off-by: Conor Dooley <[email protected]>
> >> ---
> >> arch/sparc/include/asm/cpudata.h | 3 +--
> >> 1 file changed, 1 insertion(+), 2 deletions(-)
> >>
> >> diff --git a/arch/sparc/include/asm/cpudata.h b/arch/sparc/include/asm/cpudata.h
> >> index d213165ee713..af6ef3c028a9 100644
> >> --- a/arch/sparc/include/asm/cpudata.h
> >> +++ b/arch/sparc/include/asm/cpudata.h
> >> @@ -6,8 +6,7 @@
> >>
> >> #include <linux/threads.h>
> >> #include <linux/percpu.h>
> >> -
> >> -extern const struct seq_operations cpuinfo_op;
> >> +#include <asm-generic/processor.h>
> >
> > Since the header file did not need <asm-generic/processor.h> then it
> > should not need it now after deleting stuff.
> > The better fix is to add the missing include to arch/sparc/kernel/cpu.c,
> > where we have the user of it.
> >
> > A header file should include what it needs, and no more.
> >
> > I looked only at this patch, this comment may also be relevant for the
> > other patches.
>
> Hey Sam, thanks for your feedback.
> As per Geert's suggestion, submitted a v2:
> https://lore.kernel.org/linux-riscv/[email protected]/T/#u
>
> In v2, I included linux/processor.h instead of an asm-generic header.
> The diff for sparc became:
>
> diff --git a/arch/sparc/include/asm/cpudata.h b/arch/sparc/include/asm/cpudata.h
> index d213165ee713..f7e690a7860b 100644
> --- a/arch/sparc/include/asm/cpudata.h
> +++ b/arch/sparc/include/asm/cpudata.h
> @@ -7,8 +7,6 @@
> #include <linux/threads.h>
> #include <linux/percpu.h>
>
> -extern const struct seq_operations cpuinfo_op;
> -
> #endif /* !(__ASSEMBLY__) */
>
> #if defined(__sparc__) && defined(__arch64__)
> diff --git a/arch/sparc/kernel/cpu.c b/arch/sparc/kernel/cpu.c
> index 79cd6ccfeac0..ffdc7a825b80 100644
> --- a/arch/sparc/kernel/cpu.c
> +++ b/arch/sparc/kernel/cpu.c
> @@ -12,6 +12,7 @@
> #include <linux/smp.h>
> #include <linux/threads.h>
> #include <linux/pgtable.h>
> +#include <linux/processor.h>
>
> #include <asm/spitfire.h>
> #include <asm/oplib.h>
>
> Hopefully that is more appealing to you!
> Thanks,
> Conor.

Hi Conor - much better. Thanks.

Sam