aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/power/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/power/main.c')
-rw-r--r--drivers/base/power/main.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 3b354560f306..aa6320207745 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -579,11 +579,13 @@ static bool is_async(struct device *dev)
579 * Execute the appropriate "resume" callback for all devices whose status 579 * Execute the appropriate "resume" callback for all devices whose status
580 * indicates that they are suspended. 580 * indicates that they are suspended.
581 */ 581 */
582static void dpm_resume(pm_message_t state) 582void dpm_resume(pm_message_t state)
583{ 583{
584 struct device *dev; 584 struct device *dev;
585 ktime_t starttime = ktime_get(); 585 ktime_t starttime = ktime_get();
586 586
587 might_sleep();
588
587 mutex_lock(&dpm_list_mtx); 589 mutex_lock(&dpm_list_mtx);
588 pm_transition = state; 590 pm_transition = state;
589 async_error = 0; 591 async_error = 0;
@@ -656,10 +658,12 @@ static void device_complete(struct device *dev, pm_message_t state)
656 * Execute the ->complete() callbacks for all devices whose PM status is not 658 * Execute the ->complete() callbacks for all devices whose PM status is not
657 * DPM_ON (this allows new devices to be registered). 659 * DPM_ON (this allows new devices to be registered).
658 */ 660 */
659static void dpm_complete(pm_message_t state) 661void dpm_complete(pm_message_t state)
660{ 662{
661 struct list_head list; 663 struct list_head list;
662 664
665 might_sleep();
666
663 INIT_LIST_HEAD(&list); 667 INIT_LIST_HEAD(&list);
664 mutex_lock(&dpm_list_mtx); 668 mutex_lock(&dpm_list_mtx);
665 while (!list_empty(&dpm_prepared_list)) { 669 while (!list_empty(&dpm_prepared_list)) {
@@ -688,7 +692,6 @@ static void dpm_complete(pm_message_t state)
688 */ 692 */
689void dpm_resume_end(pm_message_t state) 693void dpm_resume_end(pm_message_t state)
690{ 694{
691 might_sleep();
692 dpm_resume(state); 695 dpm_resume(state);
693 dpm_complete(state); 696 dpm_complete(state);
694} 697}
@@ -912,11 +915,13 @@ static int device_suspend(struct device *dev)
912 * dpm_suspend - Execute "suspend" callbacks for all non-sysdev devices. 915 * dpm_suspend - Execute "suspend" callbacks for all non-sysdev devices.
913 * @state: PM transition of the system being carried out. 916 * @state: PM transition of the system being carried out.
914 */ 917 */
915static int dpm_suspend(pm_message_t state) 918int dpm_suspend(pm_message_t state)
916{ 919{
917 ktime_t starttime = ktime_get(); 920 ktime_t starttime = ktime_get();
918 int error = 0; 921 int error = 0;
919 922
923 might_sleep();
924
920 mutex_lock(&dpm_list_mtx); 925 mutex_lock(&dpm_list_mtx);
921 pm_transition = state; 926 pm_transition = state;
922 async_error = 0; 927 async_error = 0;
@@ -1003,10 +1008,12 @@ static int device_prepare(struct device *dev, pm_message_t state)
1003 * 1008 *
1004 * Execute the ->prepare() callback(s) for all devices. 1009 * Execute the ->prepare() callback(s) for all devices.
1005 */ 1010 */
1006static int dpm_prepare(pm_message_t state) 1011int dpm_prepare(pm_message_t state)
1007{ 1012{
1008 int error = 0; 1013 int error = 0;
1009 1014
1015 might_sleep();
1016
1010 mutex_lock(&dpm_list_mtx); 1017 mutex_lock(&dpm_list_mtx);
1011 while (!list_empty(&dpm_list)) { 1018 while (!list_empty(&dpm_list)) {
1012 struct device *dev = to_device(dpm_list.next); 1019 struct device *dev = to_device(dpm_list.next);
@@ -1055,7 +1062,6 @@ int dpm_suspend_start(pm_message_t state)
1055{ 1062{
1056 int error; 1063 int error;
1057 1064
1058 might_sleep();
1059 error = dpm_prepare(state); 1065 error = dpm_prepare(state);
1060 if (!error) 1066 if (!error)
1061 error = dpm_suspend(state); 1067 error = dpm_suspend(state);