Skip to contentSkip to conversation

net: ethernet: atheros: atl2: remove kernel backward-compatibility code

PATCH Applied Ethan Nelson-Moore 3 participants 3 messages May 6 – May 8

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: ethernet: atheros: atl2: remove kernel backward-compatibility code

The atl2 driver contains code for compatibility with old kernels that do not support module_param_array. Backward compatibility is irrelevant because this driver is in-tree. Remove this unreachable code to simplify the driver's handling of module parameters.

---
 drivers/net/ethernet/atheros/atlx/atl2.c | 37 ++----------------------
 1 file changed, 3 insertions(+), 34 deletions(-)
drivers/net/ethernet/atheros/atlx/atl2.c +3 -34
index 280e2f5f4aa5..5560d5cc3169 100644
@@ -2756,10 +2756,8 @@ static void atl2_force_ps(struct atl2_hw *hw)
 /* All parameters are treated the same, as an integer array of values.
  * This macro just reduces the need to repeat the same declaration code
  * over and over (plus this helps to avoid typo bugs).
- */
-#define ATL2_PARAM_INIT {[0 ... ATL2_MAX_NIC] = OPTION_UNSET}
-#ifndef module_param_array
-/* Module Parameters are always initialized to -1, so that the driver
+ *
+ * Module parameters are always initialized to -1, so that the driver
  * can tell the difference between no user specified value or the
  * user asking for the default value.
  * The true default values are loaded in when atl2_check_options is called.
@@ -2770,16 +2768,10 @@ static void atl2_force_ps(struct atl2_hw *hw)
  */
 
 #define ATL2_PARAM(X, desc) \
