diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-06-13 08:53:06 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-06-24 03:47:26 -0400 |
commit | 3fd431bd0cbc75a506b90b42619de3b04fe813a7 (patch) | |
tree | 877d30136546ffb96d8114f7cfc109d7b8155998 | |
parent | 2fefbcd58590cf33189c6178098e12b31b994b5f (diff) |
ARM: pm: extract common code from MULTI_CPU/!MULTI_CPU paths
Very little code is different between these two paths now, so extract
the common code.
Acked-by: Frank Hofmann <frank.hofmann@tomtom.com>
Tested-by: Kevin Hilman <khilman@ti.com>
Acked-by: Jean Pihet <j-pihet@ti.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/kernel/sleep.S | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/arch/arm/kernel/sleep.S b/arch/arm/kernel/sleep.S index f8e92513c1bd..0a778c30859b 100644 --- a/arch/arm/kernel/sleep.S +++ b/arch/arm/kernel/sleep.S | |||
@@ -19,29 +19,13 @@ ENTRY(cpu_suspend) | |||
19 | mov r9, lr | 19 | mov r9, lr |
20 | #ifdef MULTI_CPU | 20 | #ifdef MULTI_CPU |
21 | ldr r10, =processor | 21 | ldr r10, =processor |
22 | mov r2, sp @ current virtual SP | ||
23 | ldr r0, [r10, #CPU_SLEEP_SIZE] @ size of CPU sleep state | 22 | ldr r0, [r10, #CPU_SLEEP_SIZE] @ size of CPU sleep state |
24 | ldr ip, [r10, #CPU_DO_RESUME] @ virtual resume function | 23 | ldr ip, [r10, #CPU_DO_RESUME] @ virtual resume function |
25 | sub sp, sp, r0 @ allocate CPU state on stack | ||
26 | mov r0, sp @ save pointer | ||
27 | add ip, ip, r1 @ convert resume fn to phys | ||
28 | stmfd sp!, {r1, r2, ip} @ save v:p, virt SP, phys resume fn | ||
29 | ldr r3, =sleep_save_sp | ||
30 | add r2, sp, r1 @ convert SP to phys | ||
31 | #ifdef CONFIG_SMP | ||
32 | ALT_SMP(mrc p15, 0, lr, c0, c0, 5) | ||
33 | ALT_UP(mov lr, #0) | ||
34 | and lr, lr, #15 | ||
35 | str r2, [r3, lr, lsl #2] @ save phys SP | ||
36 | #else | 24 | #else |
37 | str r2, [r3] @ save phys SP | ||
38 | #endif | ||
39 | mov lr, pc | ||
40 | ldr pc, [r10, #CPU_DO_SUSPEND] @ save CPU state | ||
41 | #else | ||
42 | mov r2, sp @ current virtual SP | ||
43 | ldr r0, =cpu_suspend_size | 25 | ldr r0, =cpu_suspend_size |
44 | ldr ip, =cpu_do_resume | 26 | ldr ip, =cpu_do_resume |
27 | #endif | ||
28 | mov r2, sp @ current virtual SP | ||
45 | sub sp, sp, r0 @ allocate CPU state on stack | 29 | sub sp, sp, r0 @ allocate CPU state on stack |
46 | mov r0, sp @ save pointer | 30 | mov r0, sp @ save pointer |
47 | add ip, ip, r1 @ convert resume fn to phys | 31 | add ip, ip, r1 @ convert resume fn to phys |
@@ -56,6 +40,10 @@ ENTRY(cpu_suspend) | |||
56 | #else | 40 | #else |
57 | str r2, [r3] @ save phys SP | 41 | str r2, [r3] @ save phys SP |
58 | #endif | 42 | #endif |
43 | #ifdef MULTI_CPU | ||
44 | mov lr, pc | ||
45 | ldr pc, [r10, #CPU_DO_SUSPEND] @ save CPU state | ||
46 | #else | ||
59 | bl cpu_do_suspend | 47 | bl cpu_do_suspend |
60 | #endif | 48 | #endif |
61 | 49 | ||