All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] PM: runtime: replace pm_runtime_resume_and_get with pm_runtime_resume_and_get_sync
@ 2020-11-28  6:52 Zhang Qilong
  2020-11-30 14:26 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Zhang Qilong @ 2020-11-28  6:52 UTC (permalink / raw)
  To: kuba, fugang.duan, davem, rjw, geert; +Cc: netdev, linux-pm

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


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

* Re: [PATCH v2] PM: runtime: replace pm_runtime_resume_and_get with pm_runtime_resume_and_get_sync
  2020-11-28  6:52 [PATCH v2] PM: runtime: replace pm_runtime_resume_and_get with pm_runtime_resume_and_get_sync Zhang Qilong
@ 2020-11-30 14:26 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2020-11-30 14:26 UTC (permalink / raw)
  To: Zhang Qilong
  Cc: Jakub Kicinski, Fugang Duan, David Miller, Rafael J. Wysocki,
	Geert Uytterhoeven, netdev, Linux PM

On Sat, Nov 28, 2020 at 11:17 PM Zhang Qilong <zhangqilong3@huawei.com> wrote:
>
> 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].

Well, "resume" is "sync" by definition.

> So we use pm_rauntime_resume_and_get_sync to replace it to
> avoid making the same mistake while fixing
> pm_runtime_get_sync.

No, we are not making this change.

Thanks!

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

end of thread, other threads:[~2020-11-30 14:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-28  6:52 [PATCH v2] PM: runtime: replace pm_runtime_resume_and_get with pm_runtime_resume_and_get_sync Zhang Qilong
2020-11-30 14:26 ` Rafael J. Wysocki

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.