Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
Link: https://lore.kernel.org/r/20220408081250.2494588-1-chi.minghao@zte.com.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Minghao Chi and committed by
Jakub Kicinski
e2d0acd4 1cb9d3b6

+8 -16
+8 -16
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
··· 88 88 u32 tmp, addr, value = MII_XGMAC_BUSY; 89 89 int ret; 90 90 91 - ret = pm_runtime_get_sync(priv->device); 92 - if (ret < 0) { 93 - pm_runtime_put_noidle(priv->device); 91 + ret = pm_runtime_resume_and_get(priv->device); 92 + if (ret < 0) 94 93 return ret; 95 - } 96 94 97 95 /* Wait until any existing MII operation is complete */ 98 96 if (readl_poll_timeout(priv->ioaddr + mii_data, tmp, ··· 154 156 u32 addr, tmp, value = MII_XGMAC_BUSY; 155 157 int ret; 156 158 157 - ret = pm_runtime_get_sync(priv->device); 158 - if (ret < 0) { 159 - pm_runtime_put_noidle(priv->device); 159 + ret = pm_runtime_resume_and_get(priv->device); 160 + if (ret < 0) 160 161 return ret; 161 - } 162 162 163 163 /* Wait until any existing MII operation is complete */ 164 164 if (readl_poll_timeout(priv->ioaddr + mii_data, tmp, ··· 225 229 int data = 0; 226 230 u32 v; 227 231 228 - data = pm_runtime_get_sync(priv->device); 229 - if (data < 0) { 230 - pm_runtime_put_noidle(priv->device); 232 + data = pm_runtime_resume_and_get(priv->device); 233 + if (data < 0) 231 234 return data; 232 - } 233 235 234 236 value |= (phyaddr << priv->hw->mii.addr_shift) 235 237 & priv->hw->mii.addr_mask; ··· 291 297 u32 value = MII_BUSY; 292 298 u32 v; 293 299 294 - ret = pm_runtime_get_sync(priv->device); 295 - if (ret < 0) { 296 - pm_runtime_put_noidle(priv->device); 300 + ret = pm_runtime_resume_and_get(priv->device); 301 + if (ret < 0) 297 302 return ret; 298 - } 299 303 300 304 value |= (phyaddr << priv->hw->mii.addr_shift) 301 305 & priv->hw->mii.addr_mask;