diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-08-18 17:39:19 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-08-18 17:39:19 -0400 |
commit | d9ec0fdc24743cb6aa9b7dee9064455cd26782f9 (patch) | |
tree | db04d8436aee4b2a06373997448650364ba7ffa6 /drivers/base | |
parent | 20fb1936dee63fe397236d4ff3fd253a62b7b0b8 (diff) | |
parent | 3735d524da64b70b41c764359da36f88aded3610 (diff) |
Merge tag 'pm-for-3.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management fixes from Rafael J. Wysocki:
- Fixes for three obscure problems in the runtime PM core code found
recently.
- Two fixes for the new "coupled" cpuidle code from Colin Cross and Jon
Medhurst.
- intel_idle driver fix from Konrad Rzeszutek Wilk.
* tag 'pm-for-3.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
intel_idle: Check cpu_idle_get_driver() for NULL before dereferencing it.
cpuidle: Prevent null pointer dereference in cpuidle_coupled_cpu_notify
cpuidle: coupled: fix sleeping while atomic in cpu notifier
PM / Runtime: Check device PM QoS setting before "no callbacks" check
PM / Runtime: Clear power.deferred_resume on success in rpm_suspend()
PM / Runtime: Fix rpm_resume() return value for power.no_callbacks set
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/power/runtime.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index 59894873a3b3..7d9c1cb1c39a 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c | |||
@@ -147,6 +147,8 @@ static int rpm_check_suspend_allowed(struct device *dev) | |||
147 | || (dev->power.request_pending | 147 | || (dev->power.request_pending |
148 | && dev->power.request == RPM_REQ_RESUME)) | 148 | && dev->power.request == RPM_REQ_RESUME)) |
149 | retval = -EAGAIN; | 149 | retval = -EAGAIN; |
150 | else if (__dev_pm_qos_read_value(dev) < 0) | ||
151 | retval = -EPERM; | ||
150 | else if (dev->power.runtime_status == RPM_SUSPENDED) | 152 | else if (dev->power.runtime_status == RPM_SUSPENDED) |
151 | retval = 1; | 153 | retval = 1; |
152 | 154 | ||
@@ -388,7 +390,6 @@ static int rpm_suspend(struct device *dev, int rpmflags) | |||
388 | goto repeat; | 390 | goto repeat; |
389 | } | 391 | } |
390 | 392 | ||
391 | dev->power.deferred_resume = false; | ||
392 | if (dev->power.no_callbacks) | 393 | if (dev->power.no_callbacks) |
393 | goto no_callback; /* Assume success. */ | 394 | goto no_callback; /* Assume success. */ |
394 | 395 | ||
@@ -403,12 +404,6 @@ static int rpm_suspend(struct device *dev, int rpmflags) | |||
403 | goto out; | 404 | goto out; |
404 | } | 405 | } |
405 | 406 | ||
406 | if (__dev_pm_qos_read_value(dev) < 0) { | ||
407 | /* Negative PM QoS constraint means "never suspend". */ | ||
408 | retval = -EPERM; | ||
409 | goto out; | ||
410 | } | ||
411 | |||
412 | __update_runtime_status(dev, RPM_SUSPENDING); | 407 | __update_runtime_status(dev, RPM_SUSPENDING); |
413 | 408 | ||
414 | if (dev->pm_domain) | 409 | if (dev->pm_domain) |
@@ -440,6 +435,7 @@ static int rpm_suspend(struct device *dev, int rpmflags) | |||
440 | wake_up_all(&dev->power.wait_queue); | 435 | wake_up_all(&dev->power.wait_queue); |
441 | 436 | ||
442 | if (dev->power.deferred_resume) { | 437 | if (dev->power.deferred_resume) { |
438 | dev->power.deferred_resume = false; | ||
443 | rpm_resume(dev, 0); | 439 | rpm_resume(dev, 0); |
444 | retval = -EAGAIN; | 440 | retval = -EAGAIN; |
445 | goto out; | 441 | goto out; |
@@ -584,6 +580,7 @@ static int rpm_resume(struct device *dev, int rpmflags) | |||
584 | || dev->parent->power.runtime_status == RPM_ACTIVE) { | 580 | || dev->parent->power.runtime_status == RPM_ACTIVE) { |
585 | atomic_inc(&dev->parent->power.child_count); | 581 | atomic_inc(&dev->parent->power.child_count); |
586 | spin_unlock(&dev->parent->power.lock); | 582 | spin_unlock(&dev->parent->power.lock); |
583 | retval = 1; | ||
587 | goto no_callback; /* Assume success. */ | 584 | goto no_callback; /* Assume success. */ |
588 | } | 585 | } |
589 | spin_unlock(&dev->parent->power.lock); | 586 | spin_unlock(&dev->parent->power.lock); |
@@ -664,7 +661,7 @@ static int rpm_resume(struct device *dev, int rpmflags) | |||
664 | } | 661 | } |
665 | wake_up_all(&dev->power.wait_queue); | 662 | wake_up_all(&dev->power.wait_queue); |
666 | 663 | ||
667 | if (!retval) | 664 | if (retval >= 0) |
668 | rpm_idle(dev, RPM_ASYNC); | 665 | rpm_idle(dev, RPM_ASYNC); |
669 | 666 | ||
670 | out: | 667 | out: |