Skip to content

Commit be52d26

Browse files
Minghao Chidavem330
authored andcommitted
net: ethernet: ti: cpsw_priv: 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> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 8564886 commit be52d26

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

drivers/net/ethernet/ti/cpsw_priv.c

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -755,11 +755,9 @@ int cpsw_ndo_set_tx_maxrate(struct net_device *ndev, int queue, u32 rate)
755755
return -EINVAL;
756756
}
757757

758-
ret = pm_runtime_get_sync(cpsw->dev);
759-
if (ret < 0) {
760-
pm_runtime_put_noidle(cpsw->dev);
758+
ret = pm_runtime_resume_and_get(cpsw->dev);
759+
if (ret < 0)
761760
return ret;
762-
}
763761

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

974-
ret = pm_runtime_get_sync(cpsw->dev);
975-
if (ret < 0) {
976-
pm_runtime_put_noidle(cpsw->dev);
972+
ret = pm_runtime_resume_and_get(cpsw->dev);
973+
if (ret < 0)
977974
return ret;
978-
}
979975

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

1012-
ret = pm_runtime_get_sync(cpsw->dev);
1013-
if (ret < 0) {
1014-
pm_runtime_put_noidle(cpsw->dev);
1008+
ret = pm_runtime_resume_and_get(cpsw->dev);
1009+
if (ret < 0)
10151010
return ret;
1016-
}
10171011

10181012
if (num_tc) {
10191013
for (i = 0; i < 8; i++) {

0 commit comments

Comments
 (0)