All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Kishon Vijay Abraham I <kishon@ti.com>
Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
	linux-omap@vger.kernel.org, Pavel Machek <pavel@ucw.cz>,
	Sebastian Reichel <sre@kernel.org>
Subject: [PATCH 1/2] phy: core: Add phy_pm_runtime_enabled
Date: Sat, 17 Nov 2018 05:37:54 -0800	[thread overview]
Message-ID: <20181117133755.9129-2-tony@atomide.com> (raw)
In-Reply-To: <20181117133755.9129-1-tony@atomide.com>

The phy driver may need to check phy_pm_runtime_enabled() in suspend as
PM runtime for phy may be already disabled when phy power_off() is called.

Cc: Pavel Machek <pavel@ucw.cz>
Cc: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/phy/phy-core.c  | 9 +++++++++
 include/linux/phy/phy.h | 6 ++++++
 2 files changed, 15 insertions(+)

diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -209,6 +209,15 @@ int phy_pm_runtime_put_sync(struct phy *phy)
 }
 EXPORT_SYMBOL_GPL(phy_pm_runtime_put_sync);
 
+bool phy_pm_runtime_enabled(struct phy *phy)
+{
+	if (!phy)
+		return false;
+
+	return pm_runtime_enabled(&phy->dev);
+}
+EXPORT_SYMBOL_GPL(phy_pm_runtime_enabled);
+
 void phy_pm_runtime_allow(struct phy *phy)
 {
 	if (!phy)
diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h
--- a/include/linux/phy/phy.h
+++ b/include/linux/phy/phy.h
@@ -158,6 +158,7 @@ int phy_pm_runtime_get(struct phy *phy);
 int phy_pm_runtime_get_sync(struct phy *phy);
 int phy_pm_runtime_put(struct phy *phy);
 int phy_pm_runtime_put_sync(struct phy *phy);
+bool phy_pm_runtime_enabled(struct phy *phy);
 void phy_pm_runtime_allow(struct phy *phy);
 void phy_pm_runtime_forbid(struct phy *phy);
 int phy_init(struct phy *phy);
@@ -240,6 +241,11 @@ static inline int phy_pm_runtime_put_sync(struct phy *phy)
 	return -ENOSYS;
 }
 
+static inline bool phy_pm_runtime_enabled(struct phy *phy)
+{
+	return false
+}
+
 static inline void phy_pm_runtime_allow(struct phy *phy)
 {
 	return;
-- 
2.19.1

WARNING: multiple messages have this Message-ID (diff)
From: Tony Lindgren <tony@atomide.com>
To: Kishon Vijay Abraham I <kishon@ti.com>
Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
	linux-omap@vger.kernel.org, Pavel Machek <pavel@ucw.cz>,
	Sebastian Reichel <sre@kernel.org>
Subject: [1/2] phy: core: Add phy_pm_runtime_enabled
Date: Sat, 17 Nov 2018 05:37:54 -0800	[thread overview]
Message-ID: <20181117133755.9129-2-tony@atomide.com> (raw)

The phy driver may need to check phy_pm_runtime_enabled() in suspend as
PM runtime for phy may be already disabled when phy power_off() is called.

Cc: Pavel Machek <pavel@ucw.cz>
Cc: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/phy/phy-core.c  | 9 +++++++++
 include/linux/phy/phy.h | 6 ++++++
 2 files changed, 15 insertions(+)

diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -209,6 +209,15 @@ int phy_pm_runtime_put_sync(struct phy *phy)
 }
 EXPORT_SYMBOL_GPL(phy_pm_runtime_put_sync);
 
+bool phy_pm_runtime_enabled(struct phy *phy)
+{
+	if (!phy)
+		return false;
+
+	return pm_runtime_enabled(&phy->dev);
+}
+EXPORT_SYMBOL_GPL(phy_pm_runtime_enabled);
+
 void phy_pm_runtime_allow(struct phy *phy)
 {
 	if (!phy)
diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h
--- a/include/linux/phy/phy.h
+++ b/include/linux/phy/phy.h
@@ -158,6 +158,7 @@ int phy_pm_runtime_get(struct phy *phy);
 int phy_pm_runtime_get_sync(struct phy *phy);
 int phy_pm_runtime_put(struct phy *phy);
 int phy_pm_runtime_put_sync(struct phy *phy);
+bool phy_pm_runtime_enabled(struct phy *phy);
 void phy_pm_runtime_allow(struct phy *phy);
 void phy_pm_runtime_forbid(struct phy *phy);
 int phy_init(struct phy *phy);
@@ -240,6 +241,11 @@ static inline int phy_pm_runtime_put_sync(struct phy *phy)
 	return -ENOSYS;
 }
 
+static inline bool phy_pm_runtime_enabled(struct phy *phy)
+{
+	return false
+}
+
 static inline void phy_pm_runtime_allow(struct phy *phy)
 {
 	return;

  reply	other threads:[~2018-11-17 13:37 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-17 13:37 [PATCH 0/2] Improve phy-mapphone pm Tony Lindgren
2018-11-17 13:37 ` Tony Lindgren [this message]
2018-11-17 13:37   ` [1/2] phy: core: Add phy_pm_runtime_enabled Tony Lindgren
2018-11-17 15:38   ` [PATCH 1/2] " Johan Hovold
2018-11-17 15:38     ` [1/2] " Johan Hovold
2018-11-17 15:43     ` [PATCH 1/2] " Tony Lindgren
2018-11-17 15:43       ` [1/2] " Tony Lindgren
2019-06-02 10:14       ` [PATCH 1/2] " Pavel Machek
2019-06-02 10:25         ` Pavel Machek
2018-11-19 14:46   ` kbuild test robot
2018-11-19 14:46     ` [1/2] " kbuild test robot
2018-11-17 13:37 ` [PATCH 2/2] phy: mapphone-mdm6600: Improve phy related runtime PM calls Tony Lindgren
2018-11-17 13:37   ` [2/2] " Tony Lindgren
2018-11-23  7:59   ` [PATCH 2/2] " Kishon Vijay Abraham I
2018-11-23  7:59     ` Kishon Vijay Abraham I
2018-11-23  7:59     ` [2/2] " Kishon Vijay Abraham I
2018-11-23 16:58     ` [PATCH 2/2] " Tony Lindgren
2018-11-23 16:58       ` [2/2] " Tony Lindgren

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=20181117133755.9129-2-tony@atomide.com \
    --to=tony@atomide.com \
    --cc=kishon@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=sre@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.