aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/power/runtime.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2012-08-15 15:32:04 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2012-08-17 13:36:36 -0400
commit55d7ec4520e86d735d178c15d7df33d507bd43c6 (patch)
treef514c1b9173c5b7ff580970b6a249360cee04348 /drivers/base/power/runtime.c
parent58a34de7b1a920d287d17d2ca08bc9aaf7e6d35b (diff)
PM / Runtime: Check device PM QoS setting before "no callbacks" check
If __dev_pm_qos_read_value(dev) returns a negative value, rpm_suspend() should return -EPERM for dev even if its power.no_callbacks flag is set. For this to happen, the device's power.no_callbacks flag has to be checked after the PM QoS check, so move the PM QoS check to rpm_check_suspend_allowed() (this will make it cover idle notifications as well as runtime suspend too). Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Alan Stern <stern@rowland.harvard.edu> Cc: stable@vger.kernel.org
Diffstat (limited to 'drivers/base/power/runtime.c')
-rw-r--r--drivers/base/power/runtime.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
index b6e9d9b7982d..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
@@ -402,12 +404,6 @@ static int rpm_suspend(struct device *dev, int rpmflags)
402 goto out; 404 goto out;
403 } 405 }
404 406
405 if (__dev_pm_qos_read_value(dev) < 0) {
406 /* Negative PM QoS constraint means "never suspend". */
407 retval = -EPERM;
408 goto out;
409 }
410
411 __update_runtime_status(dev, RPM_SUSPENDING); 407 __update_runtime_status(dev, RPM_SUSPENDING);
412 408
413 if (dev->pm_domain) 409 if (dev->pm_domain)