Le 22/03/2019 à 09:08, Christophe Leroy a écrit :
To avoid ifdefs, define cpu_pvr at all time.

Signed-off-by: Christophe Leroy <christophe.le...@c-s.fr>

This patch introduces a sparse warning.

I guess we can skip it for now and rework more deeply the use of cpu_pvr versus SPRN_PVR which is re-read in many places in the code.

Christophe

---
  arch/powerpc/kernel/setup-common.c | 12 +++++-------
  1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/kernel/setup-common.c 
b/arch/powerpc/kernel/setup-common.c
index a90e8367ccde..a4ed9301e815 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -190,9 +190,7 @@ void machine_halt(void)
        machine_hang();
  }
-#ifdef CONFIG_SMP
  DEFINE_PER_CPU(unsigned int, cpu_pvr);
-#endif
static void show_cpuinfo_summary(struct seq_file *m)
  {
@@ -234,11 +232,11 @@ static int show_cpuinfo(struct seq_file *m, void *v)
        unsigned short maj;
        unsigned short min;
-#ifdef CONFIG_SMP
-       pvr = per_cpu(cpu_pvr, cpu_id);
-#else
-       pvr = mfspr(SPRN_PVR);
-#endif
+       if (IS_ENABLED(CONFIG_SMP))
+               pvr = per_cpu(cpu_pvr, cpu_id);
+       else
+               pvr = mfspr(SPRN_PVR);
+
        maj = (pvr >> 8) & 0xFF;
        min = pvr & 0xFF;

Reply via email to