Browse Source

ARM: shmobile: Adjust APMU code to build for non-SMP

Adjust the APMU code to allow build when CONFIG_SMP=n.

Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Magnus Damm 11 years ago
parent
commit
784500be40
1 changed files with 7 additions and 4 deletions
  1. 7 4
      arch/arm/mach-shmobile/platsmp-apmu.c

+ 7 - 4
arch/arm/mach-shmobile/platsmp-apmu.c

@@ -15,6 +15,7 @@
 #include <linux/of_address.h>
 #include <linux/of_address.h>
 #include <linux/smp.h>
 #include <linux/smp.h>
 #include <linux/suspend.h>
 #include <linux/suspend.h>
+#include <linux/threads.h>
 #include <asm/cacheflush.h>
 #include <asm/cacheflush.h>
 #include <asm/cp15.h>
 #include <asm/cp15.h>
 #include <asm/proc-fns.h>
 #include <asm/proc-fns.h>
@@ -25,13 +26,13 @@
 static struct {
 static struct {
 	void __iomem *iomem;
 	void __iomem *iomem;
 	int bit;
 	int bit;
-} apmu_cpus[CONFIG_NR_CPUS];
+} apmu_cpus[NR_CPUS];
 
 
 #define WUPCR_OFFS 0x10
 #define WUPCR_OFFS 0x10
 #define PSTR_OFFS 0x40
 #define PSTR_OFFS 0x40
 #define CPUNCR_OFFS(n) (0x100 + (0x10 * (n)))
 #define CPUNCR_OFFS(n) (0x100 + (0x10 * (n)))
 
 
-static int apmu_power_on(void __iomem *p, int bit)
+static int __maybe_unused apmu_power_on(void __iomem *p, int bit)
 {
 {
 	/* request power on */
 	/* request power on */
 	writel_relaxed(BIT(bit), p + WUPCR_OFFS);
 	writel_relaxed(BIT(bit), p + WUPCR_OFFS);
@@ -50,7 +51,7 @@ static int apmu_power_off(void __iomem *p, int bit)
 	return 0;
 	return 0;
 }
 }
 
 
-static int apmu_power_off_poll(void __iomem *p, int bit)
+static int __maybe_unused apmu_power_off_poll(void __iomem *p, int bit)
 {
 {
 	int k;
 	int k;
 
 
@@ -73,7 +74,7 @@ static int apmu_wrap(int cpu, int (*fn)(void __iomem *p, int cpu))
 
 
 static void apmu_init_cpu(struct resource *res, int cpu, int bit)
 static void apmu_init_cpu(struct resource *res, int cpu, int bit)
 {
 {
-	if (apmu_cpus[cpu].iomem)
+	if ((cpu >= ARRAY_SIZE(apmu_cpus)) || apmu_cpus[cpu].iomem)
 		return;
 		return;
 
 
 	apmu_cpus[cpu].iomem = ioremap_nocache(res->start, resource_size(res));
 	apmu_cpus[cpu].iomem = ioremap_nocache(res->start, resource_size(res));
@@ -137,6 +138,7 @@ void __init shmobile_smp_apmu_prepare_cpus(unsigned int max_cpus)
 	apmu_parse_cfg(apmu_init_cpu);
 	apmu_parse_cfg(apmu_init_cpu);
 }
 }
 
 
+#ifdef CONFIG_SMP
 int shmobile_smp_apmu_boot_secondary(unsigned int cpu, struct task_struct *idle)
 int shmobile_smp_apmu_boot_secondary(unsigned int cpu, struct task_struct *idle)
 {
 {
 	/* For this particular CPU register boot vector */
 	/* For this particular CPU register boot vector */
@@ -144,6 +146,7 @@ int shmobile_smp_apmu_boot_secondary(unsigned int cpu, struct task_struct *idle)
 
 
 	return apmu_wrap(cpu, apmu_power_on);
 	return apmu_wrap(cpu, apmu_power_on);
 }
 }
+#endif
 
 
 #if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_SUSPEND)
 #if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_SUSPEND)
 /* nicked from arch/arm/mach-exynos/hotplug.c */
 /* nicked from arch/arm/mach-exynos/hotplug.c */