summaryrefslogtreecommitdiff
path: root/drivers/base
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2022-09-22 21:04:40 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2022-09-24 20:28:51 +0300
commite66332a4bc89e3219baaabc7bb549d17a2c42ce9 (patch)
tree58023082f3deebb5d6eb02de33e908948732ac3f /drivers/base
parent521a547ced6477c54b4b0cc206000406c221b4d6 (diff)
downloadlinux-e66332a4bc89e3219baaabc7bb549d17a2c42ce9.tar.xz
PM: runtime: Return -EINPROGRESS from rpm_resume() in the RPM_NOWAIT case
The prospective callers of rpm_resume() passing RPM_NOWAIT to it may be confused when it returns 0 without actually resuming the device which may happen if the device is suspending at the given time and it will only resume when the suspend in progress has completed. To avoid that confusion, return -EINPROGRESS from rpm_resume() in that case. Since none of the current callers passing RPM_NOWAIT to rpm_resume() check its return value, this change has no functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Reviewed-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/power/runtime.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
index 997be3ac20a7..b52049098d4e 100644
--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -792,10 +792,13 @@ static int rpm_resume(struct device *dev, int rpmflags)
DEFINE_WAIT(wait);
if (rpmflags & (RPM_ASYNC | RPM_NOWAIT)) {
- if (dev->power.runtime_status == RPM_SUSPENDING)
+ if (dev->power.runtime_status == RPM_SUSPENDING) {
dev->power.deferred_resume = true;
- else
+ if (rpmflags & RPM_NOWAIT)
+ retval = -EINPROGRESS;
+ } else {
retval = -EINPROGRESS;
+ }
goto out;
}