ARM: pm: convert cpu_suspend() to a normal function

cpu_suspend() has a weird calling method which makes it only possible to
call from assembly code: it returns with a modified stack pointer to
finish the suspend, but on resume, it 'returns' via a provided pointer.

We can make cpu_suspend() appear to be a normal function merely by
swapping the resume pointer argument and the link register.

Do so, and update all callers to take account of this more traditional
behaviour.

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>
This commit is contained in:
Russell King
2011-06-13 15:58:34 +01:00
parent dbc125168f
commit e8856a8797
8 changed files with 31 additions and 40 deletions

View File

@@ -36,18 +36,15 @@
ENTRY(s3c_cpu_save)
stmfd sp!, { r4 - r12, lr }
ldr r3, =resume_with_mmu
adr r3, BSYM(s3c64xx_finish_suspend)
bl cpu_suspend
ldmfd sp!, { r4 - r12, pc }
s3c64xx_finish_suspend:
@@ call final suspend code
ldr r0, =pm_cpu_sleep
ldr pc, [r0]
@@ return to the caller, after the MMU is turned on.
@@ restore the last bits of the stack and return.
resume_with_mmu:
ldmfd sp!, { r4 - r12, pc } @ return, from sp from s3c_cpu_save
/* Sleep magic, the word before the resume entry point so that the
* bootloader can check for a resumeable image. */