Commit 02529ba2 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'pm-for-3.5-rc5' of git://git.kernel.org/pub/scm/linux/kernel/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
parents 15114c7e 75cc5235
...@@ -224,6 +224,7 @@ static void lapic_timer_state_broadcast(struct acpi_processor *pr, ...@@ -224,6 +224,7 @@ static void lapic_timer_state_broadcast(struct acpi_processor *pr,
/* /*
* Suspend / resume control * Suspend / resume control
*/ */
static int acpi_idle_suspend;
static u32 saved_bm_rld; static u32 saved_bm_rld;
static void acpi_idle_bm_rld_save(void) static void acpi_idle_bm_rld_save(void)
...@@ -242,13 +243,21 @@ static void acpi_idle_bm_rld_restore(void) ...@@ -242,13 +243,21 @@ static void acpi_idle_bm_rld_restore(void)
int acpi_processor_suspend(struct acpi_device * device, pm_message_t state) 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_bm_rld_save();
acpi_idle_suspend = 1;
return 0; return 0;
} }
int acpi_processor_resume(struct acpi_device * device) int acpi_processor_resume(struct acpi_device * device)
{ {
if (acpi_idle_suspend == 0)
return 0;
acpi_idle_bm_rld_restore(); acpi_idle_bm_rld_restore();
acpi_idle_suspend = 0;
return 0; return 0;
} }
...@@ -754,6 +763,12 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev, ...@@ -754,6 +763,12 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev,
local_irq_disable(); local_irq_disable();
if (acpi_idle_suspend) {
local_irq_enable();
cpu_relax();
return -EBUSY;
}
lapic_timer_state_broadcast(pr, cx, 1); lapic_timer_state_broadcast(pr, cx, 1);
kt1 = ktime_get_real(); kt1 = ktime_get_real();
acpi_idle_do_entry(cx); acpi_idle_do_entry(cx);
...@@ -823,6 +838,12 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, ...@@ -823,6 +838,12 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
local_irq_disable(); local_irq_disable();
if (acpi_idle_suspend) {
local_irq_enable();
cpu_relax();
return -EBUSY;
}
if (cx->entry_method != ACPI_CSTATE_FFH) { if (cx->entry_method != ACPI_CSTATE_FFH) {
current_thread_info()->status &= ~TS_POLLING; current_thread_info()->status &= ~TS_POLLING;
/* /*
...@@ -907,14 +928,21 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, ...@@ -907,14 +928,21 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
drv, drv->safe_state_index); drv, drv->safe_state_index);
} else { } else {
local_irq_disable(); local_irq_disable();
if (!acpi_idle_suspend)
acpi_safe_halt(); acpi_safe_halt();
local_irq_enable(); local_irq_enable();
return -EINVAL; return -EBUSY;
} }
} }
local_irq_disable(); local_irq_disable();
if (acpi_idle_suspend) {
local_irq_enable();
cpu_relax();
return -EBUSY;
}
if (cx->entry_method != ACPI_CSTATE_FFH) { if (cx->entry_method != ACPI_CSTATE_FFH) {
current_thread_info()->status &= ~TS_POLLING; current_thread_info()->status &= ~TS_POLLING;
/* /*
......
...@@ -1031,7 +1031,7 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async) ...@@ -1031,7 +1031,7 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
dpm_wait_for_children(dev, async); dpm_wait_for_children(dev, async);
if (async_error) if (async_error)
return 0; goto Complete;
pm_runtime_get_noresume(dev); pm_runtime_get_noresume(dev);
if (pm_runtime_barrier(dev) && device_may_wakeup(dev)) if (pm_runtime_barrier(dev) && device_may_wakeup(dev))
...@@ -1040,7 +1040,7 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async) ...@@ -1040,7 +1040,7 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
if (pm_wakeup_pending()) { if (pm_wakeup_pending()) {
pm_runtime_put_sync(dev); pm_runtime_put_sync(dev);
async_error = -EBUSY; async_error = -EBUSY;
return 0; goto Complete;
} }
device_lock(dev); device_lock(dev);
...@@ -1097,6 +1097,8 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async) ...@@ -1097,6 +1097,8 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
} }
device_unlock(dev); device_unlock(dev);
Complete:
complete_all(&dev->power.completion); complete_all(&dev->power.completion);
if (error) { if (error) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment