aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/power
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2010-12-03 16:58:05 -0500
committerRafael J. Wysocki <rjw@sisk.pl>2010-12-24 09:02:41 -0500
commit1e75227ef0571031cd18536ab768ee35667ec5b9 (patch)
tree13535aa717c401d390f6ab3cbd87e030aa2a75ef /drivers/base/power
parent7ac4dcabdb482d4e74c9d36782d00bc6c4c01619 (diff)
PM: Prevent dpm_prepare() from returning errors unnecessarily
Currently dpm_prepare() returns error code if it finds that a device being suspended has a pending runtime resume request. However, it should not do that if the checking for wakeup events is not enabled. On the other hand, if the checking for wakeup events is enabled, it can return error when a wakeup event is detected, regardless of its source. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'drivers/base/power')
-rw-r--r--drivers/base/power/main.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index ead3e79d6fcf..4747a1e8b44a 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -26,6 +26,7 @@
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/sched.h> 27#include <linux/sched.h>
28#include <linux/async.h> 28#include <linux/async.h>
29#include <linux/suspend.h>
29 30
30#include "../base.h" 31#include "../base.h"
31#include "power.h" 32#include "power.h"
@@ -1052,8 +1053,10 @@ static int dpm_prepare(pm_message_t state)
1052 mutex_unlock(&dpm_list_mtx); 1053 mutex_unlock(&dpm_list_mtx);
1053 1054
1054 pm_runtime_get_noresume(dev); 1055 pm_runtime_get_noresume(dev);
1055 if (pm_runtime_barrier(dev) && device_may_wakeup(dev)) { 1056 if (pm_runtime_barrier(dev) && device_may_wakeup(dev))
1056 /* Wake-up requested during system sleep transition. */ 1057 pm_wakeup_event(dev, 0);
1058
1059 if (!pm_check_wakeup_events()) {
1057 pm_runtime_put_sync(dev); 1060 pm_runtime_put_sync(dev);
1058 error = -EBUSY; 1061 error = -EBUSY;
1059 } else { 1062 } else {
@@ -1068,8 +1071,8 @@ static int dpm_prepare(pm_message_t state)
1068 error = 0; 1071 error = 0;
1069 continue; 1072 continue;
1070 } 1073 }
1071 printk(KERN_ERR "PM: Failed to prepare device %s " 1074 printk(KERN_INFO "PM: Device %s not prepared "
1072 "for power transition: error %d\n", 1075 "for power transition: code %d\n",
1073 kobject_name(&dev->kobj), error); 1076 kobject_name(&dev->kobj), error);
1074 put_device(dev); 1077 put_device(dev);
1075 break; 1078 break;