ARM: 8485/1: cpuidle: remove cpu parameter from the cpuidle_ops suspend hook
authorLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Thu, 17 Dec 2015 10:22:45 +0000 (11:22 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Tue, 22 Dec 2015 12:09:43 +0000 (12:09 +0000)
The suspend() hook in the cpuidle_ops struct is always called on
the cpu entering idle, which means that the cpu parameter passed
to the suspend hook always corresponds to the local cpu, making
it somewhat redundant.

This patch removes the logical cpu parameter from the ARM
cpuidle_ops.suspend hook and updates all the existing kernel
implementations to reflect this change.

Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Reviewed-by: Lina Iyer <lina.iyer@linaro.org>
Tested-by: Lina Iyer <lina.iyer@linaro.org>
Tested-by: Jisheng Zhang <jszhang@marvell.com> [psci]
Cc: Lina Iyer <lina.iyer@linaro.org>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/include/asm/cpuidle.h
arch/arm/kernel/cpuidle.c
drivers/soc/qcom/spm.c

index 0f842492490280b9d0b50fd1b25935a51b5a4c9d..3848259bebf85786d39d4212d74f2e1646b98a44 100644 (file)
@@ -30,7 +30,7 @@ static inline int arm_cpuidle_simple_enter(struct cpuidle_device *dev,
 struct device_node;
 
 struct cpuidle_ops {
-       int (*suspend)(int cpu, unsigned long arg);
+       int (*suspend)(unsigned long arg);
        int (*init)(struct device_node *, int cpu);
 };
 
index 318da33465f413f8c207eb2dd9b3766e53ab5ad3..703926e7007b4e0000b689006722780a02588e04 100644 (file)
@@ -56,7 +56,7 @@ int arm_cpuidle_suspend(int index)
        int cpu = smp_processor_id();
 
        if (cpuidle_ops[cpu].suspend)
-               ret = cpuidle_ops[cpu].suspend(cpu, index);
+               ret = cpuidle_ops[cpu].suspend(index);
 
        return ret;
 }
index b04b05a0904eec086c49250c3dc4e27cb84a3927..0ad66fa9bb1aa47c97a7a5c1cae80f7bbc945473 100644 (file)
@@ -116,7 +116,7 @@ static const struct spm_reg_data spm_reg_8064_cpu = {
 
 static DEFINE_PER_CPU(struct spm_driver_data *, cpu_spm_drv);
 
-typedef int (*idle_fn)(int);
+typedef int (*idle_fn)(void);
 static DEFINE_PER_CPU(idle_fn*, qcom_idle_ops);
 
 static inline void spm_register_write(struct spm_driver_data *drv,
@@ -179,10 +179,10 @@ static int qcom_pm_collapse(unsigned long int unused)
        return -1;
 }
 
-static int qcom_cpu_spc(int cpu)
+static int qcom_cpu_spc(void)
 {
        int ret;
-       struct spm_driver_data *drv = per_cpu(cpu_spm_drv, cpu);
+       struct spm_driver_data *drv = __this_cpu_read(cpu_spm_drv);
 
        spm_set_low_power_mode(drv, PM_SLEEP_MODE_SPC);
        ret = cpu_suspend(0, qcom_pm_collapse);
@@ -197,9 +197,9 @@ static int qcom_cpu_spc(int cpu)
        return ret;
 }
 
-static int qcom_idle_enter(int cpu, unsigned long index)
+static int qcom_idle_enter(unsigned long index)
 {
-       return per_cpu(qcom_idle_ops, cpu)[index](cpu);
+       return __this_cpu_read(qcom_idle_ops)[index]();
 }
 
 static const struct of_device_id qcom_idle_state_match[] __initconst = {