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-zhangqilo...@huawei.com/T/#t Fixes: dd8088d5a8969dc2 ("PM runtime: Add pm_runtime_resume_and_get to deal with usage counter") Signed-off-by: Zhang Qilong <zhangqilo...@huawei.com> --- 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