summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHao Chen <chenhao288@hisilicon.com>2021-08-30 14:06:41 +0800
committerDavid S. Miller <davem@davemloft.net>2021-08-30 09:43:18 +0100
commit38b99e1ede3280f0e286071956bd8632737be57b (patch)
tree3539e2f4078504131e524a8ed0b12eab9c9c2db6 /drivers
parent5aea2da5930392055afc82e2fc02e706a022ba43 (diff)
downloadlinux-38b99e1ede3280f0e286071956bd8632737be57b.tar.bz2
net: hnss3: use max() to simplify code
Replace the "? :" statement wich max() to simplify code. Signed-off-by: Hao Chen <chenhao288@hisilicon.com> Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/hisilicon/hns3/hns3_enet.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
index ab14beb65aaf..0680d22485b9 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
@@ -971,8 +971,7 @@ static u32 hns3_tx_spare_space(struct hns3_enet_ring *ring)
/* The free tx buffer is divided into two part, so pick the
* larger one.
*/
- return (ntc > (tx_spare->len - ntu) ? ntc :
- (tx_spare->len - ntu)) - 1;
+ return max(ntc, tx_spare->len - ntu) - 1;
}
static void hns3_tx_spare_update(struct hns3_enet_ring *ring)