ACPI / PM: Simplifications of core suspend and hibernate code
Subsystems (3)
cover ACPI / PM: Simplifications of core suspend and hibernate code
Hi,
The following series of patches reduces complexity of the core suspend and hibernate code a bit.
[1/6] - Remove acpi_restore_state_mem() which isn't used.
[2/6] - Do not turn interrupts on/off in acpi_suspend_enter(). [3/6] - Move the "back to C" message and make it meaningful. [4/6] - Move the call to acpi_save_state_mem() towards do_suspend_lowlevel(). [5/6] - Merge do_suspend_lowlevel() into acpi_save_state_mem(). [6/6] - Do not turn interrupts on/off in acpi_hibernation_enter().
I'm regarding these patches as 2.6.39 material, if there are no objections.
Thanks,
Rafael
PATCH 1/6 ACPI / PM: Drop acpi_restore_state_mem()
From: Rafael J. Wysocki <[email protected]>
The function acpi_restore_state_mem() has never been and most likely never will be used, so remove it.
--- arch/ia64/include/asm/acpi.h | 4 ++-- arch/ia64/kernel/acpi.c | 5 ----- arch/x86/include/asm/acpi.h | 3 +-- arch/x86/kernel/acpi/sleep.c | 8 -------- drivers/acpi/sleep.c | 4 ---- 5 files changed, 3 insertions(+), 21 deletions(-)
drivers/acpi/sleep.c +0 -4
@@ -293,10 +293,6 @@ static int acpi_suspend_enter(suspend_stlocal_irq_restore (flags);printk (KERN_DEBUG "Back to C!\n" ); -/* restore processor state */ -if (acpi_state ==ACPI_STATE_S3 ) -acpi_restore_state_mem (); -suspend_nvs_restore ();return ACPI_SUCCESS (status) ?0 : -EFAULT ;
arch/ia64/include/asm/acpi.h +2 -2
@@ -128,9 +128,9 @@ static inline const char *acpi_get_sysnaint acpi_request_vector (u32 int_type);int acpi_gsi_to_irq (u32 gsi,unsigned int *irq); -/* routines for saving/restoring kernel state */ +/* Routine for saving kernel state during suspend. */ extern int acpi_save_state_mem (void ); -extern void acpi_restore_state_mem (void ); +extern unsigned long acpi_wakeup_address;/*
arch/ia64/kernel/acpi.c +0 -5
@@ -1041,11 +1041,6 @@ EXPORT_SYMBOL(acpi_unregister_ioapic);int acpi_save_state_mem (void ) {return 0 ; }/* -* acpi_restore_state() -*/ -void acpi_restore_state_mem (void ) {} - -/* * do_suspend_lowlevel() */ void do_suspend_lowlevel (void ) {}
arch/x86/include/asm/acpi.h +1 -2
@@ -112,9 +112,8 @@ static inline void acpi_disable_pci(voidacpi_noirq_set (); } -/* routines for saving/restoring kernel state */ +/* Routine for saving kernel state during suspend. */ extern int acpi_save_state_mem (void ); -extern void acpi_restore_state_mem (void );extern unsigned long acpi_wakeup_address;
arch/x86/kernel/acpi/sleep.c +0 -8
@@ -112,14 +112,6 @@ int acpi_save_state_mem(void)return 0 ; } -/* -* acpi_restore_state - undo effects of acpi_save_state_mem -*/ -void acpi_restore_state_mem (void ) -{ -} - -/** * acpi_reserve_wakeup_memory - do _very_ early ACPI initialisation *
Re: [PATCH 1/6] ACPI / PM: Drop acpi_restore_state_mem()
Quoted 6 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
The function
acpi_restore_state_mem()has never been and most likely never will be used, so remove it.Signed-off-by Rafael J. Wysocki <[email protected]>
ack.
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: [PATCH 1/6] ACPI / PM: Drop acpi_restore_state_mem()
In reply to Rafael J. WysockiQuoted 6 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
The function
acpi_restore_state_mem()has never been and most likely never will be used, so remove it.Signed-off-by Rafael J. Wysocki <[email protected]>
ack.
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
PATCH 1/6 ACPI / PM: Drop acpi_restore_state_mem()
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
The function acpi_restore_state_mem() has never been and most likely never will be used, so remove it.
--- arch/ia64/include/asm/acpi.h | 4 ++-- arch/ia64/kernel/acpi.c | 5 ----- arch/x86/include/asm/acpi.h | 3 +-- arch/x86/kernel/acpi/sleep.c | 8 -------- drivers/acpi/sleep.c | 4 ---- 5 files changed, 3 insertions(+), 21 deletions(-)
drivers/acpi/sleep.c +0 -4
@@ -293,10 +293,6 @@ static int acpi_suspend_enter(suspend_stlocal_irq_restore (flags);printk (KERN_DEBUG "Back to C!\n" ); -/* restore processor state */ -if (acpi_state ==ACPI_STATE_S3 ) -acpi_restore_state_mem (); -suspend_nvs_restore ();return ACPI_SUCCESS (status) ?0 : -EFAULT ;
arch/ia64/include/asm/acpi.h +2 -2
@@ -128,9 +128,9 @@ static inline const char *acpi_get_sysnaint acpi_request_vector (u32 int_type);int acpi_gsi_to_irq (u32 gsi,unsigned int *irq); -/* routines for saving/restoring kernel state */ +/* Routine for saving kernel state during suspend. */ extern int acpi_save_state_mem (void ); -extern void acpi_restore_state_mem (void ); +extern unsigned long acpi_wakeup_address;/*
arch/ia64/kernel/acpi.c +0 -5
@@ -1041,11 +1041,6 @@ EXPORT_SYMBOL(acpi_unregister_ioapic);int acpi_save_state_mem (void ) {return 0 ; }/* -* acpi_restore_state() -*/ -void acpi_restore_state_mem (void ) {} - -/* * do_suspend_lowlevel() */ void do_suspend_lowlevel (void ) {}
arch/x86/include/asm/acpi.h +1 -2
@@ -112,9 +112,8 @@ static inline void acpi_disable_pci(voidacpi_noirq_set (); } -/* routines for saving/restoring kernel state */ +/* Routine for saving kernel state during suspend. */ extern int acpi_save_state_mem (void ); -extern void acpi_restore_state_mem (void );extern unsigned long acpi_wakeup_address;
arch/x86/kernel/acpi/sleep.c +0 -8
@@ -112,14 +112,6 @@ int acpi_save_state_mem(void)return 0 ; } -/* -* acpi_restore_state - undo effects of acpi_save_state_mem -*/ -void acpi_restore_state_mem (void ) -{ -} - -/** * acpi_reserve_wakeup_memory - do _very_ early ACPI initialisation *
PATCH 2/6 ACPI / PM: Do not switch interrupts off/on in acpi_suspend_enter()
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
The function acpi_suspend_enter() is always called with interrupts off, so it doesn't need to switch them off and on.
--- drivers/acpi/sleep.c | 3 --- 1 file changed, 3 deletions(-)
drivers/acpi/sleep.c +0 -3
@@ -243,7 +243,6 @@ static int acpi_suspend_begin(suspend_ststatic int acpi_suspend_enter (suspend_state_t pm_state) {acpi_status status =AE_OK ; -unsigned long flags =0 ;u32 acpi_state = acpi_target_sleep_state;ACPI_FLUSH_CPU_CACHE ();
@@ -256,7 +255,6 @@ static int acpi_suspend_enter(suspend_streturn error; } -local_irq_save (flags);switch (acpi_state) {case ACPI_STATE_S1 :barrier ();
@@ -290,7 +288,6 @@ static int acpi_suspend_enter(suspend_st/* Allow EC transactions to happen. */ acpi_ec_unblock_transactions_early (); -local_irq_restore (flags);printk (KERN_DEBUG "Back to C!\n" );suspend_nvs_restore ();
Re: [PATCH 2/6] ACPI / PM: Do not switch interrupts off/on in acpi_suspend_enter()
Hi!
Quoted 2 lines
The function
acpi_suspend_enter()is always called with interrupts off, so it doesn't need to switch them off and on.
Maybe add 'this function always runs with irqs disabled' comment?
Otherwise ack.
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: [PATCH 2/6] ACPI / PM: Do not switch interrupts off/on in acpi_suspend_enter()
In reply to Rafael J. WysockiHi!
Quoted 2 lines
The function
acpi_suspend_enter()is always called with interrupts off, so it doesn't need to switch them off and on.
Maybe add 'this function always runs with irqs disabled' comment?
Otherwise ack.
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
PATCH 2/6 ACPI / PM: Do not switch interrupts off/on in acpi_suspend_enter()
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
The function acpi_suspend_enter() is always called with interrupts off, so it doesn't need to switch them off and on.
--- drivers/acpi/sleep.c | 3 --- 1 file changed, 3 deletions(-)
drivers/acpi/sleep.c +0 -3
@@ -243,7 +243,6 @@ static int acpi_suspend_begin(suspend_ststatic int acpi_suspend_enter (suspend_state_t pm_state) {acpi_status status =AE_OK ; -unsigned long flags =0 ;u32 acpi_state = acpi_target_sleep_state;ACPI_FLUSH_CPU_CACHE ();
@@ -256,7 +255,6 @@ static int acpi_suspend_enter(suspend_streturn error; } -local_irq_save (flags);switch (acpi_state) {case ACPI_STATE_S1 :barrier ();
@@ -290,7 +288,6 @@ static int acpi_suspend_enter(suspend_st/* Allow EC transactions to happen. */ acpi_ec_unblock_transactions_early (); -local_irq_restore (flags);printk (KERN_DEBUG "Back to C!\n" );suspend_nvs_restore ();
PATCH 3/6 ACPI / PM: Modify the "low-level resume finished" message
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
Move the low-level resume completion message to the point where control goes back to acpi_suspend_enter() during resume and change it so that it's more informative.
--- drivers/acpi/sleep.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/acpi/sleep.c +1 -2
@@ -263,6 +263,7 @@ static int acpi_suspend_enter(suspend_stcase ACPI_STATE_S3 :do_suspend_lowlevel (); +pr_info (PREFIX "Low-level resume complete\n" );break ; }
@@ -288,8 +289,6 @@ static int acpi_suspend_enter(suspend_st/* Allow EC transactions to happen. */ acpi_ec_unblock_transactions_early (); -printk (KERN_DEBUG "Back to C!\n" ); -suspend_nvs_restore ();return ACPI_SUCCESS (status) ?0 : -EFAULT ;
Re: [PATCH 3/6] ACPI / PM: Modify the "low-level resume finished" message
Hi!
Quoted 3 lines
Move the low-level resume completion message to the point where control goes back to
acpi_suspend_enter()during resume and change it so that it's more informative.
Well, doing some printk as soon as reasonably possible was helpful for debugging in the past. I'd move it sooner, not later.
(If you see that message, it means that normal printk debugging can be used, not exotic stuff like hashes in NVRAM).
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: [PATCH 3/6] ACPI / PM: Modify the "low-level resume finished" message
In reply to Rafael J. WysockiHi!
Quoted 3 lines
Move the low-level resume completion message to the point where control goes back to
acpi_suspend_enter()during resume and change it so that it's more informative.
Well, doing some printk as soon as reasonably possible was helpful for debugging in the past. I'd move it sooner, not later.
(If you see that message, it means that normal printk debugging can be used, not exotic stuff like hashes in NVRAM).
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: [PATCH 3/6] ACPI / PM: Modify the "low-level resume finished" message
Quoted 11 lines · Pavel Machek
Hi!
Quoted 3 lines
Move the low-level resume completion message to the point where control goes back to
acpi_suspend_enter()during resume and change it so that it's more informative.Well, doing some printk as soon as reasonably possible was helpful for debugging in the past. I'd move it sooner, not later.
(If you see that message, it means that normal printk debugging can be used, not exotic stuff like hashes in NVRAM).
That's what the patch is doing, isn't it?
Re: [PATCH 3/6] ACPI / PM: Modify the "low-level resume finished" message
In reply to Pavel MachekQuoted 11 lines · Pavel Machek
Hi!
Quoted 3 lines
Move the low-level resume completion message to the point where control goes back to
acpi_suspend_enter()during resume and change it so that it's more informative.Well, doing some printk as soon as reasonably possible was helpful for debugging in the past. I'd move it sooner, not later.
(If you see that message, it means that normal printk debugging can be used, not exotic stuff like hashes in NVRAM).
That's what the patch is doing, isn't it?
PATCH 3/6 ACPI / PM: Modify the "low-level resume finished" message
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
Move the low-level resume completion message to the point where control goes back to acpi_suspend_enter() during resume and change it so that it's more informative.
--- drivers/acpi/sleep.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/acpi/sleep.c +1 -2
@@ -263,6 +263,7 @@ static int acpi_suspend_enter(suspend_stcase ACPI_STATE_S3 :do_suspend_lowlevel (); +pr_info (PREFIX "Low-level resume complete\n" );break ; }
@@ -288,8 +289,6 @@ static int acpi_suspend_enter(suspend_st/* Allow EC transactions to happen. */ acpi_ec_unblock_transactions_early (); -printk (KERN_DEBUG "Back to C!\n" ); -suspend_nvs_restore ();return ACPI_SUCCESS (status) ?0 : -EFAULT ;
PATCH 4/6 ACPI / PM: Call acpi_save_state_mem() right before low-level suspend
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
Since acpi_save_state_mem() is only called by acpi_suspend_enter() if the target sleep state is S3, it's better to call it under the switch (acpi_state), right before do_suspend_lowlevel().
--- drivers/acpi/sleep.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/acpi/sleep.c +4 -8
@@ -244,17 +244,10 @@ static int acpi_suspend_enter(suspend_st {acpi_status status =AE_OK ;u32 acpi_state = acpi_target_sleep_state; +int error;ACPI_FLUSH_CPU_CACHE (); -/* Do arch specific saving of state. */ -if (acpi_state ==ACPI_STATE_S3 ) { -int error =acpi_save_state_mem (); - -if (error) -return error; - } -switch (acpi_state) {case ACPI_STATE_S1 :barrier ();
@@ -262,6 +255,9 @@ static int acpi_suspend_enter(suspend_stbreak ;case ACPI_STATE_S3 : + error =acpi_save_state_mem (); +if (error) +return error;do_suspend_lowlevel ();pr_info (PREFIX "Low-level resume complete\n" );break ;
PATCH 4/6 ACPI / PM: Call acpi_save_state_mem() right before low-level suspend
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
Since acpi_save_state_mem() is only called by acpi_suspend_enter() if the target sleep state is S3, it's better to call it under the switch (acpi_state), right before do_suspend_lowlevel().
--- drivers/acpi/sleep.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/acpi/sleep.c +4 -8
@@ -244,17 +244,10 @@ static int acpi_suspend_enter(suspend_st {acpi_status status =AE_OK ;u32 acpi_state = acpi_target_sleep_state; +int error;ACPI_FLUSH_CPU_CACHE (); -/* Do arch specific saving of state. */ -if (acpi_state ==ACPI_STATE_S3 ) { -int error =acpi_save_state_mem (); - -if (error) -return error; - } -switch (acpi_state) {case ACPI_STATE_S1 :barrier ();
@@ -262,6 +255,9 @@ static int acpi_suspend_enter(suspend_stbreak ;case ACPI_STATE_S3 : + error =acpi_save_state_mem (); +if (error) +return error;do_suspend_lowlevel ();pr_info (PREFIX "Low-level resume complete\n" );break ;
Re: [PATCH 4/6] ACPI / PM: Call acpi_save_state_mem() right before low-level suspend
Quoted 5 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
Since
acpi_save_state_mem()is only called byacpi_suspend_enter()if the target sleep state is S3, it's better to call it under the switch (acpi_state), right beforedo_suspend_lowlevel().
ack.
Quoted 45 lines
Signed-off-by Rafael J. Wysocki <[email protected]>--- drivers/acpi/sleep.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)Index:
linux-2.6/drivers/acpi/sleep.c
===================================================================drivers/acpi/sleep.c +4
-9@@ -244,17 +244,10 @@ static int acpi_suspend_enter(suspend_st {acpi_status status =AE_OK ;u32 acpi_state = acpi_target_sleep_state; +int error;ACPI_FLUSH_CPU_CACHE (); -/* Do arch specific saving of state. */ -if (acpi_state ==ACPI_STATE_S3 ) { -int error =acpi_save_state_mem (); - -if (error) -return error; - } -switch (acpi_state) {case ACPI_STATE_S1 :barrier ();@@ -262,6 +255,9 @@ static int acpi_suspend_enter(suspend_stbreak ;case ACPI_STATE_S3 : + error =acpi_save_state_mem (); +if (error) +return error;do_suspend_lowlevel ();pr_info (PREFIX "Low-level resume complete\n" );break ; --To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: [PATCH 4/6] ACPI / PM: Call acpi_save_state_mem() right before low-level suspend
In reply to Rafael J. WysockiQuoted 5 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
Since
acpi_save_state_mem()is only called byacpi_suspend_enter()if the target sleep state is S3, it's better to call it under the switch (acpi_state), right beforedo_suspend_lowlevel().
ack.
Quoted 45 lines
Signed-off-by Rafael J. Wysocki <[email protected]>--- drivers/acpi/sleep.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)Index:
linux-2.6/drivers/acpi/sleep.c
===================================================================drivers/acpi/sleep.c +4
-9@@ -244,17 +244,10 @@ static int acpi_suspend_enter(suspend_st {acpi_status status =AE_OK ;u32 acpi_state = acpi_target_sleep_state; +int error;ACPI_FLUSH_CPU_CACHE (); -/* Do arch specific saving of state. */ -if (acpi_state ==ACPI_STATE_S3 ) { -int error =acpi_save_state_mem (); - -if (error) -return error; - } -switch (acpi_state) {case ACPI_STATE_S1 :barrier ();@@ -262,6 +255,9 @@ static int acpi_suspend_enter(suspend_stbreak ;case ACPI_STATE_S3 : + error =acpi_save_state_mem (); +if (error) +return error;do_suspend_lowlevel ();pr_info (PREFIX "Low-level resume complete\n" );break ; --To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
PATCH 5/6 ACPI / PM: Merge do_suspend_lowlevel() into acpi_save_state_mem()
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
The function do_suspend_lowlevel() is specific to x86 and defined in assembly code, so it should be called from the x86 low-level suspend code rather than from acpi_suspend_enter().
Merge do_suspend_lowlevel() into the x86's acpi_save_state_mem() and change the name of the latter to acpi_suspend_lowlevel(), so that the function's purpose is better reflected by its name.
--- arch/ia64/include/asm/acpi.h | 4 ++-- arch/ia64/kernel/acpi.c | 9 ++------- arch/x86/include/asm/acpi.h | 4 ++-- arch/x86/kernel/acpi/sleep.c | 5 +++-- arch/x86/kernel/acpi/sleep.h | 2 ++ drivers/acpi/sleep.c | 5 +---- 6 files changed, 12 insertions(+), 17 deletions(-)
drivers/acpi/sleep.c +1 -4
@@ -199,8 +199,6 @@ static void acpi_pm_end(void)#endif /* CONFIG_ACPI_SLEEP */ #ifdef CONFIG_SUSPEND -extern void do_suspend_lowlevel (void ); -static u32 acpi_suspend_states[] = { [PM_SUSPEND_ON ] =ACPI_STATE_S0 , [PM_SUSPEND_STANDBY] = ACPI_STATE_S1,
@@ -255,10 +253,9 @@ static int acpi_suspend_enter(suspend_stbreak ;case ACPI_STATE_S3 : - error =acpi_save_state_mem (); + error =acpi_suspend_lowlevel ();if (error)return error; -do_suspend_lowlevel ();pr_info (PREFIX "Low-level resume complete\n" );break ; }
arch/ia64/include/asm/acpi.h +2 -2
@@ -128,8 +128,8 @@ static inline const char *acpi_get_sysnaint acpi_request_vector (u32 int_type);int acpi_gsi_to_irq (u32 gsi,unsigned int *irq); -/* Routine for saving kernel state during suspend. */ -extern int acpi_save_state_mem (void ); +/* Low-level suspend routine. */ +extern int acpi_suspend_lowlevel (void );extern unsigned long acpi_wakeup_address;
arch/ia64/kernel/acpi.c +2 -7
@@ -1034,13 +1034,8 @@ int acpi_unregister_ioapic(acpi_handle hEXPORT_SYMBOL (acpi_unregister_ioapic);/* -* acpi_save_state_mem() - save kernel state +* acpi_suspend_lowlevel() - save kernel state and suspend. * * TBD when when IA64 starts to support suspend... */ -int acpi_save_state_mem (void ) {return 0 ; } - -/* -* do_suspend_lowlevel() -*/ -void do_suspend_lowlevel (void ) {} +int acpi_suspend_lowlevel (void ) {return 0 ; }
arch/x86/include/asm/acpi.h +2 -2
@@ -112,8 +112,8 @@ static inline void acpi_disable_pci(voidacpi_noirq_set (); } -/* Routine for saving kernel state during suspend. */ -extern int acpi_save_state_mem (void ); +/* Low-level suspend routine. */ +extern int acpi_suspend_lowlevel (void );extern unsigned long acpi_wakeup_address;
arch/x86/kernel/acpi/sleep.c +3 -2
@@ -31,14 +31,14 @@ static char temp_stack[4096];#endif /** -* acpi_save_state_mem - save kernel state +* acpi_suspend_lowlevel - save kernel state * * Create an identity mapped page table and copy the wakeup routine to * low memory. * * Note that this is too late to change acpi_wakeup_address. */ -int acpi_save_state_mem (void ) +int acpi_suspend_lowlevel (void ) {struct wakeup_header *header;
@@ -109,6 +109,7 @@ int acpi_save_state_mem(void) saved_magic =0x123456789abcdef0L ;#endif /* CONFIG_64BIT */ +do_suspend_lowlevel ();return 0 ; }
arch/x86/kernel/acpi/sleep.h +2 -0
@@ -14,3 +14,5 @@ extern char swsusp_pg_dir[PAGE_SIZE];extern unsigned long acpi_copy_wakeup_routine (unsigned long );extern void wakeup_long64 (void ); + +extern void do_suspend_lowlevel (void );
PATCH 5/6 ACPI / PM: Merge do_suspend_lowlevel() into acpi_save_state_mem()
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
The function do_suspend_lowlevel() is specific to x86 and defined in assembly code, so it should be called from the x86 low-level suspend code rather than from acpi_suspend_enter().
Merge do_suspend_lowlevel() into the x86's acpi_save_state_mem() and change the name of the latter to acpi_suspend_lowlevel(), so that the function's purpose is better reflected by its name.
--- arch/ia64/include/asm/acpi.h | 4 ++-- arch/ia64/kernel/acpi.c | 9 ++------- arch/x86/include/asm/acpi.h | 4 ++-- arch/x86/kernel/acpi/sleep.c | 5 +++-- arch/x86/kernel/acpi/sleep.h | 2 ++ drivers/acpi/sleep.c | 5 +---- 6 files changed, 12 insertions(+), 17 deletions(-)
drivers/acpi/sleep.c +1 -4
@@ -199,8 +199,6 @@ static void acpi_pm_end(void)#endif /* CONFIG_ACPI_SLEEP */ #ifdef CONFIG_SUSPEND -extern void do_suspend_lowlevel (void ); -static u32 acpi_suspend_states[] = { [PM_SUSPEND_ON ] =ACPI_STATE_S0 , [PM_SUSPEND_STANDBY] = ACPI_STATE_S1,
@@ -255,10 +253,9 @@ static int acpi_suspend_enter(suspend_stbreak ;case ACPI_STATE_S3 : - error =acpi_save_state_mem (); + error =acpi_suspend_lowlevel ();if (error)return error; -do_suspend_lowlevel ();pr_info (PREFIX "Low-level resume complete\n" );break ; }
arch/ia64/include/asm/acpi.h +2 -2
@@ -128,8 +128,8 @@ static inline const char *acpi_get_sysnaint acpi_request_vector (u32 int_type);int acpi_gsi_to_irq (u32 gsi,unsigned int *irq); -/* Routine for saving kernel state during suspend. */ -extern int acpi_save_state_mem (void ); +/* Low-level suspend routine. */ +extern int acpi_suspend_lowlevel (void );extern unsigned long acpi_wakeup_address;
arch/ia64/kernel/acpi.c +2 -7
@@ -1034,13 +1034,8 @@ int acpi_unregister_ioapic(acpi_handle hEXPORT_SYMBOL (acpi_unregister_ioapic);/* -* acpi_save_state_mem() - save kernel state +* acpi_suspend_lowlevel() - save kernel state and suspend. * * TBD when when IA64 starts to support suspend... */ -int acpi_save_state_mem (void ) {return 0 ; } - -/* -* do_suspend_lowlevel() -*/ -void do_suspend_lowlevel (void ) {} +int acpi_suspend_lowlevel (void ) {return 0 ; }
arch/x86/include/asm/acpi.h +2 -2
@@ -112,8 +112,8 @@ static inline void acpi_disable_pci(voidacpi_noirq_set (); } -/* Routine for saving kernel state during suspend. */ -extern int acpi_save_state_mem (void ); +/* Low-level suspend routine. */ +extern int acpi_suspend_lowlevel (void );extern unsigned long acpi_wakeup_address;
arch/x86/kernel/acpi/sleep.c +3 -2
@@ -31,14 +31,14 @@ static char temp_stack[4096];#endif /** -* acpi_save_state_mem - save kernel state +* acpi_suspend_lowlevel - save kernel state * * Create an identity mapped page table and copy the wakeup routine to * low memory. * * Note that this is too late to change acpi_wakeup_address. */ -int acpi_save_state_mem (void ) +int acpi_suspend_lowlevel (void ) {struct wakeup_header *header;
@@ -109,6 +109,7 @@ int acpi_save_state_mem(void) saved_magic =0x123456789abcdef0L ;#endif /* CONFIG_64BIT */ +do_suspend_lowlevel ();return 0 ; }
arch/x86/kernel/acpi/sleep.h +2 -0
@@ -14,3 +14,5 @@ extern char swsusp_pg_dir[PAGE_SIZE];extern unsigned long acpi_copy_wakeup_routine (unsigned long );extern void wakeup_long64 (void ); + +extern void do_suspend_lowlevel (void );
Re: [PATCH 5/6] ACPI / PM: Merge do_suspend_lowlevel() into acpi_save_state_mem()
Quoted 11 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
The function
do_suspend_lowlevel()is specific to x86 and defined in assembly code, so it should be called from the x86 low-level suspend code rather than fromacpi_suspend_enter().Merge
do_suspend_lowlevel()into the x86'sacpi_save_state_mem()and change the name of the latter toacpi_suspend_lowlevel(), so that the function's purpose is better reflected by its name.Signed-off-by Rafael J. Wysocki <[email protected]>
Ack.
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: [PATCH 5/6] ACPI / PM: Merge do_suspend_lowlevel() into acpi_save_state_mem()
In reply to Rafael J. WysockiQuoted 11 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
The function
do_suspend_lowlevel()is specific to x86 and defined in assembly code, so it should be called from the x86 low-level suspend code rather than fromacpi_suspend_enter().Merge
do_suspend_lowlevel()into the x86'sacpi_save_state_mem()and change the name of the latter toacpi_suspend_lowlevel(), so that the function's purpose is better reflected by its name.Signed-off-by Rafael J. Wysocki <[email protected]>
Ack.
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
PATCH 6/6 ACPI / PM: Do not switch interrupts off/on in acpi_hibernation_enter()
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
The function acpi_hibernation_enter() is always called with interrupts off, so it doesn't need to switch them off and on.
--- drivers/acpi/sleep.c | 3 --- 1 file changed, 3 deletions(-)
drivers/acpi/sleep.c +0 -3
@@ -457,16 +457,13 @@ static int acpi_hibernation_begin(void)static int acpi_hibernation_enter (void ) {acpi_status status =AE_OK ; -unsigned long flags =0 ;ACPI_FLUSH_CPU_CACHE (); -local_irq_save (flags);/* This shouldn't return. If it returns, we have a problem */ status =acpi_enter_sleep_state (ACPI_STATE_S4 );/* Reprogram control registers and execute _BFS */ acpi_leave_sleep_state_prep (ACPI_STATE_S4 ); -local_irq_restore (flags);return ACPI_SUCCESS (status) ?0 : -EFAULT ; }
PATCH 6/6 ACPI / PM: Do not switch interrupts off/on in acpi_hibernation_enter()
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
The function acpi_hibernation_enter() is always called with interrupts off, so it doesn't need to switch them off and on.
--- drivers/acpi/sleep.c | 3 --- 1 file changed, 3 deletions(-)
drivers/acpi/sleep.c +0 -3
@@ -457,16 +457,13 @@ static int acpi_hibernation_begin(void)static int acpi_hibernation_enter (void ) {acpi_status status =AE_OK ; -unsigned long flags =0 ;ACPI_FLUSH_CPU_CACHE (); -local_irq_save (flags);/* This shouldn't return. If it returns, we have a problem */ status =acpi_enter_sleep_state (ACPI_STATE_S4 );/* Reprogram control registers and execute _BFS */ acpi_leave_sleep_state_prep (ACPI_STATE_S4 ); -local_irq_restore (flags);return ACPI_SUCCESS (status) ?0 : -EFAULT ; }
Re: [PATCH 6/6] ACPI / PM: Do not switch interrupts off/on in acpi_hibernation_enter()
Quoted 4 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
The function
acpi_hibernation_enter()is always called with interrupts off, so it doesn't need to switch them off and on.
ack... and maybe comment?
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: [PATCH 6/6] ACPI / PM: Do not switch interrupts off/on in acpi_hibernation_enter()
In reply to Rafael J. WysockiQuoted 4 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
The function
acpi_hibernation_enter()is always called with interrupts off, so it doesn't need to switch them off and on.
ack... and maybe comment?
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html