Commit e2d0acd4 authored by Minghao Chi's avatar Minghao Chi Committed by Jakub Kicinski

net: stmmac: using pm_runtime_resume_and_get instead of pm_runtime_get_sync

Using pm_runtime_resume_and_get is more appropriate
for simplifing code
Reported-by: default avatarZeal Robot <zealci@zte.com.cn>
Signed-off-by: default avatarMinghao Chi <chi.minghao@zte.com.cn>
Link: https://lore.kernel.org/r/20220408081250.2494588-1-chi.minghao@zte.com.cnSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 1cb9d3b6
...@@ -88,11 +88,9 @@ static int stmmac_xgmac2_mdio_read(struct mii_bus *bus, int phyaddr, int phyreg) ...@@ -88,11 +88,9 @@ static int stmmac_xgmac2_mdio_read(struct mii_bus *bus, int phyaddr, int phyreg)
u32 tmp, addr, value = MII_XGMAC_BUSY; u32 tmp, addr, value = MII_XGMAC_BUSY;
int ret; int ret;
ret = pm_runtime_get_sync(priv->device); ret = pm_runtime_resume_and_get(priv->device);
if (ret < 0) { if (ret < 0)
pm_runtime_put_noidle(priv->device);
return ret; return ret;
}
/* Wait until any existing MII operation is complete */ /* Wait until any existing MII operation is complete */
if (readl_poll_timeout(priv->ioaddr + mii_data, tmp, if (readl_poll_timeout(priv->ioaddr + mii_data, tmp,
...@@ -156,11 +154,9 @@ static int stmmac_xgmac2_mdio_write(struct mii_bus *bus, int phyaddr, ...@@ -156,11 +154,9 @@ static int stmmac_xgmac2_mdio_write(struct mii_bus *bus, int phyaddr,
u32 addr, tmp, value = MII_XGMAC_BUSY; u32 addr, tmp, value = MII_XGMAC_BUSY;
int ret; int ret;
ret = pm_runtime_get_sync(priv->device); ret = pm_runtime_resume_and_get(priv->device);
if (ret < 0) { if (ret < 0)
pm_runtime_put_noidle(priv->device);
return ret; return ret;
}
/* Wait until any existing MII operation is complete */ /* Wait until any existing MII operation is complete */
if (readl_poll_timeout(priv->ioaddr + mii_data, tmp, if (readl_poll_timeout(priv->ioaddr + mii_data, tmp,
...@@ -229,11 +225,9 @@ static int stmmac_mdio_read(struct mii_bus *bus, int phyaddr, int phyreg) ...@@ -229,11 +225,9 @@ static int stmmac_mdio_read(struct mii_bus *bus, int phyaddr, int phyreg)
int data = 0; int data = 0;
u32 v; u32 v;
data = pm_runtime_get_sync(priv->device); data = pm_runtime_resume_and_get(priv->device);
if (data < 0) { if (data < 0)
pm_runtime_put_noidle(priv->device);
return data; return data;
}
value |= (phyaddr << priv->hw->mii.addr_shift) value |= (phyaddr << priv->hw->mii.addr_shift)
& priv->hw->mii.addr_mask; & priv->hw->mii.addr_mask;
...@@ -297,11 +291,9 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg, ...@@ -297,11 +291,9 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,
u32 value = MII_BUSY; u32 value = MII_BUSY;
u32 v; u32 v;
ret = pm_runtime_get_sync(priv->device); ret = pm_runtime_resume_and_get(priv->device);
if (ret < 0) { if (ret < 0)
pm_runtime_put_noidle(priv->device);
return ret; return ret;
}
value |= (phyaddr << priv->hw->mii.addr_shift) value |= (phyaddr << priv->hw->mii.addr_shift)
& priv->hw->mii.addr_mask; & priv->hw->mii.addr_mask;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment