Skip to content

Commit

Permalink
ACPI / PM: Call acpi_save_state_mem() right before low-level suspend
Browse files Browse the repository at this point in the history
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().

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
  • Loading branch information
Rafael J. Wysocki committed Feb 24, 2011
1 parent 7a63f08 commit 979f11b
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions drivers/acpi/sleep.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,24 +244,20 @@ static int acpi_suspend_enter(suspend_state_t pm_state)
{
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();
status = acpi_enter_sleep_state(acpi_state);
break;

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;
Expand Down

0 comments on commit 979f11b

Please sign in to comment.