Skip to contentSkip to conversation

PM-runtime: Make clear what we do when conditions are wrong in rpm_suspend()

PATCH Applied Andy Shevchenko 2 participants 2 messages May 22, 2020 – May 25, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PM-runtime: Make clear what we do when conditions are wrong in rpm_suspend()

rpm_suspend() simple bails out when conditions are wrong. But this is not immediately obvious from the code. Make it clear what we do when conditions are wrong in rpm_suspend().

---
 drivers/base/power/runtime.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/base/power/runtime.c +2 -4
index 99c7da112c95..9f62790f644c 100644
@@ -523,13 +523,11 @@ static int rpm_suspend(struct device *dev, int rpmflags)
 
  repeat:
 	retval = rpm_check_suspend_allowed(dev);
-
 	if (retval < 0)
-		;	/* Conditions are wrong. */
+		goto out;	/* Conditions are wrong. */
 
 	/* Synchronous suspends are not allowed in the RPM_RESUMING state. */
-	else if (dev->power.runtime_status == RPM_RESUMING &&
-	    !(rpmflags & RPM_ASYNC))
+	if (dev->power.runtime_status == RPM_RESUMING && !(rpmflags & RPM_ASYNC))
 		retval = -EAGAIN;
 	if (retval)
 		goto out;
Signature · 1 line
2.26.2
maintainer Applied
#1 lore raw
Quoted 21 lines · Andy Shevchenko

rpm_suspend() simple bails out when conditions are wrong. But this is not immediately obvious from the code. Make it clear what we do when conditions are wrong in rpm_suspend().

---
 drivers/base/power/runtime.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/base/power/runtime.c +0 -2
index 99c7da112c95..9f62790f644c 100644
@@ -523,13 +523,11 @@ static int rpm_suspend(struct device *dev, int rpmflags)
 
  repeat:
        retval = rpm_check_suspend_allowed(dev);
-
        if (retval < 0)
-               ;       /* Conditions are wrong. */

drivers/base/power/runtime.c static int rpm_suspend(struct device *dev, int rpmflags)

Quoted 10 lines
drivers/base/power/runtime.c +2 -3
+               goto out;       /* Conditions are wrong. */
 
        /* Synchronous suspends are not allowed in the RPM_RESUMING state. */
-       else if (dev->power.runtime_status == RPM_RESUMING &&
-           !(rpmflags & RPM_ASYNC))
+       if (dev->power.runtime_status == RPM_RESUMING && !(rpmflags & RPM_ASYNC))
                retval = -EAGAIN;
        if (retval)
                goto out;
--

Applied as 5.8 material, thanks!