* [PATCH 00/12] net: Use min()/max() to improve code
@ 2025-07-08 13:55 Qianfeng Rong
2025-07-08 14:12 ` Jakub Kicinski
2025-07-08 14:15 ` Qianfeng Rong
0 siblings, 2 replies; 12+ messages in thread
From: Qianfeng Rong @ 2025-07-08 13:55 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Potnuri Bharat Teja, Veerasenareddy Burru,
Sathesh Edara, Louis Peens, Shahed Shaikh, Manish Chopra,
GR-Linux-NIC-Dev, Jiri Slaby, Nick Kossifidis, Luis Chamberlain,
Toke Høiland-Jørgensen, Arend van Spriel, Brian Norris,
Francesco Dolcini, Ajay Singh, Claudiu Beznea, Ping-Ke Shih,
Qianfeng Rong, Kees Cook, Gustavo A. R. Silva,
Benjamin Große, Hayes Wang, Lucas Sanchez Sagrado,
Philipp Hahn, Aleksander Jan Bajkowski, Eric Biggers,
Wentao Liang, Johannes Berg, Sebastian Reichel, Ondrej Jirman,
Jacobe Zang, Dmitry Antipov, Kalle Valo, Sascha Hauer,
Aditya Kumar Singh, David Lin, Roopni Devanathan,
Rameshkumar Sundaram, Marek Vasut, Alexis Lothoré,
Arnd Bergmann, netdev, linux-kernel, oss-drivers, linux-usb,
linux-wireless, brcm80211, brcm80211-dev-list.pdl
Cc: opensource.kernel
Use min() to reduce the code and improve its readability.
No functional changes.
Qianfeng Rong (12):
ethernet: liquidio: Use min() to improve code
ethernet: cxgb4: Use min() to improve code
ethernet: octeon_ep: Use min() to improve code
ethernet: nfp: Use min()/max() to improve code
ethernet: qlcnic: Use min() to improve code
net: usb: Use min() to improve code
wifi: ath5k: Use max() to improve code
wifi: ath9k: Use max() to improve code
wifi: brcm80211: Use min() to improve code
wifi: mwifiex: Use max() to improve code
wifi: wilc1000: Use min() to improve code
wifi: rtlwifi: Use min()/max() to improve code
.../ethernet/cavium/liquidio/octeon_console.c | 5 +----
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 5 +----
.../marvell/octeon_ep/octep_pfvf_mbox.c | 5 +----
.../ethernet/netronome/nfp/nfp_netvf_main.c | 13 ++++---------
.../ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | 5 +----
drivers/net/usb/r8152.c | 5 +----
drivers/net/wireless/ath/ath5k/phy.c | 12 +++---------
drivers/net/wireless/ath/ath9k/dfs.c | 5 +----
.../broadcom/brcm80211/brcmfmac/usb.c | 5 +----
.../broadcom/brcm80211/brcmsmac/phy/phy_n.c | 6 ++----
.../net/wireless/marvell/mwifiex/cfg80211.c | 6 ++----
.../net/wireless/microchip/wilc1000/wlan.c | 5 +----
.../wireless/realtek/rtlwifi/rtl8192ce/hw.c | 19 +++----------------
.../wireless/realtek/rtlwifi/rtl8192cu/hw.c | 17 +++--------------
.../wireless/realtek/rtlwifi/rtl8192ee/dm.c | 5 +----
.../wireless/realtek/rtlwifi/rtl8723ae/hw.c | 15 +++------------
.../wireless/realtek/rtlwifi/rtl8723be/dm.c | 5 +----
.../wireless/realtek/rtlwifi/rtl8821ae/dm.c | 5 +----
18 files changed, 31 insertions(+), 112 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 00/12] net: Use min()/max() to improve code
2025-07-08 13:55 Qianfeng Rong
@ 2025-07-08 14:12 ` Jakub Kicinski
2025-07-08 14:15 ` Qianfeng Rong
1 sibling, 0 replies; 12+ messages in thread
From: Jakub Kicinski @ 2025-07-08 14:12 UTC (permalink / raw)
To: Qianfeng Rong
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Paolo Abeni,
Potnuri Bharat Teja, Veerasenareddy Burru, Sathesh Edara,
Louis Peens, Shahed Shaikh, Manish Chopra, GR-Linux-NIC-Dev,
Jiri Slaby, Nick Kossifidis, Luis Chamberlain,
Toke Høiland-Jørgensen, Arend van Spriel, Brian Norris,
Francesco Dolcini, Ajay Singh, Claudiu Beznea, Ping-Ke Shih,
Kees Cook, Gustavo A. R. Silva, Benjamin Große, Hayes Wang,
Lucas Sanchez Sagrado, Philipp Hahn, Aleksander Jan Bajkowski,
Eric Biggers, Wentao Liang, Johannes Berg, Sebastian Reichel,
Ondrej Jirman, Jacobe Zang, Dmitry Antipov, Kalle Valo,
Sascha Hauer, Aditya Kumar Singh, David Lin, Roopni Devanathan,
Rameshkumar Sundaram, Marek Vasut, Alexis Lothoré,
Arnd Bergmann, netdev, linux-kernel, oss-drivers, linux-usb,
linux-wireless, brcm80211, brcm80211-dev-list.pdl,
opensource.kernel
On Tue, 8 Jul 2025 21:55:50 +0800 Qianfeng Rong wrote:
> Use min() to reduce the code and improve its readability.
>
> No functional changes.
I don't see any patches on the list, 15 min after receiving this cover
letter. But either way, this sort of changes are not worth the churn.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 00/12] net: Use min()/max() to improve code
2025-07-08 13:55 Qianfeng Rong
2025-07-08 14:12 ` Jakub Kicinski
@ 2025-07-08 14:15 ` Qianfeng Rong
1 sibling, 0 replies; 12+ messages in thread
From: Qianfeng Rong @ 2025-07-08 14:15 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Potnuri Bharat Teja, Veerasenareddy Burru,
Sathesh Edara, Louis Peens, Shahed Shaikh, Manish Chopra,
GR-Linux-NIC-Dev, Jiri Slaby, Nick Kossifidis, Luis Chamberlain,
Toke Høiland-Jørgensen, Arend van Spriel, Brian Norris,
Francesco Dolcini, Ajay Singh, Claudiu Beznea, Ping-Ke Shih,
Kees Cook, Gustavo A. R. Silva, Benjamin Große, Hayes Wang,
Lucas Sanchez Sagrado, Philipp Hahn, Aleksander Jan Bajkowski,
Eric Biggers, Wentao Liang, Johannes Berg, Sebastian Reichel,
Ondrej Jirman, Jacobe Zang, Dmitry Antipov, Kalle Valo,
Sascha Hauer, Aditya Kumar Singh, David Lin, Roopni Devanathan,
Rameshkumar Sundaram, Marek Vasut, Alexis Lothoré,
Arnd Bergmann, netdev, linux-kernel, oss-drivers, linux-usb,
linux-wireless, brcm80211, brcm80211-dev-list.pdl
Cc: opensource.kernel
Hi all,
Sorry, please ignore this incomplete email.
Thanks
在 2025/7/8 21:55, Qianfeng Rong 写道:
> Use min() to reduce the code and improve its readability.
>
> No functional changes.
>
> Qianfeng Rong (12):
> ethernet: liquidio: Use min() to improve code
> ethernet: cxgb4: Use min() to improve code
> ethernet: octeon_ep: Use min() to improve code
> ethernet: nfp: Use min()/max() to improve code
> ethernet: qlcnic: Use min() to improve code
> net: usb: Use min() to improve code
> wifi: ath5k: Use max() to improve code
> wifi: ath9k: Use max() to improve code
> wifi: brcm80211: Use min() to improve code
> wifi: mwifiex: Use max() to improve code
> wifi: wilc1000: Use min() to improve code
> wifi: rtlwifi: Use min()/max() to improve code
>
> .../ethernet/cavium/liquidio/octeon_console.c | 5 +----
> drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 5 +----
> .../marvell/octeon_ep/octep_pfvf_mbox.c | 5 +----
> .../ethernet/netronome/nfp/nfp_netvf_main.c | 13 ++++---------
> .../ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | 5 +----
> drivers/net/usb/r8152.c | 5 +----
> drivers/net/wireless/ath/ath5k/phy.c | 12 +++---------
> drivers/net/wireless/ath/ath9k/dfs.c | 5 +----
> .../broadcom/brcm80211/brcmfmac/usb.c | 5 +----
> .../broadcom/brcm80211/brcmsmac/phy/phy_n.c | 6 ++----
> .../net/wireless/marvell/mwifiex/cfg80211.c | 6 ++----
> .../net/wireless/microchip/wilc1000/wlan.c | 5 +----
> .../wireless/realtek/rtlwifi/rtl8192ce/hw.c | 19 +++----------------
> .../wireless/realtek/rtlwifi/rtl8192cu/hw.c | 17 +++--------------
> .../wireless/realtek/rtlwifi/rtl8192ee/dm.c | 5 +----
> .../wireless/realtek/rtlwifi/rtl8723ae/hw.c | 15 +++------------
> .../wireless/realtek/rtlwifi/rtl8723be/dm.c | 5 +----
> .../wireless/realtek/rtlwifi/rtl8821ae/dm.c | 5 +----
> 18 files changed, 31 insertions(+), 112 deletions(-)
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 00/12] net: Use min()/max() to improve code
@ 2025-07-09 2:21 Qianfeng Rong
2025-07-09 2:21 ` [PATCH 01/12] ethernet: liquidio: Use min() " Qianfeng Rong
` (6 more replies)
0 siblings, 7 replies; 12+ messages in thread
From: Qianfeng Rong @ 2025-07-09 2:21 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Potnuri Bharat Teja, Veerasenareddy Burru,
Sathesh Edara, Louis Peens, Shahed Shaikh, Manish Chopra,
maintainer:QLOGIC QLCNIC (1/10)Gb ETHERNET DRIVER, Jiri Slaby,
Nick Kossifidis, Luis Chamberlain,
Toke Høiland-Jørgensen, Arend van Spriel, Brian Norris,
Francesco Dolcini, Ajay Singh, Claudiu Beznea, Ping-Ke Shih,
Qianfeng Rong, Kees Cook, Gustavo A. R. Silva, Kory Maincent,
Aleksander Jan Bajkowski, Lucas Sanchez Sagrado, Philipp Hahn,
Eric Biggers, Hayes Wang, Wentao Liang, Johannes Berg,
Sai Krishna, Jacobe Zang, Dmitry Antipov, Kalle Valo,
Sascha Hauer, David Lin, Aditya Kumar Singh, Roopni Devanathan,
Dan Carpenter, Marek Vasut, Alexis Lothoré, Arnd Bergmann,
open list:CAVIUM LIQUIDIO NETWORK DRIVER, open list,
open list:NETRONOME ETHERNET DRIVERS,
open list:USB NETWORKING DRIVERS,
open list:ATHEROS ATH5K WIRELESS DRIVER,
open list:BROADCOM BRCM80211 IEEE802.11 WIRELESS DRIVERS,
open list:BROADCOM BRCM80211 IEEE802.11 WIRELESS DRIVERS
Use min() to reduce the code and improve its readability.
No functional changes.
Qianfeng Rong (12):
ethernet: liquidio: Use min() to improve code
ethernet: cxgb4: Use min() to improve code
ethernet: octeon_ep: Use min() to improve code
ethernet: nfp: Use min()/max() to improve code
ethernet: qlcnic: Use min() to improve code
net: usb: Use min() to improve code
wifi: ath5k: Use max() to improve code
wifi: ath9k: Use max() to improve code
wifi: brcm80211: Use min() to improve code
wifi: mwifiex: Use max() to improve code
wifi: wilc1000: Use min() to improve code
wifi: rtlwifi: Use min()/max() to improve code
.../ethernet/cavium/liquidio/octeon_console.c | 5 +----
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 5 +----
.../marvell/octeon_ep/octep_pfvf_mbox.c | 5 +----
.../ethernet/netronome/nfp/nfp_netvf_main.c | 13 ++++---------
.../ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | 5 +----
drivers/net/usb/r8152.c | 5 +----
drivers/net/wireless/ath/ath5k/phy.c | 12 +++---------
drivers/net/wireless/ath/ath9k/dfs.c | 5 +----
.../broadcom/brcm80211/brcmfmac/usb.c | 5 +----
.../broadcom/brcm80211/brcmsmac/phy/phy_n.c | 6 ++----
.../net/wireless/marvell/mwifiex/cfg80211.c | 6 ++----
.../net/wireless/microchip/wilc1000/wlan.c | 5 +----
.../wireless/realtek/rtlwifi/rtl8192ce/hw.c | 19 +++----------------
.../wireless/realtek/rtlwifi/rtl8192cu/hw.c | 17 +++--------------
.../wireless/realtek/rtlwifi/rtl8192ee/dm.c | 5 +----
.../wireless/realtek/rtlwifi/rtl8723ae/hw.c | 15 +++------------
.../wireless/realtek/rtlwifi/rtl8723be/dm.c | 5 +----
.../wireless/realtek/rtlwifi/rtl8821ae/dm.c | 5 +----
18 files changed, 31 insertions(+), 112 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 01/12] ethernet: liquidio: Use min() to improve code
2025-07-09 2:21 [PATCH 00/12] net: Use min()/max() to improve code Qianfeng Rong
@ 2025-07-09 2:21 ` Qianfeng Rong
2025-07-09 2:21 ` [PATCH 02/12] ethernet: cxgb4: " Qianfeng Rong
` (5 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Qianfeng Rong @ 2025-07-09 2:21 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Qianfeng Rong,
open list:CAVIUM LIQUIDIO NETWORK DRIVER, open list
Use min() to reduce the code and improve its readability.
Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
---
drivers/net/ethernet/cavium/liquidio/octeon_console.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_console.c b/drivers/net/ethernet/cavium/liquidio/octeon_console.c
index 67c3570f875f..526cbe2c2a21 100644
--- a/drivers/net/ethernet/cavium/liquidio/octeon_console.c
+++ b/drivers/net/ethernet/cavium/liquidio/octeon_console.c
@@ -873,10 +873,7 @@ int octeon_download_firmware(struct octeon_device *oct, const u8 *data,
rem = image_len;
while (rem) {
- if (rem < FBUF_SIZE)
- size = rem;
- else
- size = FBUF_SIZE;
+ size = min(rem, FBUF_SIZE);
/* download the image */
octeon_pci_write_core_mem(oct, load_addr, data, (u32)size);
--
2.34.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 02/12] ethernet: cxgb4: Use min() to improve code
2025-07-09 2:21 [PATCH 00/12] net: Use min()/max() to improve code Qianfeng Rong
2025-07-09 2:21 ` [PATCH 01/12] ethernet: liquidio: Use min() " Qianfeng Rong
@ 2025-07-09 2:21 ` Qianfeng Rong
2025-07-09 2:21 ` [PATCH 03/12] ethernet: octeon_ep: " Qianfeng Rong
` (4 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Qianfeng Rong @ 2025-07-09 2:21 UTC (permalink / raw)
To: Potnuri Bharat Teja, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni,
open list:CXGB4 ETHERNET DRIVER (CXGB4), open list
Cc: Qianfeng Rong
Use min() to reduce the code and improve its readability.
Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.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
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 03/12] ethernet: octeon_ep: Use min() to improve code
2025-07-09 2:21 [PATCH 00/12] net: Use min()/max() to improve code Qianfeng Rong
2025-07-09 2:21 ` [PATCH 01/12] ethernet: liquidio: Use min() " Qianfeng Rong
2025-07-09 2:21 ` [PATCH 02/12] ethernet: cxgb4: " Qianfeng Rong
@ 2025-07-09 2:21 ` Qianfeng Rong
2025-07-09 2:21 ` [PATCH 04/12] ethernet: nfp: Use min()/max() " Qianfeng Rong
` (3 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Qianfeng Rong @ 2025-07-09 2:21 UTC (permalink / raw)
To: Veerasenareddy Burru, Sathesh Edara, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni,
open list:MARVELL OCTEON ENDPOINT DRIVER, open list
Cc: Qianfeng Rong
Use min() to reduce the code and improve its readability.
Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
---
drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c b/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c
index ebecdd29f3bd..cfae09bf6fea 100644
--- a/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c
+++ b/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c
@@ -39,10 +39,7 @@ static void octep_pfvf_validate_version(struct octep_device *oct, u32 vf_id,
dev_dbg(&oct->pdev->dev, "VF id:%d VF version:%d PF version:%d\n",
vf_id, vf_version, OCTEP_PFVF_MBOX_VERSION_CURRENT);
- if (vf_version < OCTEP_PFVF_MBOX_VERSION_CURRENT)
- rsp->s_version.version = vf_version;
- else
- rsp->s_version.version = OCTEP_PFVF_MBOX_VERSION_CURRENT;
+ rsp->s_version.version = min(vf_version, OCTEP_PFVF_MBOX_VERSION_CURRENT);
oct->vf_info[vf_id].mbox_version = rsp->s_version.version;
dev_dbg(&oct->pdev->dev, "VF id:%d negotiated VF version:%d\n",
--
2.34.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 04/12] ethernet: nfp: Use min()/max() to improve code
2025-07-09 2:21 [PATCH 00/12] net: Use min()/max() to improve code Qianfeng Rong
` (2 preceding siblings ...)
2025-07-09 2:21 ` [PATCH 03/12] ethernet: octeon_ep: " Qianfeng Rong
@ 2025-07-09 2:21 ` Qianfeng Rong
2025-07-09 2:21 ` [PATCH 05/12] ethernet: qlcnic: Use min() " Qianfeng Rong
` (2 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Qianfeng Rong @ 2025-07-09 2:21 UTC (permalink / raw)
To: Louis Peens, Jakub Kicinski, Andrew Lunn, David S. Miller,
Eric Dumazet, Paolo Abeni, Qianfeng Rong,
open list:NETRONOME ETHERNET DRIVERS,
open list:NETWORKING DRIVERS, open list
Use min()/max() to reduce the code and improve its readability.
Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
---
drivers/net/ethernet/netronome/nfp/nfp_netvf_main.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_netvf_main.c b/drivers/net/ethernet/netronome/nfp/nfp_netvf_main.c
index e19bb0150cb5..ab1b952ff1fb 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_netvf_main.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_netvf_main.c
@@ -205,15 +205,10 @@ static int nfp_netvf_pci_probe(struct pci_dev *pdev,
resource_size_t map_addr;
/* Make a single overlapping BAR mapping */
- if (tx_bar_off < rx_bar_off)
- bar_off = tx_bar_off;
- else
- bar_off = rx_bar_off;
-
- if ((tx_bar_off + tx_bar_sz) > (rx_bar_off + rx_bar_sz))
- bar_sz = (tx_bar_off + tx_bar_sz) - bar_off;
- else
- bar_sz = (rx_bar_off + rx_bar_sz) - bar_off;
+ bar_off = min(tx_bar_off, rx_bar_off);
+
+ bar_sz = max(tx_bar_off + tx_bar_sz,
+ rx_bar_off + rx_bar_sz) - bar_off;
map_addr = pci_resource_start(pdev, tx_bar_no) + bar_off;
vf->q_bar = ioremap(map_addr, bar_sz);
--
2.34.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 05/12] ethernet: qlcnic: Use min() to improve code
2025-07-09 2:21 [PATCH 00/12] net: Use min()/max() to improve code Qianfeng Rong
` (3 preceding siblings ...)
2025-07-09 2:21 ` [PATCH 04/12] ethernet: nfp: Use min()/max() " Qianfeng Rong
@ 2025-07-09 2:21 ` Qianfeng Rong
2025-07-09 2:21 ` [PATCH 06/12] net: usb: " Qianfeng Rong
2025-07-11 0:59 ` [PATCH 00/12] net: Use min()/max() " Jakub Kicinski
6 siblings, 0 replies; 12+ messages in thread
From: Qianfeng Rong @ 2025-07-09 2:21 UTC (permalink / raw)
To: Shahed Shaikh, Manish Chopra,
maintainer:QLOGIC QLCNIC (1/10)Gb ETHERNET DRIVER, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
open list:QLOGIC QLCNIC (1/10)Gb ETHERNET DRIVER, open list
Cc: Qianfeng Rong
Use min() to reduce the code and improve its readability.
Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
---
drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
index d7cdea8f604d..c273a2716786 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
@@ -1181,10 +1181,7 @@ int qlcnic_83xx_create_rx_ctx(struct qlcnic_adapter *adapter)
struct qlcnic_hardware_context *ahw = adapter->ahw;
num_rds = adapter->max_rds_rings;
- if (adapter->drv_sds_rings <= QLCNIC_MAX_SDS_RINGS)
- num_sds = adapter->drv_sds_rings;
- else
- num_sds = QLCNIC_MAX_SDS_RINGS;
+ num_sds = min(adapter->drv_sds_rings, QLCNIC_MAX_SDS_RINGS);
sds_mbx_size = sizeof(struct qlcnic_sds_mbx);
rds_mbx_size = sizeof(struct qlcnic_rds_mbx);
--
2.34.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 06/12] net: usb: Use min() to improve code
2025-07-09 2:21 [PATCH 00/12] net: Use min()/max() to improve code Qianfeng Rong
` (4 preceding siblings ...)
2025-07-09 2:21 ` [PATCH 05/12] ethernet: qlcnic: Use min() " Qianfeng Rong
@ 2025-07-09 2:21 ` Qianfeng Rong
2025-07-11 0:59 ` [PATCH 00/12] net: Use min()/max() " Jakub Kicinski
6 siblings, 0 replies; 12+ messages in thread
From: Qianfeng Rong @ 2025-07-09 2:21 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Kees Cook, Gustavo A. R. Silva, Subbaraya Sundeep,
Aleksander Jan Bajkowski, Eric Biggers, Qianfeng Rong,
Lucas Sanchez Sagrado, Hayes Wang, Philipp Hahn,
open list:USB NETWORKING DRIVERS, open list:NETWORKING DRIVERS,
open list
Use min() to reduce the code and improve its readability.
Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
---
drivers/net/usb/r8152.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 44cba7acfe7d..c81a43da914a 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -4949,10 +4949,7 @@ static void rtl_ram_code_speed_up(struct r8152 *tp, struct fw_phy_speed_up *phy,
u32 ocp_data, size;
int i;
- if (len < 2048)
- size = len;
- else
- size = 2048;
+ size = min(len, 2048);
ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_GPHY_CTRL);
ocp_data |= GPHY_PATCH_DONE | BACKUP_RESTRORE;
--
2.34.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 00/12] net: Use min()/max() to improve code
2025-07-09 2:21 [PATCH 00/12] net: Use min()/max() to improve code Qianfeng Rong
` (5 preceding siblings ...)
2025-07-09 2:21 ` [PATCH 06/12] net: usb: " Qianfeng Rong
@ 2025-07-11 0:59 ` Jakub Kicinski
2025-07-14 2:08 ` Qianfeng Rong
6 siblings, 1 reply; 12+ messages in thread
From: Jakub Kicinski @ 2025-07-11 0:59 UTC (permalink / raw)
To: Qianfeng Rong
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Paolo Abeni,
Potnuri Bharat Teja, Veerasenareddy Burru, Sathesh Edara,
Louis Peens, Shahed Shaikh, Manish Chopra,
maintainer:QLOGIC QLCNIC (1/10)Gb ETHERNET DRIVER, Jiri Slaby,
Nick Kossifidis, Luis Chamberlain,
Toke Høiland-Jørgensen, Arend van Spriel, Brian Norris,
Francesco Dolcini, Ajay Singh, Claudiu Beznea, Ping-Ke Shih,
Kees Cook, Gustavo A. R. Silva, Kory Maincent,
Aleksander Jan Bajkowski, Lucas Sanchez Sagrado, Philipp Hahn,
Eric Biggers, Hayes Wang, Wentao Liang, Johannes Berg,
Sai Krishna, Jacobe Zang, Dmitry Antipov, Kalle Valo,
Sascha Hauer, David Lin, Aditya Kumar Singh, Roopni Devanathan,
Dan Carpenter, Marek Vasut, Alexis Lothoré, Arnd Bergmann,
open list:CAVIUM LIQUIDIO NETWORK DRIVER, open list,
open list:NETRONOME ETHERNET DRIVERS,
open list:USB NETWORKING DRIVERS,
open list:ATHEROS ATH5K WIRELESS DRIVER,
open list:BROADCOM BRCM80211 IEEE802.11 WIRELESS DRIVERS,
open list:BROADCOM BRCM80211 IEEE802.11 WIRELESS DRIVERS
On Wed, 9 Jul 2025 10:21:28 +0800 Qianfeng Rong wrote:
> Use min() to reduce the code and improve its readability.
>
> No functional changes.
For net/ethernet/ this is not worth the churn, sorry.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 00/12] net: Use min()/max() to improve code
2025-07-11 0:59 ` [PATCH 00/12] net: Use min()/max() " Jakub Kicinski
@ 2025-07-14 2:08 ` Qianfeng Rong
0 siblings, 0 replies; 12+ messages in thread
From: Qianfeng Rong @ 2025-07-14 2:08 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Paolo Abeni,
Potnuri Bharat Teja, Veerasenareddy Burru, Sathesh Edara,
Louis Peens, Shahed Shaikh, Manish Chopra,
maintainer:QLOGIC QLCNIC (1/10)Gb ETHERNET DRIVER, Jiri Slaby,
Nick Kossifidis, Luis Chamberlain,
Toke Høiland-Jørgensen, Arend van Spriel, Brian Norris,
Francesco Dolcini, Ajay Singh, Claudiu Beznea, Ping-Ke Shih,
Kees Cook, Gustavo A. R. Silva, Kory Maincent,
Aleksander Jan Bajkowski, Lucas Sanchez Sagrado, Philipp Hahn,
Eric Biggers, Hayes Wang, Wentao Liang, Johannes Berg,
Sai Krishna, Jacobe Zang, Dmitry Antipov, Kalle Valo,
Sascha Hauer, David Lin, Aditya Kumar Singh, Roopni Devanathan,
Dan Carpenter, Marek Vasut, Alexis Lothoré, Arnd Bergmann,
open list:CAVIUM LIQUIDIO NETWORK DRIVER, open list,
open list:NETRONOME ETHERNET DRIVERS,
open list:USB NETWORKING DRIVERS,
open list:ATHEROS ATH5K WIRELESS DRIVER,
open list:BROADCOM BRCM80211 IEEE802.11 WIRELESS DRIVERS,
open list:BROADCOM BRCM80211 IEEE802.11 WIRELESS DRIVERS
在 2025/7/11 8:59, Jakub Kicinski 写道:
> On Wed, 9 Jul 2025 10:21:28 +0800 Qianfeng Rong wrote:
>> Use min() to reduce the code and improve its readability.
>>
>> No functional changes.
> For net/ethernet/ this is not worth the churn, sorry.
Never mind, thanks for your reply.
Best regards,
Qianfeng
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2025-07-14 2:08 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-09 2:21 [PATCH 00/12] net: Use min()/max() to improve code Qianfeng Rong
2025-07-09 2:21 ` [PATCH 01/12] ethernet: liquidio: Use min() " Qianfeng Rong
2025-07-09 2:21 ` [PATCH 02/12] ethernet: cxgb4: " Qianfeng Rong
2025-07-09 2:21 ` [PATCH 03/12] ethernet: octeon_ep: " Qianfeng Rong
2025-07-09 2:21 ` [PATCH 04/12] ethernet: nfp: Use min()/max() " Qianfeng Rong
2025-07-09 2:21 ` [PATCH 05/12] ethernet: qlcnic: Use min() " Qianfeng Rong
2025-07-09 2:21 ` [PATCH 06/12] net: usb: " Qianfeng Rong
2025-07-11 0:59 ` [PATCH 00/12] net: Use min()/max() " Jakub Kicinski
2025-07-14 2:08 ` Qianfeng Rong
-- strict thread matches above, loose matches on Subject: below --
2025-07-08 13:55 Qianfeng Rong
2025-07-08 14:12 ` Jakub Kicinski
2025-07-08 14:15 ` Qianfeng Rong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).