aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-08-18 17:39:19 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-08-18 17:39:19 -0400
commitd9ec0fdc24743cb6aa9b7dee9064455cd26782f9 (patch)
treedb04d8436aee4b2a06373997448650364ba7ffa6 /drivers
parent20fb1936dee63fe397236d4ff3fd253a62b7b0b8 (diff)
parent3735d524da64b70b41c764359da36f88aded3610 (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')
-rw-r--r--drivers/base/power/runtime.c13
-rw-r--r--drivers/cpuidle/coupled.c14
-rw-r--r--drivers/idle/intel_idle.c3
3 files changed, 20 insertions, 10 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:
diff --git a/drivers/cpuidle/coupled.c b/drivers/cpuidle/coupled.c
index 2c9bf2692232..3265844839bf 100644
--- a/drivers/cpuidle/coupled.c
+++ b/drivers/cpuidle/coupled.c
@@ -678,10 +678,22 @@ static int cpuidle_coupled_cpu_notify(struct notifier_block *nb,
678 int cpu = (unsigned long)hcpu; 678 int cpu = (unsigned long)hcpu;
679 struct cpuidle_device *dev; 679 struct cpuidle_device *dev;
680 680
681 switch (action & ~CPU_TASKS_FROZEN) {
682 case CPU_UP_PREPARE:
683 case CPU_DOWN_PREPARE:
684 case CPU_ONLINE:
685 case CPU_DEAD:
686 case CPU_UP_CANCELED:
687 case CPU_DOWN_FAILED:
688 break;
689 default:
690 return NOTIFY_OK;
691 }
692
681 mutex_lock(&cpuidle_lock); 693 mutex_lock(&cpuidle_lock);
682 694
683 dev = per_cpu(cpuidle_devices, cpu); 695 dev = per_cpu(cpuidle_devices, cpu);
684 if (!dev->coupled) 696 if (!dev || !dev->coupled)
685 goto out; 697 goto out;
686 698
687 switch (action & ~CPU_TASKS_FROZEN) { 699 switch (action & ~CPU_TASKS_FROZEN) {
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
index f559088869f6..e8726177d103 100644
--- a/drivers/idle/intel_idle.c
+++ b/drivers/idle/intel_idle.c
@@ -606,8 +606,9 @@ static int __init intel_idle_init(void)
606 intel_idle_cpuidle_driver_init(); 606 intel_idle_cpuidle_driver_init();
607 retval = cpuidle_register_driver(&intel_idle_driver); 607 retval = cpuidle_register_driver(&intel_idle_driver);
608 if (retval) { 608 if (retval) {
609 struct cpuidle_driver *drv = cpuidle_get_driver();
609 printk(KERN_DEBUG PREFIX "intel_idle yielding to %s", 610 printk(KERN_DEBUG PREFIX "intel_idle yielding to %s",
610 cpuidle_get_driver()->name); 611 drv ? drv->name : "none");
611 return retval; 612 return retval;
612 } 613 }
613 614