aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2010-12-15 18:51:08 -0500
committerRafael J. Wysocki <rjw@sisk.pl>2010-12-24 09:02:43 -0500
commit5b219a51fdceaf76e0e18da57c7efb9e5586e567 (patch)
treede72cbfa6c47170a1118716ffafc5a876d4ebfbc
parent8a43a9ab7b329aa8590f8a064df9bf8c80987507 (diff)
PM: Remove redundant checks from core device resume routines
Since a separate list of devices is used to link devices that have completed each stage of suspend (or resume), it is not necessary to check dev->power.status in the core device resume routines any more. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
-rw-r--r--drivers/base/power/main.c44
1 files changed, 17 insertions, 27 deletions
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index b711867fa58e..bb5c8cb64174 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -485,22 +485,18 @@ void dpm_resume_noirq(pm_message_t state)
485 transition_started = false; 485 transition_started = false;
486 while (!list_empty(&dpm_noirq_list)) { 486 while (!list_empty(&dpm_noirq_list)) {
487 struct device *dev = to_device(dpm_noirq_list.next); 487 struct device *dev = to_device(dpm_noirq_list.next);
488 int error;
488 489
489 get_device(dev); 490 get_device(dev);
490 if (dev->power.status > DPM_OFF) { 491 dev->power.status = DPM_OFF;
491 int error; 492 list_move_tail(&dev->power.entry, &dpm_suspended_list);
492 493 mutex_unlock(&dpm_list_mtx);
493 dev->power.status = DPM_OFF;
494 mutex_unlock(&dpm_list_mtx);
495 494
496 error = device_resume_noirq(dev, state); 495 error = device_resume_noirq(dev, state);
496 if (error)
497 pm_dev_err(dev, state, " early", error);
497 498
498 mutex_lock(&dpm_list_mtx); 499 mutex_lock(&dpm_list_mtx);
499 if (error)
500 pm_dev_err(dev, state, " early", error);
501 }
502 if (!list_empty(&dev->power.entry))
503 list_move_tail(&dev->power.entry, &dpm_suspended_list);
504 put_device(dev); 500 put_device(dev);
505 } 501 }
506 mutex_unlock(&dpm_list_mtx); 502 mutex_unlock(&dpm_list_mtx);
@@ -619,9 +615,6 @@ static void dpm_resume(pm_message_t state)
619 async_error = 0; 615 async_error = 0;
620 616
621 list_for_each_entry(dev, &dpm_suspended_list, power.entry) { 617 list_for_each_entry(dev, &dpm_suspended_list, power.entry) {
622 if (dev->power.status < DPM_OFF)
623 continue;
624
625 INIT_COMPLETION(dev->power.completion); 618 INIT_COMPLETION(dev->power.completion);
626 if (is_async(dev)) { 619 if (is_async(dev)) {
627 get_device(dev); 620 get_device(dev);
@@ -632,16 +625,16 @@ static void dpm_resume(pm_message_t state)
632 while (!list_empty(&dpm_suspended_list)) { 625 while (!list_empty(&dpm_suspended_list)) {
633 dev = to_device(dpm_suspended_list.next); 626 dev = to_device(dpm_suspended_list.next);
634 get_device(dev); 627 get_device(dev);
635 if (dev->power.status >= DPM_OFF && !is_async(dev)) { 628 if (!is_async(dev)) {
636 int error; 629 int error;
637 630
638 mutex_unlock(&dpm_list_mtx); 631 mutex_unlock(&dpm_list_mtx);
639 632
640 error = device_resume(dev, state, false); 633 error = device_resume(dev, state, false);
641
642 mutex_lock(&dpm_list_mtx);
643 if (error) 634 if (error)
644 pm_dev_err(dev, state, "", error); 635 pm_dev_err(dev, state, "", error);
636
637 mutex_lock(&dpm_list_mtx);
645 } 638 }
646 if (!list_empty(&dev->power.entry)) 639 if (!list_empty(&dev->power.entry))
647 list_move_tail(&dev->power.entry, &dpm_prepared_list); 640 list_move_tail(&dev->power.entry, &dpm_prepared_list);
@@ -697,17 +690,14 @@ static void dpm_complete(pm_message_t state)
697 struct device *dev = to_device(dpm_prepared_list.prev); 690 struct device *dev = to_device(dpm_prepared_list.prev);
698 691
699 get_device(dev); 692 get_device(dev);
700 if (dev->power.status > DPM_ON) { 693 dev->power.status = DPM_ON;
701 dev->power.status = DPM_ON; 694 list_move(&dev->power.entry, &list);
702 mutex_unlock(&dpm_list_mtx); 695 mutex_unlock(&dpm_list_mtx);
703 696
704 device_complete(dev, state); 697 device_complete(dev, state);
705 pm_runtime_put_sync(dev); 698 pm_runtime_put_sync(dev);
706 699
707 mutex_lock(&dpm_list_mtx); 700 mutex_lock(&dpm_list_mtx);
708 }
709 if (!list_empty(&dev->power.entry))
710 list_move(&dev->power.entry, &list);
711 put_device(dev); 701 put_device(dev);
712 } 702 }
713 list_splice(&list, &dpm_list); 703 list_splice(&list, &dpm_list);