Skip to content

Commit

Permalink
net: ethernet: ti: cpsw_priv: using pm_runtime_resume_and_get instead…
Browse files Browse the repository at this point in the history
… of 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 8564886 commit be52d26
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions drivers/net/ethernet/ti/cpsw_priv.c
Original file line number Diff line number Diff line change
Expand Up @@ -755,11 +755,9 @@ int cpsw_ndo_set_tx_maxrate(struct net_device *ndev, int queue, u32 rate)
return -EINVAL;
}

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

ret = cpdma_chan_set_rate(cpsw->txv[queue].ch, ch_rate);
pm_runtime_put(cpsw->dev);
Expand Down Expand Up @@ -971,11 +969,9 @@ static int cpsw_set_cbs(struct net_device *ndev,
return -1;
}

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

bw = qopt->enable ? qopt->idleslope : 0;
ret = cpsw_set_fifo_rlimit(priv, fifo, bw);
Expand Down Expand Up @@ -1009,11 +1005,9 @@ static int cpsw_set_mqprio(struct net_device *ndev, void *type_data)
if (mqprio->mode != TC_MQPRIO_MODE_DCB)
return -EINVAL;

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

if (num_tc) {
for (i = 0; i < 8; i++) {
Expand Down

0 comments on commit be52d26

Please sign in to comment.