net: hnss3: use max() to simplify code
authorHao Chen <chenhao288@hisilicon.com>
Mon, 30 Aug 2021 06:06:41 +0000 (14:06 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 30 Aug 2021 08:43:18 +0000 (09:43 +0100)
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>
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c

index ab14beb..0680d22 100644 (file)
@@ -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)