All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhang Qilong <zhangqilong3@huawei.com>
To: <kuba@kernel.org>, <fugang.duan@nxp.com>, <davem@davemloft.net>,
	<rjw@rjwysocki.net>, <geert@linux-m68k.org>
Cc: <netdev@vger.kernel.org>, <linux-pm@vger.kernel.org>
Subject: [PATCH v2] PM: runtime: replace pm_runtime_resume_and_get with pm_runtime_resume_and_get_sync
Date: Sat, 28 Nov 2020 14:52:43 +0800	[thread overview]
Message-ID: <20201128065243.2870987-1-zhangqilong3@huawei.com> (raw)

In the pm_runtime_resume_and_get, pm_runtime_resume() is
synchronous. Caller had to look into the implementation
to verify that a change for pm_runtime_resume_and_get [0].
So we use pm_rauntime_resume_and_get_sync to replace it to
avoid making the same mistake while fixing
pm_runtime_get_sync.

[0]https://lore.kernel.org/netdev/20201110092933.3342784-1-zhangqilong3@huawei.com/T/#t
Fixes: dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter")
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
---
Changelog:
v2
- change the fixes tag.
---
 drivers/net/ethernet/freescale/fec_main.c | 10 +++++-----
 include/linux/pm_runtime.h                |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 04f24c66cf36..6bfc46da2943 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -1808,7 +1808,7 @@ static int fec_enet_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
 	int ret = 0, frame_start, frame_addr, frame_op;
 	bool is_c45 = !!(regnum & MII_ADDR_C45);
 
-	ret = pm_runtime_resume_and_get(dev);
+	ret = pm_runtime_resume_and_get_sync(dev);
 	if (ret < 0)
 		return ret;
 
@@ -1867,7 +1867,7 @@ static int fec_enet_mdio_write(struct mii_bus *bus, int mii_id, int regnum,
 	int ret, frame_start, frame_addr;
 	bool is_c45 = !!(regnum & MII_ADDR_C45);
 
-	ret = pm_runtime_resume_and_get(dev);
+	ret = pm_runtime_resume_and_get_sync(dev);
 	if (ret < 0)
 		return ret;
 
@@ -2273,7 +2273,7 @@ static void fec_enet_get_regs(struct net_device *ndev,
 	u32 i, off;
 	int ret;
 
-	ret = pm_runtime_resume_and_get(dev);
+	ret = pm_runtime_resume_and_get_sync(dev);
 	if (ret < 0)
 		return;
 
@@ -2974,7 +2974,7 @@ fec_enet_open(struct net_device *ndev)
 	int ret;
 	bool reset_again;
 
-	ret = pm_runtime_resume_and_get(&fep->pdev->dev);
+	ret = pm_runtime_resume_and_get_sync(&fep->pdev->dev);
 	if (ret < 0)
 		return ret;
 
@@ -3768,7 +3768,7 @@ fec_drv_remove(struct platform_device *pdev)
 	struct device_node *np = pdev->dev.of_node;
 	int ret;
 
-	ret = pm_runtime_resume_and_get(&pdev->dev);
+	ret = pm_runtime_resume_and_get_sync(&pdev->dev);
 	if (ret < 0)
 		return ret;
 
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index b492ae00cc90..c83edb7473fc 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -387,14 +387,14 @@ static inline int pm_runtime_get_sync(struct device *dev)
 }
 
 /**
- * pm_runtime_resume_and_get - Bump up usage counter of a device and resume it.
+ * pm_runtime_resume_and_get_sync - Bump up usage counter of a device and resume it.
  * @dev: Target device.
  *
  * Resume @dev synchronously and if that is successful, increment its runtime
  * PM usage counter. Return 0 if the runtime PM usage counter of @dev has been
  * incremented or a negative error code otherwise.
  */
-static inline int pm_runtime_resume_and_get(struct device *dev)
+static inline int pm_runtime_resume_and_get_sync(struct device *dev)
 {
 	int ret;
 
-- 
2.25.4


             reply	other threads:[~2020-11-28 22:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-28  6:52 Zhang Qilong [this message]
2020-11-30 14:26 ` [PATCH v2] PM: runtime: replace pm_runtime_resume_and_get with pm_runtime_resume_and_get_sync Rafael J. Wysocki

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=20201128065243.2870987-1-zhangqilong3@huawei.com \
    --to=zhangqilong3@huawei.com \
    --cc=davem@davemloft.net \
    --cc=fugang.duan@nxp.com \
    --cc=geert@linux-m68k.org \
    --cc=kuba@kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    /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.