[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250709022210.304030-3-rongqianfeng@vivo.com>
Date: Wed, 9 Jul 2025 10:21:30 +0800
From: Qianfeng Rong <rongqianfeng@...o.com>
To: Potnuri Bharat Teja <bharat@...lsio.com>,
Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
netdev@...r.kernel.org (open list:CXGB4 ETHERNET DRIVER (CXGB4)),
linux-kernel@...r.kernel.org (open list)
Cc: Qianfeng Rong <rongqianfeng@...o.com>
Subject: [PATCH 02/12] ethernet: cxgb4: Use min() to improve code
Use min() to reduce the code and improve its readability.
Signed-off-by: Qianfeng Rong <rongqianfeng@...o.com>
---
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
index 175bf9b13058..c9546863bebe 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
@@ -10192,10 +10192,7 @@ int t4_load_cfg(struct adapter *adap, const u8 *cfg_data, unsigned int size)
/* this will write to the flash up to SF_PAGE_SIZE at a time */
for (i = 0; i < size; i += SF_PAGE_SIZE) {
- if ((size - i) < SF_PAGE_SIZE)
- n = size - i;
- else
- n = SF_PAGE_SIZE;
+ n = min(size - i, SF_PAGE_SIZE);
ret = t4_write_flash(adap, addr, n, cfg_data, true);
if (ret)
goto out;
--
2.34.1
Powered by blists - more mailing lists