aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/power/main.c
diff options
context:
space:
mode:
authorMandeep Singh Baines <msb@chromium.org>2012-06-24 17:31:09 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2012-06-24 17:31:09 -0400
commit1f758b23177d588a71b96ad02990e715949bb82f (patch)
tree2854e0209da918af16084d2f6a009318336fb87a /drivers/base/power/main.c
parent6b16351acbd415e66ba16bf7d473ece1574cf0bc (diff)
PM / Sleep: Prevent waiting forever on asynchronous suspend after abort
__device_suspend() must always send a completion. Otherwise, parent devices will wait forever. Commit 1e2ef05b, "PM: Limit race conditions between runtime PM and system sleep (v2)", introduced a regression by short-circuiting the complete_all() for certain error cases. This patch fixes the bug by always signalling a completion. Addresses http://crosbug.com/31972 Tested by injecting an abort. Signed-off-by: Mandeep Singh Baines <msb@chromium.org> Cc: stable@vger.kernel.org Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'drivers/base/power/main.c')
-rw-r--r--drivers/base/power/main.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index e0fb5b0435a3..9cb845e49334 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -1031,7 +1031,7 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
1031 dpm_wait_for_children(dev, async); 1031 dpm_wait_for_children(dev, async);
1032 1032
1033 if (async_error) 1033 if (async_error)
1034 return 0; 1034 goto Complete;
1035 1035
1036 pm_runtime_get_noresume(dev); 1036 pm_runtime_get_noresume(dev);
1037 if (pm_runtime_barrier(dev) && device_may_wakeup(dev)) 1037 if (pm_runtime_barrier(dev) && device_may_wakeup(dev))
@@ -1040,7 +1040,7 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
1040 if (pm_wakeup_pending()) { 1040 if (pm_wakeup_pending()) {
1041 pm_runtime_put_sync(dev); 1041 pm_runtime_put_sync(dev);
1042 async_error = -EBUSY; 1042 async_error = -EBUSY;
1043 return 0; 1043 goto Complete;
1044 } 1044 }
1045 1045
1046 device_lock(dev); 1046 device_lock(dev);
@@ -1097,6 +1097,8 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
1097 } 1097 }
1098 1098
1099 device_unlock(dev); 1099 device_unlock(dev);
1100
1101 Complete:
1100 complete_all(&dev->power.completion); 1102 complete_all(&dev->power.completion);
1101 1103
1102 if (error) { 1104 if (error) {