Skip to contentSkip to conversation

sparc32,leon: always include leon_pmc in build

PATCH In review Sam Ravnborg 2 participants 2 messages May 26, 2012 – May 27, 2012 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore
#0 lore raw

PATCH 2/4 sparc32,leon: always include leon_pmc in build

Cc Daniel Hellstrom <[email protected]>
Cc Konrad Eisele <[email protected]>
---
 arch/sparc/kernel/Makefile   |    2 +-
 arch/sparc/kernel/leon_pmc.c |   15 +++++++++------
 2 files changed, 10 insertions(+), 7 deletions(-)
arch/sparc/kernel/Makefile +1 -1
index 43af0d6..6cf591b 100644
@@ -52,7 +52,7 @@ obj-y                   += of_device_$(BITS).o
 obj-$(CONFIG_SPARC64)   += prom_irqtrans.o
 
 obj-$(CONFIG_SPARC32)   += leon_kernel.o
-obj-$(CONFIG_SPARC_LEON)+= leon_pmc.o
+obj-$(CONFIG_SPARC32)   += leon_pmc.o
 
 obj-$(CONFIG_SPARC64)   += reboot.o
 obj-$(CONFIG_SPARC64)   += sysfs.o
arch/sparc/kernel/leon_pmc.c +9 -6
index 519ca92..4e17432 100644
@@ -7,6 +7,7 @@
 #include <linux/pm.h>
 
 #include <asm/leon_amba.h>
+#include <asm/cpu_type.h>
 #include <asm/leon.h>
 
 /* List of Systems that need fixup instructions around power-down instruction */
@@ -65,13 +66,15 @@ void pmc_leon_idle(void)
 /* Install LEON Power Down function */
 static int __init leon_pmc_install(void)
 {
-	/* Assign power management IDLE handler */
-	if (pmc_leon_need_fixup())
-		pm_idle = pmc_leon_idle_fixup;
-	else
-		pm_idle = pmc_leon_idle;
+	if (sparc_cpu_model = sparc_leon) {
+		/* Assign power management IDLE handler */
+		if (pmc_leon_need_fixup())
+			pm_idle = pmc_leon_idle_fixup;
+		else
+			pm_idle = pmc_leon_idle;
 
-	printk(KERN_INFO "leon: power management initialized\n");
+		printk(KERN_INFO "leon: power management initialized\n");
+	}
 
 	return 0;
 }
Signature · 1 line
1.6.0.6
#1 lore raw
Quoted 12 lines · Sam Ravnborg
arch/sparc/kernel/leon_pmc.c +3 -5
@@ -65,13 +66,15 @@ void pmc_leon_idle(void)
 /* Install LEON Power Down function */
 static int __init leon_pmc_install(void)
 {
-	/* Assign power management IDLE handler */
-	if (pmc_leon_need_fixup())
-		pm_idle = pmc_leon_idle_fixup;
-	else
-		pm_idle = pmc_leon_idle;
+	if (sparc_cpu_model = sparc_leon) {
+		/* Assign power management IDLE handler */
+		if (pmc_leon_need_fixup())

arch/sparc/kernel/leon_pmc.c void pmc_leon_idle(void) · line 80

Quoted 10 lines
arch/sparc/kernel/leon_pmc.c +5 -1
+			pm_idle = pmc_leon_idle_fixup;
+		else
+			pm_idle = pmc_leon_idle;
 
-	printk(KERN_INFO "leon: power management initialized\n");
+		printk(KERN_INFO "leon: power management initialized\n");
+	}
 
 	return 0;
 }

Why not simply invert the logic and save a level of indentation?

if (sparc_cpu_model != sparc_leon)

	return 0;

Possibly also return something like -EINVAL - but I don't know the caller's MO offhand so the fake 0 might actually be better.

Signature · 1 line
     2. That which causes joy or happiness.