-    static const int X[ATL2_MAX_NIC + 1] = ATL2_PARAM_INIT; \
-    MODULE_PARM(X, "1-" __MODULE_STRING(ATL2_MAX_NIC) "i"); \
-    MODULE_PARM_DESC(X, desc);
-#else
-#define ATL2_PARAM(X, desc) \
-    static int X[ATL2_MAX_NIC+1] = ATL2_PARAM_INIT; \
+    static int X[ATL2_MAX_NIC+1] = {[0 ... ATL2_MAX_NIC] = OPTION_UNSET}; \
     static unsigned int num_##X; \
     module_param_array_named(X, X, int, &num_##X, 0); \
     MODULE_PARM_DESC(X, desc);
-#endif
 
 /*
  * Transmit Memory Size
@@ -2924,9 +2916,6 @@ static void atl2_check_options(struct atl2_adapter *adapter)
 		printk(KERN_NOTICE "Warning: no configuration for board #%i\n",
 			bd);
 		printk(KERN_NOTICE "Using defaults for all values\n");
-#ifndef module_param_array
-		bd = ATL2_MAX_NIC;
-#endif
 	}
 
 	/* Bytes of Transmit Memory */
@@ -2936,16 +2925,12 @@ static void atl2_check_options(struct atl2_adapter *adapter)
 	opt.def = ATL2_DEFAULT_TX_MEMSIZE;
 	opt.arg.r.min = ATL2_MIN_TX_MEMSIZE;
 	opt.arg.r.max = ATL2_MAX_TX_MEMSIZE;
-#ifdef module_param_array
 	if (num_TxMemSize > bd) {
-#endif
 		val = TxMemSize[bd];
 		atl2_validate_option(&val, &opt);
 		adapter->txd_ring_size = ((u32) val) * 1024;
-#ifdef module_param_array
 	} else
 		adapter->txd_ring_size = ((u32)opt.def) * 1024;
-#endif
 	/* txs ring size: */
 	adapter->txs_ring_size = adapter->txd_ring_size / 128;
 	if (adapter->txs_ring_size > 160)
@@ -2958,18 +2943,14 @@ static void atl2_check_options(struct atl2_adapter *adapter)
 	opt.def = ATL2_DEFAULT_RXD_COUNT;
 	opt.arg.r.min = ATL2_MIN_RXD_COUNT;
 	opt.arg.r.max = ATL2_MAX_RXD_COUNT;
-#ifdef module_param_array
 	if (num_RxMemBlock > bd) {
-#endif
 		val = RxMemBlock[bd];
 		atl2_validate_option(&val, &opt);
 		adapter->rxd_ring_size = (u32)val;
 		/* FIXME */
 		/* ((u16)val)&~1; */	/* even number */
-#ifdef module_param_array
 	} else
 		adapter->rxd_ring_size = (u32)opt.def;
-#endif
 	/* init RXD Flow control value */
 	adapter->hw.fc_rxd_hi = (adapter->rxd_ring_size / 8) * 7;
 	adapter->hw.fc_rxd_lo = (ATL2_MIN_RXD_COUNT / 8) >
@@ -2983,16 +2964,12 @@ static void atl2_check_options(struct atl2_adapter *adapter)
 	opt.def = INT_MOD_DEFAULT_CNT;
 	opt.arg.r.min = INT_MOD_MIN_CNT;
 	opt.arg.r.max = INT_MOD_MAX_CNT;
-#ifdef module_param_array
 	if (num_IntModTimer > bd) {
-#endif
 		val = IntModTimer[bd];
 		atl2_validate_option(&val, &opt);
 		adapter->imt = (u16) val;
-#ifdef module_param_array
 	} else
 		adapter->imt = (u16)(opt.def);
-#endif
 	/* Flash Vendor */
 	opt.type = range_option;
 	opt.name = "SPI Flash Vendor";
@@ -3000,16 +2977,12 @@ static void atl2_check_options(struct atl2_adapter *adapter)
 	opt.def = FLASH_VENDOR_DEFAULT;
 	opt.arg.r.min = FLASH_VENDOR_MIN;
 	opt.arg.r.max = FLASH_VENDOR_MAX;
-#ifdef module_param_array
 	if (num_FlashVendor > bd) {
-#endif
 		val = FlashVendor[bd];
 		atl2_validate_option(&val, &opt);
 		adapter->hw.flash_vendor = (u8) val;
-#ifdef module_param_array
 	} else
 		adapter->hw.flash_vendor = (u8)(opt.def);
-#endif
 	/* MediaType */
 	opt.type = range_option;
 	opt.name = "Speed/Duplex Selection";
@@ -3017,14 +2990,10 @@ static void atl2_check_options(struct atl2_adapter *adapter)
 	opt.def = MEDIA_TYPE_AUTO_SENSOR;
 	opt.arg.r.min = MEDIA_TYPE_AUTO_SENSOR;
 	opt.arg.r.max = MEDIA_TYPE_10M_HALF;
-#ifdef module_param_array
 	if (num_MediaType > bd) {
-#endif
 		val = MediaType[bd];
 		atl2_validate_option(&val, &opt);
 		adapter->hw.MediaType = (u16) val;
-#ifdef module_param_array
 	} else
 		adapter->hw.MediaType = (u16)(opt.def);
-#endif
 }
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw

From: Ethan Nelson-Moore <[email protected]>
Date: Tue, 5 May 2026 22:40:27 -0700

Quoted 6 lines

The atl2 driver contains code for compatibility with old kernels that do not support module_param_array. Backward compatibility is irrelevant because this driver is in-tree. Remove this unreachable code to simplify the driver's handling of module parameters.

Quoted 3 lines
---
 drivers/net/ethernet/atheros/atlx/atl2.c | 37 ++----------------------
 1 file changed, 3 insertions(+), 34 deletions(-)

Thanks,
Olek

#2 lore raw
In reply to Ethan Nelson-Moore
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Tue, 5 May 2026 22:40:27 -0700 you wrote:

The atl2 driver contains code for compatibility with old kernels that do not support module_param_array. Backward compatibility is irrelevant because this driver is in-tree. Remove this unreachable code to simplify the driver's handling of module parameters.

[...]

Here is the summary with links:
- [net-next] net: ethernet: atheros: atl2: remove kernel backward-compatibility code

    https://git.kernel.org/netdev/net-next/c/ae5c3718aeec

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html