Linux-PM Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v1] PM-runtime: Make clear what we do when conditions are wrong in rpm_suspend()
@ 2020-05-22 15:09 Andy Shevchenko
  2020-05-25  8:58 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2020-05-22 15:09 UTC (permalink / raw)
  To: Rafael J. Wysocki, linux-pm; +Cc: 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().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/base/power/runtime.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
index 99c7da112c95..9f62790f644c 100644
--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -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;
-- 
2.26.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v1] PM-runtime: Make clear what we do when conditions are wrong in rpm_suspend()
  2020-05-22 15:09 [PATCH v1] PM-runtime: Make clear what we do when conditions are wrong in rpm_suspend() Andy Shevchenko
@ 2020-05-25  8:58 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2020-05-25  8:58 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Rafael J. Wysocki, Linux PM

On Fri, May 22, 2020 at 5:10 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> 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().
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/base/power/runtime.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
> index 99c7da112c95..9f62790f644c 100644
> --- a/drivers/base/power/runtime.c
> +++ b/drivers/base/power/runtime.c
> @@ -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;
> --

Applied as 5.8 material, thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-22 15:09 [PATCH v1] PM-runtime: Make clear what we do when conditions are wrong in rpm_suspend() Andy Shevchenko
2020-05-25  8:58 ` Rafael J. Wysocki

Linux-PM Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-pm/0 linux-pm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-pm linux-pm/ https://lore.kernel.org/linux-pm \
		linux-pm@vger.kernel.org
	public-inbox-index linux-pm

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-pm


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git