mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: <patrice.chotard@st.com>
To: "Rafael J . Wysocki" <rjw@rjwysocki.net>,
	<linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Ulf Hansson <ulf.hansson@linaro.org>
Cc: <patrice.chotard@st.com>, Erwan Le Ray <erwan.leray@st.com>,
	Alexandre TORGUE <alexandre.torgue@st.com>,
	Fabrice Gasnier <fabrice.gasnier@st.com>
Subject: PM / wakeup: Add dev_wakeup_path() helper
Date: Fri, 20 Mar 2020 12:32:33 +0100	[thread overview]
Message-ID: <20200320113233.10219-1-patrice.chotard@st.com> (raw)

From: Patrice Chotard <patrice.chotard@st.com>

Add dev_wakeup_path() helper to avoid to spread
dev->power.wakeup_path test in drivers.

In case CONFIG_PM_SLEEP is not set, wakeup_path is not defined,
dev_wakeup_path() is returning false.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
---

Currently, in mainline kernel, no drivers are testing dev->power.wakeup_path
for PM purpose. A stm32 serial driver patch will be submitted soon and will 
make usage of this helper.

 include/linux/pm_wakeup.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h
index aa3da6611533..d0bd13c19253 100644
--- a/include/linux/pm_wakeup.h
+++ b/include/linux/pm_wakeup.h
@@ -84,6 +84,11 @@ static inline bool device_may_wakeup(struct device *dev)
 	return dev->power.can_wakeup && !!dev->power.wakeup;
 }
 
+static inline bool device_wakeup_path(struct device *dev)
+{
+	return !!dev->power.wakeup_path;
+}
+
 static inline void device_set_wakeup_path(struct device *dev)
 {
 	dev->power.wakeup_path = true;
@@ -174,6 +179,11 @@ static inline bool device_may_wakeup(struct device *dev)
 	return dev->power.can_wakeup && dev->power.should_wakeup;
 }
 
+static inline bool device_wakeup_path(struct device *dev)
+{
+	return false;
+}
+
 static inline void device_set_wakeup_path(struct device *dev) {}
 
 static inline void __pm_stay_awake(struct wakeup_source *ws) {}
-- 
2.17.1


             reply	other threads:[~2020-03-20 11:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-20 11:32 patrice.chotard [this message]
2020-03-20 11:55 ` Ulf Hansson
2020-03-20 12:48   ` Patrice CHOTARD

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=20200320113233.10219-1-patrice.chotard@st.com \
    --to=patrice.chotard@st.com \
    --cc=alexandre.torgue@st.com \
    --cc=erwan.leray@st.com \
    --cc=fabrice.gasnier@st.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=ulf.hansson@linaro.org \
    /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

all inboxes | Powered by JetHome®