Skip to content

Commit

Permalink
Merge tag 'pm-for-3.5-rc5' of git://git.kernel.org/pub/scm/linux/kern…
Browse files Browse the repository at this point in the history
…el/git/rafael/linux-pm

Pull power management fixes from Rafael J. Wysocki:

 * Fix for a bug in async suspend error code path causing parents to
   wait forever for their children in case of a suspend error from
   Mandeep Singh Baines (-stable metarial).

 * Fix for a suspend regression related to earlier changes in the ACPI
   cpuidle driver from Deepthi Dharwar.

* tag 'pm-for-3.5-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  PM / ACPI: Fix suspend/resume regression caused by cpuidle cleanup.
  PM / Sleep: Prevent waiting forever on asynchronous suspend after abort
  • Loading branch information
Linus Torvalds committed Jun 30, 2012
2 parents 15114c7 + 75cc523 commit 02529ba
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
32 changes: 30 additions & 2 deletions drivers/acpi/processor_idle.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ static void lapic_timer_state_broadcast(struct acpi_processor *pr,
/*
* Suspend / resume control
*/
static int acpi_idle_suspend;
static u32 saved_bm_rld;

static void acpi_idle_bm_rld_save(void)
Expand All @@ -242,13 +243,21 @@ static void acpi_idle_bm_rld_restore(void)

int acpi_processor_suspend(struct acpi_device * device, pm_message_t state)
{
if (acpi_idle_suspend == 1)
return 0;

acpi_idle_bm_rld_save();
acpi_idle_suspend = 1;
return 0;
}

int acpi_processor_resume(struct acpi_device * device)
{
if (acpi_idle_suspend == 0)
return 0;

acpi_idle_bm_rld_restore();
acpi_idle_suspend = 0;
return 0;
}

Expand Down Expand Up @@ -754,6 +763,12 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev,

local_irq_disable();

if (acpi_idle_suspend) {
local_irq_enable();
cpu_relax();
return -EBUSY;
}

lapic_timer_state_broadcast(pr, cx, 1);
kt1 = ktime_get_real();
acpi_idle_do_entry(cx);
Expand Down Expand Up @@ -823,6 +838,12 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,

local_irq_disable();

if (acpi_idle_suspend) {
local_irq_enable();
cpu_relax();
return -EBUSY;
}

if (cx->entry_method != ACPI_CSTATE_FFH) {
current_thread_info()->status &= ~TS_POLLING;
/*
Expand Down Expand Up @@ -907,14 +928,21 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
drv, drv->safe_state_index);
} else {
local_irq_disable();
acpi_safe_halt();
if (!acpi_idle_suspend)
acpi_safe_halt();
local_irq_enable();
return -EINVAL;
return -EBUSY;
}
}

local_irq_disable();

if (acpi_idle_suspend) {
local_irq_enable();
cpu_relax();
return -EBUSY;
}

if (cx->entry_method != ACPI_CSTATE_FFH) {
current_thread_info()->status &= ~TS_POLLING;
/*
Expand Down
6 changes: 4 additions & 2 deletions drivers/base/power/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1031,7 +1031,7 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
dpm_wait_for_children(dev, async);

if (async_error)
return 0;
goto Complete;

pm_runtime_get_noresume(dev);
if (pm_runtime_barrier(dev) && device_may_wakeup(dev))
Expand All @@ -1040,7 +1040,7 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
if (pm_wakeup_pending()) {
pm_runtime_put_sync(dev);
async_error = -EBUSY;
return 0;
goto Complete;
}

device_lock(dev);
Expand Down Expand Up @@ -1097,6 +1097,8 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
}

device_unlock(dev);

Complete:
complete_all(&dev->power.completion);

if (error) {
Expand Down

0 comments on commit 02529ba

Please sign in to comment.