From: Guangbin Huang <huangguangbin2@huawei.com>
To: <davem@davemloft.net>, <kuba@kernel.org>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<lipeng321@huawei.com>, <chenhao288@hisilicon.com>,
<huangguangbin2@huawei.com>
Subject: [PATCH net-next 6/7] net: hnss3: use max() to simplify code
Date: Mon, 30 Aug 2021 14:06:41 +0800 [thread overview]
Message-ID: <1630303602-44870-7-git-send-email-huangguangbin2@huawei.com> (raw)
In-Reply-To: <1630303602-44870-1-git-send-email-huangguangbin2@huawei.com>
From: Hao Chen <chenhao288@hisilicon.com>
Replace the "? :" statement wich max() to simplify code.
Signed-off-by: Hao Chen <chenhao288@hisilicon.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
---
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
index ab14beb65aaf..4b8d3b64f567 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)
--
2.8.1
next prev parent reply other threads:[~2021-08-30 6:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-30 6:06 [PATCH net-next 0/7] net: hns3: add some cleanups Guangbin Huang
2021-08-30 6:06 ` [PATCH net-next 1/7] net: hns3: initialize each member of structure array on a separate line Guangbin Huang
2021-08-30 6:06 ` [PATCH net-next 2/7] net: hns3: reconstruct function hns3_self_test Guangbin Huang
2021-08-30 6:06 ` [PATCH net-next 3/7] net: hns3: reconstruct function hclge_ets_validate() Guangbin Huang
2021-08-30 6:06 ` [PATCH net-next 4/7] net: hns3: refine function hclge_dbg_dump_tm_pri() Guangbin Huang
2021-08-30 6:06 ` [PATCH net-next 5/7] net: hns3: modify a print format of hns3_dbg_queue_map() Guangbin Huang
2021-08-30 6:06 ` Guangbin Huang [this message]
2021-08-30 6:06 ` [PATCH net-next 7/7] net: hns3: uniform parameter name of hclge_ptp_clean_tx_hwts() Guangbin Huang
2021-08-30 8:50 ` [PATCH net-next 0/7] net: hns3: add some cleanups patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1630303602-44870-7-git-send-email-huangguangbin2@huawei.com \
--to=huangguangbin2@huawei.com \
--cc=chenhao288@hisilicon.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lipeng321@huawei.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®