linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ulf Hansson <ulf.hansson@linaro.org>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Alan Stern <stern@rowland.harvard.edu>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	linux-pm@vger.kernel.org
Cc: Len Brown <len.brown@intel.com>, Pavel Machek <pavel@ucw.cz>,
	Kevin Hilman <khilman@kernel.org>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Lina Iyer <lina.iyer@linaro.org>,
	Jon Hunter <jonathanh@nvidia.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Linus Walleij <linus.walleij@linaro.org>
Subject: [PATCH 3/4] PM / Runtime: Convert pm_runtime_set_suspended() to return an int
Date: Mon, 17 Oct 2016 20:17:00 +0200	[thread overview]
Message-ID: <1476728221-26530-4-git-send-email-ulf.hansson@linaro.org> (raw)
In-Reply-To: <1476728221-26530-1-git-send-email-ulf.hansson@linaro.org>

Because pm_runtime_set_suspended() invokes __pm_runtime_set_status(), which
can fail, pm_runtime_set_suspended() can also fail.

Instead of hiding a potential error, let's propagate it by converting
pm_runtime_set_suspended() from a void to return an int. In this way users
are able to check the error code and act accordingly.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 include/linux/pm_runtime.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index 61ea566..4957fc1 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -258,9 +258,9 @@ static inline int pm_runtime_set_active(struct device *dev)
 	return __pm_runtime_set_status(dev, RPM_ACTIVE);
 }
 
-static inline void pm_runtime_set_suspended(struct device *dev)
+static inline int pm_runtime_set_suspended(struct device *dev)
 {
-	__pm_runtime_set_status(dev, RPM_SUSPENDED);
+	return __pm_runtime_set_status(dev, RPM_SUSPENDED);
 }
 
 static inline void pm_runtime_disable(struct device *dev)
-- 
1.9.1


  parent reply	other threads:[~2016-10-17 18:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-17 18:16 [PATCH 0/4] PM / Runtime: Improvements for parent/child relations Ulf Hansson
2016-10-17 18:16 ` [PATCH 1/4] PM / Runtime: Remove the exported function pm_children_suspended() Ulf Hansson
2016-10-21 12:20   ` Linus Walleij
2016-10-17 18:16 ` [PATCH 2/4] PM / Runtime: Clarify comment in rpm_resume() when resuming the parent Ulf Hansson
2016-10-21 12:21   ` Linus Walleij
2016-10-17 18:17 ` Ulf Hansson [this message]
2016-10-21 12:21   ` [PATCH 3/4] PM / Runtime: Convert pm_runtime_set_suspended() to return an int Linus Walleij
2016-10-17 18:17 ` [PATCH 4/4] PM / Runtime: Don't allow to suspend a device with an active child Ulf Hansson
2016-10-21 12:23   ` Linus Walleij
2016-10-25 13:59   ` Geert Uytterhoeven
2016-10-25 21:31     ` Ulf Hansson
2016-10-26  9:47       ` Geert Uytterhoeven
2016-10-26 11:30         ` Ulf Hansson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1476728221-26530-4-git-send-email-ulf.hansson@linaro.org \
    --to=ulf.hansson@linaro.org \
    --cc=geert@linux-m68k.org \
    --cc=jonathanh@nvidia.com \
    --cc=khilman@kernel.org \
    --cc=len.brown@intel.com \
    --cc=lina.iyer@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=pavel@ucw.cz \
    --cc=rjw@rjwysocki.net \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).