Skip to content

Commit

Permalink
net: stmmac: stmmac_main: using pm_runtime_resume_and_get instead of …
Browse files Browse the repository at this point in the history
…pm_runtime_get_sync

Using pm_runtime_resume_and_get is more appropriate
for simplifing code

Reported-by: Zeal Robot <[email protected]>
Signed-off-by: Minghao Chi <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Minghao Chi authored and davem330 committed Apr 15, 2022
1 parent c557a9a commit 8564886
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3643,11 +3643,9 @@ static int stmmac_open(struct net_device *dev)
u32 chan;
int ret;

ret = pm_runtime_get_sync(priv->device);
if (ret < 0) {
pm_runtime_put_noidle(priv->device);
ret = pm_runtime_resume_and_get(priv->device);
if (ret < 0)
return ret;
}

if (priv->hw->pcs != STMMAC_PCS_TBI &&
priv->hw->pcs != STMMAC_PCS_RTBI &&
Expand Down Expand Up @@ -5886,11 +5884,9 @@ static int stmmac_set_mac_address(struct net_device *ndev, void *addr)
struct stmmac_priv *priv = netdev_priv(ndev);
int ret = 0;

ret = pm_runtime_get_sync(priv->device);
if (ret < 0) {
pm_runtime_put_noidle(priv->device);
ret = pm_runtime_resume_and_get(priv->device);
if (ret < 0)
return ret;
}

ret = eth_mac_addr(ndev, addr);
if (ret)
Expand Down Expand Up @@ -6220,11 +6216,9 @@ static int stmmac_vlan_rx_kill_vid(struct net_device *ndev, __be16 proto, u16 vi
bool is_double = false;
int ret;

ret = pm_runtime_get_sync(priv->device);
if (ret < 0) {
pm_runtime_put_noidle(priv->device);
ret = pm_runtime_resume_and_get(priv->device);
if (ret < 0)
return ret;
}

if (be16_to_cpu(proto) == ETH_P_8021AD)
is_double = true;
Expand Down

0 comments on commit 8564886

Please sign in to comment.