Skip to content

Commit e66332a

Browse files
committed
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>
1 parent 521a547 commit e66332a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/base/power/runtime.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -792,10 +792,13 @@ static int rpm_resume(struct device *dev, int rpmflags)
792792
DEFINE_WAIT(wait);
793793

794794
if (rpmflags & (RPM_ASYNC | RPM_NOWAIT)) {
795-
if (dev->power.runtime_status == RPM_SUSPENDING)
795+
if (dev->power.runtime_status == RPM_SUSPENDING) {
796796
dev->power.deferred_resume = true;
797-
else
797+
if (rpmflags & RPM_NOWAIT)
798+
retval = -EINPROGRESS;
799+
} else {
798800
retval = -EINPROGRESS;
801+
}
799802
goto out;
800803
}
801804

0 commit comments

Comments
 (0)