Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH ath-next] wifi: ath9k: drop static from local pdadc and vpdTable arrays
@ 2026-06-16  3:08 Rosen Penev
  2026-06-17  6:00 ` kernel test robot
  2026-06-18  9:50 ` Toke Høiland-Jørgensen
  0 siblings, 2 replies; 3+ messages in thread
From: Rosen Penev @ 2026-06-16  3:08 UTC (permalink / raw)
  To: linux-wireless; +Cc: Toke Høiland-Jørgensen, open list

Remove the static qualifier from mutable local arrays in three EEPROM
power-calibration functions.  These arrays are written to during normal
operation, so static storage is both unnecessary and misleading: it
implies sharing across calls when no such sharing is intended, and it
makes the code subtly non-reentrant.  The sibling function in
eeprom_9287.c already uses an automatic (stack-local) pdadcValues,
confirming this is the correct pattern.

This keeps ~1 KB of data off the static data section at the cost of
stack usage, consistent with the rest of the driver's coding style.

Assisted-by: opencode:big-pickle
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 drivers/net/wireless/ath/ath9k/eeprom.c     | 6 +++---
 drivers/net/wireless/ath/ath9k/eeprom_4k.c  | 2 +-
 drivers/net/wireless/ath/ath9k/eeprom_def.c | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/eeprom.c b/drivers/net/wireless/ath/ath9k/eeprom.c
index df58dc02e104..fe5eb0d68b2e 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom.c
@@ -460,11 +460,11 @@ void ath9k_hw_get_gain_boundaries_pdadcs(struct ath_hw *ah,
 	int i, j, k;
 	int16_t ss;
 	u16 idxL = 0, idxR = 0, numPiers;
-	static u8 vpdTableL[AR5416_NUM_PD_GAINS]
+	u8 vpdTableL[AR5416_NUM_PD_GAINS]
 		[AR5416_MAX_PWR_RANGE_IN_HALF_DB];
-	static u8 vpdTableR[AR5416_NUM_PD_GAINS]
+	u8 vpdTableR[AR5416_NUM_PD_GAINS]
 		[AR5416_MAX_PWR_RANGE_IN_HALF_DB];
-	static u8 vpdTableI[AR5416_NUM_PD_GAINS]
+	u8 vpdTableI[AR5416_NUM_PD_GAINS]
 		[AR5416_MAX_PWR_RANGE_IN_HALF_DB];

 	u8 *pVpdL, *pVpdR, *pPwrL, *pPwrR;
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_4k.c b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
index 3e16cfe059f3..eec7efdc21c3 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c
@@ -288,7 +288,7 @@ static void ath9k_hw_set_4k_power_cal_table(struct ath_hw *ah,
 	struct cal_data_per_freq_4k *pRawDataset;
 	u8 *pCalBChans = NULL;
 	u16 pdGainOverlap_t2;
-	static u8 pdadcValues[AR5416_NUM_PDADC_VALUES];
+	u8 pdadcValues[AR5416_NUM_PDADC_VALUES];
 	u16 gainBoundaries[AR5416_PD_GAINS_IN_MASK];
 	u16 numPiers, i, j;
 	u16 numXpdGain, xpdMask;
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_def.c b/drivers/net/wireless/ath/ath9k/eeprom_def.c
index 5ba467cb7425..a1b10c826fe5 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom_def.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c
@@ -769,7 +769,7 @@ static void ath9k_hw_set_def_power_cal_table(struct ath_hw *ah,
 	struct cal_data_per_freq *pRawDataset;
 	u8 *pCalBChans = NULL;
 	u16 pdGainOverlap_t2;
-	static u8 pdadcValues[AR5416_NUM_PDADC_VALUES];
+	u8 pdadcValues[AR5416_NUM_PDADC_VALUES];
 	u16 gainBoundaries[AR5416_PD_GAINS_IN_MASK];
 	u16 numPiers, i, j;
 	int16_t diff = 0;
--
2.54.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH ath-next] wifi: ath9k: drop static from local pdadc and vpdTable arrays
  2026-06-16  3:08 [PATCH ath-next] wifi: ath9k: drop static from local pdadc and vpdTable arrays Rosen Penev
@ 2026-06-17  6:00 ` kernel test robot
  2026-06-18  9:50 ` Toke Høiland-Jørgensen
  1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2026-06-17  6:00 UTC (permalink / raw)
  To: Rosen Penev, linux-wireless
  Cc: oe-kbuild-all, Toke Høiland-Jørgensen, linux-kernel

Hi Rosen,

kernel test robot noticed the following build warnings:

[auto build test WARNING on ath/ath-next]
[also build test WARNING on wireless/main wireless-next/main linus/master v7.1 next-20260616]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Rosen-Penev/wifi-ath9k-drop-static-from-local-pdadc-and-vpdTable-arrays/20260616-114515
base:   https://git.kernel.org/pub/scm/linux/kernel/git/ath/ath.git ath-next
patch link:    https://lore.kernel.org/r/20260616030828.655310-1-rosenp%40gmail.com
patch subject: [PATCH ath-next] wifi: ath9k: drop static from local pdadc and vpdTable arrays
config: arm-allyesconfig (https://download.01.org/0day-ci/archive/20260617/202606171341.zUckYxVR-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 16.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260617/202606171341.zUckYxVR-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202606171341.zUckYxVR-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/net/wireless/ath/ath9k/eeprom.c: In function 'ath9k_hw_get_gain_boundaries_pdadcs':
>> drivers/net/wireless/ath/ath9k/eeprom.c:657:1: warning: the frame size of 1360 bytes is larger than 1280 bytes [-Wframe-larger-than=]
     657 | }
         | ^


vim +657 drivers/net/wireless/ath/ath9k/eeprom.c

a55f858852e4345 Sujith        2010-06-01  451  
115277a3bc0683d Felix Fietkau 2010-12-12  452  void ath9k_hw_get_gain_boundaries_pdadcs(struct ath_hw *ah,
115277a3bc0683d Felix Fietkau 2010-12-12  453  				struct ath9k_channel *chan,
115277a3bc0683d Felix Fietkau 2010-12-12  454  				void *pRawDataSet,
115277a3bc0683d Felix Fietkau 2010-12-12  455  				u8 *bChans, u16 availPiers,
115277a3bc0683d Felix Fietkau 2010-12-12  456  				u16 tPdGainOverlap,
115277a3bc0683d Felix Fietkau 2010-12-12  457  				u16 *pPdGainBoundaries, u8 *pPDADCValues,
115277a3bc0683d Felix Fietkau 2010-12-12  458  				u16 numXpdGains)
115277a3bc0683d Felix Fietkau 2010-12-12  459  {
115277a3bc0683d Felix Fietkau 2010-12-12  460  	int i, j, k;
115277a3bc0683d Felix Fietkau 2010-12-12  461  	int16_t ss;
115277a3bc0683d Felix Fietkau 2010-12-12  462  	u16 idxL = 0, idxR = 0, numPiers;
8e792d8755eaf1a Rosen Penev   2026-06-15  463  	u8 vpdTableL[AR5416_NUM_PD_GAINS]
115277a3bc0683d Felix Fietkau 2010-12-12  464  		[AR5416_MAX_PWR_RANGE_IN_HALF_DB];
8e792d8755eaf1a Rosen Penev   2026-06-15  465  	u8 vpdTableR[AR5416_NUM_PD_GAINS]
115277a3bc0683d Felix Fietkau 2010-12-12  466  		[AR5416_MAX_PWR_RANGE_IN_HALF_DB];
8e792d8755eaf1a Rosen Penev   2026-06-15  467  	u8 vpdTableI[AR5416_NUM_PD_GAINS]
115277a3bc0683d Felix Fietkau 2010-12-12  468  		[AR5416_MAX_PWR_RANGE_IN_HALF_DB];
115277a3bc0683d Felix Fietkau 2010-12-12  469  
115277a3bc0683d Felix Fietkau 2010-12-12  470  	u8 *pVpdL, *pVpdR, *pPwrL, *pPwrR;
115277a3bc0683d Felix Fietkau 2010-12-12  471  	u8 minPwrT4[AR5416_NUM_PD_GAINS];
115277a3bc0683d Felix Fietkau 2010-12-12  472  	u8 maxPwrT4[AR5416_NUM_PD_GAINS];
115277a3bc0683d Felix Fietkau 2010-12-12  473  	int16_t vpdStep;
115277a3bc0683d Felix Fietkau 2010-12-12  474  	int16_t tmpVal;
115277a3bc0683d Felix Fietkau 2010-12-12  475  	u16 sizeCurrVpdTable, maxIndex, tgtIndex;
115277a3bc0683d Felix Fietkau 2010-12-12  476  	bool match;
115277a3bc0683d Felix Fietkau 2010-12-12  477  	int16_t minDelta = 0;
115277a3bc0683d Felix Fietkau 2010-12-12  478  	struct chan_centers centers;
115277a3bc0683d Felix Fietkau 2010-12-12  479  	int pdgain_boundary_default;
115277a3bc0683d Felix Fietkau 2010-12-12  480  	struct cal_data_per_freq *data_def = pRawDataSet;
115277a3bc0683d Felix Fietkau 2010-12-12  481  	struct cal_data_per_freq_4k *data_4k = pRawDataSet;
940cd2c12ebff68 Felix Fietkau 2010-12-12  482  	struct cal_data_per_freq_ar9287 *data_9287 = pRawDataSet;
115277a3bc0683d Felix Fietkau 2010-12-12  483  	bool eeprom_4k = AR_SREV_9285(ah) || AR_SREV_9271(ah);
940cd2c12ebff68 Felix Fietkau 2010-12-12  484  	int intercepts;
940cd2c12ebff68 Felix Fietkau 2010-12-12  485  
940cd2c12ebff68 Felix Fietkau 2010-12-12  486  	if (AR_SREV_9287(ah))
940cd2c12ebff68 Felix Fietkau 2010-12-12  487  		intercepts = AR9287_PD_GAIN_ICEPTS;
940cd2c12ebff68 Felix Fietkau 2010-12-12  488  	else
940cd2c12ebff68 Felix Fietkau 2010-12-12  489  		intercepts = AR5416_PD_GAIN_ICEPTS;
115277a3bc0683d Felix Fietkau 2010-12-12  490  
115277a3bc0683d Felix Fietkau 2010-12-12  491  	memset(&minPwrT4, 0, AR5416_NUM_PD_GAINS);
115277a3bc0683d Felix Fietkau 2010-12-12  492  	ath9k_hw_get_channel_centers(ah, chan, &centers);
115277a3bc0683d Felix Fietkau 2010-12-12  493  
115277a3bc0683d Felix Fietkau 2010-12-12  494  	for (numPiers = 0; numPiers < availPiers; numPiers++) {
115277a3bc0683d Felix Fietkau 2010-12-12  495  		if (bChans[numPiers] == AR5416_BCHAN_UNUSED)
115277a3bc0683d Felix Fietkau 2010-12-12  496  			break;
115277a3bc0683d Felix Fietkau 2010-12-12  497  	}
115277a3bc0683d Felix Fietkau 2010-12-12  498  
115277a3bc0683d Felix Fietkau 2010-12-12  499  	match = ath9k_hw_get_lower_upper_index((u8)FREQ2FBIN(centers.synth_center,
115277a3bc0683d Felix Fietkau 2010-12-12  500  							     IS_CHAN_2GHZ(chan)),
115277a3bc0683d Felix Fietkau 2010-12-12  501  					       bChans, numPiers, &idxL, &idxR);
115277a3bc0683d Felix Fietkau 2010-12-12  502  
115277a3bc0683d Felix Fietkau 2010-12-12  503  	if (match) {
940cd2c12ebff68 Felix Fietkau 2010-12-12  504  		if (AR_SREV_9287(ah)) {
940cd2c12ebff68 Felix Fietkau 2010-12-12  505  			for (i = 0; i < numXpdGains; i++) {
940cd2c12ebff68 Felix Fietkau 2010-12-12  506  				minPwrT4[i] = data_9287[idxL].pwrPdg[i][0];
83d6f1f15f8cce8 Arnd Bergmann 2016-03-14  507  				maxPwrT4[i] = data_9287[idxL].pwrPdg[i][intercepts - 1];
940cd2c12ebff68 Felix Fietkau 2010-12-12  508  				ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i],
940cd2c12ebff68 Felix Fietkau 2010-12-12  509  						data_9287[idxL].pwrPdg[i],
940cd2c12ebff68 Felix Fietkau 2010-12-12  510  						data_9287[idxL].vpdPdg[i],
940cd2c12ebff68 Felix Fietkau 2010-12-12  511  						intercepts,
940cd2c12ebff68 Felix Fietkau 2010-12-12  512  						vpdTableI[i]);
940cd2c12ebff68 Felix Fietkau 2010-12-12  513  			}
940cd2c12ebff68 Felix Fietkau 2010-12-12  514  		} else if (eeprom_4k) {
115277a3bc0683d Felix Fietkau 2010-12-12  515  			for (i = 0; i < numXpdGains; i++) {
115277a3bc0683d Felix Fietkau 2010-12-12  516  				minPwrT4[i] = data_4k[idxL].pwrPdg[i][0];
83d6f1f15f8cce8 Arnd Bergmann 2016-03-14  517  				maxPwrT4[i] = data_4k[idxL].pwrPdg[i][intercepts - 1];
115277a3bc0683d Felix Fietkau 2010-12-12  518  				ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i],
115277a3bc0683d Felix Fietkau 2010-12-12  519  						data_4k[idxL].pwrPdg[i],
115277a3bc0683d Felix Fietkau 2010-12-12  520  						data_4k[idxL].vpdPdg[i],
940cd2c12ebff68 Felix Fietkau 2010-12-12  521  						intercepts,
115277a3bc0683d Felix Fietkau 2010-12-12  522  						vpdTableI[i]);
115277a3bc0683d Felix Fietkau 2010-12-12  523  			}
115277a3bc0683d Felix Fietkau 2010-12-12  524  		} else {
115277a3bc0683d Felix Fietkau 2010-12-12  525  			for (i = 0; i < numXpdGains; i++) {
115277a3bc0683d Felix Fietkau 2010-12-12  526  				minPwrT4[i] = data_def[idxL].pwrPdg[i][0];
83d6f1f15f8cce8 Arnd Bergmann 2016-03-14  527  				maxPwrT4[i] = data_def[idxL].pwrPdg[i][intercepts - 1];
115277a3bc0683d Felix Fietkau 2010-12-12  528  				ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i],
115277a3bc0683d Felix Fietkau 2010-12-12  529  						data_def[idxL].pwrPdg[i],
115277a3bc0683d Felix Fietkau 2010-12-12  530  						data_def[idxL].vpdPdg[i],
940cd2c12ebff68 Felix Fietkau 2010-12-12  531  						intercepts,
115277a3bc0683d Felix Fietkau 2010-12-12  532  						vpdTableI[i]);
115277a3bc0683d Felix Fietkau 2010-12-12  533  			}
115277a3bc0683d Felix Fietkau 2010-12-12  534  		}
115277a3bc0683d Felix Fietkau 2010-12-12  535  	} else {
115277a3bc0683d Felix Fietkau 2010-12-12  536  		for (i = 0; i < numXpdGains; i++) {
940cd2c12ebff68 Felix Fietkau 2010-12-12  537  			if (AR_SREV_9287(ah)) {
940cd2c12ebff68 Felix Fietkau 2010-12-12  538  				pVpdL = data_9287[idxL].vpdPdg[i];
940cd2c12ebff68 Felix Fietkau 2010-12-12  539  				pPwrL = data_9287[idxL].pwrPdg[i];
940cd2c12ebff68 Felix Fietkau 2010-12-12  540  				pVpdR = data_9287[idxR].vpdPdg[i];
940cd2c12ebff68 Felix Fietkau 2010-12-12  541  				pPwrR = data_9287[idxR].pwrPdg[i];
940cd2c12ebff68 Felix Fietkau 2010-12-12  542  			} else if (eeprom_4k) {
115277a3bc0683d Felix Fietkau 2010-12-12  543  				pVpdL = data_4k[idxL].vpdPdg[i];
115277a3bc0683d Felix Fietkau 2010-12-12  544  				pPwrL = data_4k[idxL].pwrPdg[i];
115277a3bc0683d Felix Fietkau 2010-12-12  545  				pVpdR = data_4k[idxR].vpdPdg[i];
115277a3bc0683d Felix Fietkau 2010-12-12  546  				pPwrR = data_4k[idxR].pwrPdg[i];
115277a3bc0683d Felix Fietkau 2010-12-12  547  			} else {
115277a3bc0683d Felix Fietkau 2010-12-12  548  				pVpdL = data_def[idxL].vpdPdg[i];
115277a3bc0683d Felix Fietkau 2010-12-12  549  				pPwrL = data_def[idxL].pwrPdg[i];
115277a3bc0683d Felix Fietkau 2010-12-12  550  				pVpdR = data_def[idxR].vpdPdg[i];
115277a3bc0683d Felix Fietkau 2010-12-12  551  				pPwrR = data_def[idxR].pwrPdg[i];
115277a3bc0683d Felix Fietkau 2010-12-12  552  			}
115277a3bc0683d Felix Fietkau 2010-12-12  553  
115277a3bc0683d Felix Fietkau 2010-12-12  554  			minPwrT4[i] = max(pPwrL[0], pPwrR[0]);
115277a3bc0683d Felix Fietkau 2010-12-12  555  
115277a3bc0683d Felix Fietkau 2010-12-12  556  			maxPwrT4[i] =
940cd2c12ebff68 Felix Fietkau 2010-12-12  557  				min(pPwrL[intercepts - 1],
940cd2c12ebff68 Felix Fietkau 2010-12-12  558  				    pPwrR[intercepts - 1]);
115277a3bc0683d Felix Fietkau 2010-12-12  559  
115277a3bc0683d Felix Fietkau 2010-12-12  560  
115277a3bc0683d Felix Fietkau 2010-12-12  561  			ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i],
115277a3bc0683d Felix Fietkau 2010-12-12  562  						pPwrL, pVpdL,
940cd2c12ebff68 Felix Fietkau 2010-12-12  563  						intercepts,
115277a3bc0683d Felix Fietkau 2010-12-12  564  						vpdTableL[i]);
115277a3bc0683d Felix Fietkau 2010-12-12  565  			ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i],
115277a3bc0683d Felix Fietkau 2010-12-12  566  						pPwrR, pVpdR,
940cd2c12ebff68 Felix Fietkau 2010-12-12  567  						intercepts,
115277a3bc0683d Felix Fietkau 2010-12-12  568  						vpdTableR[i]);
115277a3bc0683d Felix Fietkau 2010-12-12  569  
115277a3bc0683d Felix Fietkau 2010-12-12  570  			for (j = 0; j <= (maxPwrT4[i] - minPwrT4[i]) / 2; j++) {
115277a3bc0683d Felix Fietkau 2010-12-12  571  				vpdTableI[i][j] =
115277a3bc0683d Felix Fietkau 2010-12-12  572  					(u8)(ath9k_hw_interpolate((u16)
115277a3bc0683d Felix Fietkau 2010-12-12  573  					     FREQ2FBIN(centers.
115277a3bc0683d Felix Fietkau 2010-12-12  574  						       synth_center,
115277a3bc0683d Felix Fietkau 2010-12-12  575  						       IS_CHAN_2GHZ
115277a3bc0683d Felix Fietkau 2010-12-12  576  						       (chan)),
115277a3bc0683d Felix Fietkau 2010-12-12  577  					     bChans[idxL], bChans[idxR],
115277a3bc0683d Felix Fietkau 2010-12-12  578  					     vpdTableL[i][j], vpdTableR[i][j]));
115277a3bc0683d Felix Fietkau 2010-12-12  579  			}
115277a3bc0683d Felix Fietkau 2010-12-12  580  		}
115277a3bc0683d Felix Fietkau 2010-12-12  581  	}
115277a3bc0683d Felix Fietkau 2010-12-12  582  
115277a3bc0683d Felix Fietkau 2010-12-12  583  	k = 0;
115277a3bc0683d Felix Fietkau 2010-12-12  584  
115277a3bc0683d Felix Fietkau 2010-12-12  585  	for (i = 0; i < numXpdGains; i++) {
115277a3bc0683d Felix Fietkau 2010-12-12  586  		if (i == (numXpdGains - 1))
115277a3bc0683d Felix Fietkau 2010-12-12  587  			pPdGainBoundaries[i] =
115277a3bc0683d Felix Fietkau 2010-12-12  588  				(u16)(maxPwrT4[i] / 2);
115277a3bc0683d Felix Fietkau 2010-12-12  589  		else
115277a3bc0683d Felix Fietkau 2010-12-12  590  			pPdGainBoundaries[i] =
115277a3bc0683d Felix Fietkau 2010-12-12  591  				(u16)((maxPwrT4[i] + minPwrT4[i + 1]) / 4);
115277a3bc0683d Felix Fietkau 2010-12-12  592  
115277a3bc0683d Felix Fietkau 2010-12-12  593  		pPdGainBoundaries[i] =
115277a3bc0683d Felix Fietkau 2010-12-12  594  			min((u16)MAX_RATE_POWER, pPdGainBoundaries[i]);
115277a3bc0683d Felix Fietkau 2010-12-12  595  
115277a3bc0683d Felix Fietkau 2010-12-12  596  		minDelta = 0;
115277a3bc0683d Felix Fietkau 2010-12-12  597  
115277a3bc0683d Felix Fietkau 2010-12-12  598  		if (i == 0) {
115277a3bc0683d Felix Fietkau 2010-12-12  599  			if (AR_SREV_9280_20_OR_LATER(ah))
115277a3bc0683d Felix Fietkau 2010-12-12  600  				ss = (int16_t)(0 - (minPwrT4[i] / 2));
115277a3bc0683d Felix Fietkau 2010-12-12  601  			else
115277a3bc0683d Felix Fietkau 2010-12-12  602  				ss = 0;
115277a3bc0683d Felix Fietkau 2010-12-12  603  		} else {
115277a3bc0683d Felix Fietkau 2010-12-12  604  			ss = (int16_t)((pPdGainBoundaries[i - 1] -
115277a3bc0683d Felix Fietkau 2010-12-12  605  					(minPwrT4[i] / 2)) -
115277a3bc0683d Felix Fietkau 2010-12-12  606  				       tPdGainOverlap + 1 + minDelta);
115277a3bc0683d Felix Fietkau 2010-12-12  607  		}
115277a3bc0683d Felix Fietkau 2010-12-12  608  		vpdStep = (int16_t)(vpdTableI[i][1] - vpdTableI[i][0]);
115277a3bc0683d Felix Fietkau 2010-12-12  609  		vpdStep = (int16_t)((vpdStep < 1) ? 1 : vpdStep);
115277a3bc0683d Felix Fietkau 2010-12-12  610  
115277a3bc0683d Felix Fietkau 2010-12-12  611  		while ((ss < 0) && (k < (AR5416_NUM_PDADC_VALUES - 1))) {
115277a3bc0683d Felix Fietkau 2010-12-12  612  			tmpVal = (int16_t)(vpdTableI[i][0] + ss * vpdStep);
115277a3bc0683d Felix Fietkau 2010-12-12  613  			pPDADCValues[k++] = (u8)((tmpVal < 0) ? 0 : tmpVal);
115277a3bc0683d Felix Fietkau 2010-12-12  614  			ss++;
115277a3bc0683d Felix Fietkau 2010-12-12  615  		}
115277a3bc0683d Felix Fietkau 2010-12-12  616  
115277a3bc0683d Felix Fietkau 2010-12-12  617  		sizeCurrVpdTable = (u8) ((maxPwrT4[i] - minPwrT4[i]) / 2 + 1);
115277a3bc0683d Felix Fietkau 2010-12-12  618  		tgtIndex = (u8)(pPdGainBoundaries[i] + tPdGainOverlap -
115277a3bc0683d Felix Fietkau 2010-12-12  619  				(minPwrT4[i] / 2));
115277a3bc0683d Felix Fietkau 2010-12-12  620  		maxIndex = (tgtIndex < sizeCurrVpdTable) ?
115277a3bc0683d Felix Fietkau 2010-12-12  621  			tgtIndex : sizeCurrVpdTable;
115277a3bc0683d Felix Fietkau 2010-12-12  622  
115277a3bc0683d Felix Fietkau 2010-12-12  623  		while ((ss < maxIndex) && (k < (AR5416_NUM_PDADC_VALUES - 1))) {
115277a3bc0683d Felix Fietkau 2010-12-12  624  			pPDADCValues[k++] = vpdTableI[i][ss++];
115277a3bc0683d Felix Fietkau 2010-12-12  625  		}
115277a3bc0683d Felix Fietkau 2010-12-12  626  
115277a3bc0683d Felix Fietkau 2010-12-12  627  		vpdStep = (int16_t)(vpdTableI[i][sizeCurrVpdTable - 1] -
115277a3bc0683d Felix Fietkau 2010-12-12  628  				    vpdTableI[i][sizeCurrVpdTable - 2]);
115277a3bc0683d Felix Fietkau 2010-12-12  629  		vpdStep = (int16_t)((vpdStep < 1) ? 1 : vpdStep);
115277a3bc0683d Felix Fietkau 2010-12-12  630  
115277a3bc0683d Felix Fietkau 2010-12-12  631  		if (tgtIndex >= maxIndex) {
115277a3bc0683d Felix Fietkau 2010-12-12  632  			while ((ss <= tgtIndex) &&
115277a3bc0683d Felix Fietkau 2010-12-12  633  			       (k < (AR5416_NUM_PDADC_VALUES - 1))) {
115277a3bc0683d Felix Fietkau 2010-12-12  634  				tmpVal = (int16_t)((vpdTableI[i][sizeCurrVpdTable - 1] +
115277a3bc0683d Felix Fietkau 2010-12-12  635  						    (ss - maxIndex + 1) * vpdStep));
115277a3bc0683d Felix Fietkau 2010-12-12  636  				pPDADCValues[k++] = (u8)((tmpVal > 255) ?
115277a3bc0683d Felix Fietkau 2010-12-12  637  							 255 : tmpVal);
115277a3bc0683d Felix Fietkau 2010-12-12  638  				ss++;
115277a3bc0683d Felix Fietkau 2010-12-12  639  			}
115277a3bc0683d Felix Fietkau 2010-12-12  640  		}
115277a3bc0683d Felix Fietkau 2010-12-12  641  	}
115277a3bc0683d Felix Fietkau 2010-12-12  642  
115277a3bc0683d Felix Fietkau 2010-12-12  643  	if (eeprom_4k)
115277a3bc0683d Felix Fietkau 2010-12-12  644  		pdgain_boundary_default = 58;
115277a3bc0683d Felix Fietkau 2010-12-12  645  	else
115277a3bc0683d Felix Fietkau 2010-12-12  646  		pdgain_boundary_default = pPdGainBoundaries[i - 1];
115277a3bc0683d Felix Fietkau 2010-12-12  647  
115277a3bc0683d Felix Fietkau 2010-12-12  648  	while (i < AR5416_PD_GAINS_IN_MASK) {
115277a3bc0683d Felix Fietkau 2010-12-12  649  		pPdGainBoundaries[i] = pdgain_boundary_default;
115277a3bc0683d Felix Fietkau 2010-12-12  650  		i++;
115277a3bc0683d Felix Fietkau 2010-12-12  651  	}
115277a3bc0683d Felix Fietkau 2010-12-12  652  
115277a3bc0683d Felix Fietkau 2010-12-12  653  	while (k < AR5416_NUM_PDADC_VALUES) {
115277a3bc0683d Felix Fietkau 2010-12-12  654  		pPDADCValues[k] = pPDADCValues[k - 1];
115277a3bc0683d Felix Fietkau 2010-12-12  655  		k++;
115277a3bc0683d Felix Fietkau 2010-12-12  656  	}
115277a3bc0683d Felix Fietkau 2010-12-12 @657  }
115277a3bc0683d Felix Fietkau 2010-12-12  658  

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH ath-next] wifi: ath9k: drop static from local pdadc and vpdTable arrays
  2026-06-16  3:08 [PATCH ath-next] wifi: ath9k: drop static from local pdadc and vpdTable arrays Rosen Penev
  2026-06-17  6:00 ` kernel test robot
@ 2026-06-18  9:50 ` Toke Høiland-Jørgensen
  1 sibling, 0 replies; 3+ messages in thread
From: Toke Høiland-Jørgensen @ 2026-06-18  9:50 UTC (permalink / raw)
  To: Rosen Penev, linux-wireless; +Cc: open list

Rosen Penev <rosenp@gmail.com> writes:

> Remove the static qualifier from mutable local arrays in three EEPROM
> power-calibration functions.  These arrays are written to during normal
> operation, so static storage is both unnecessary and misleading: it
> implies sharing across calls when no such sharing is intended, and it
> makes the code subtly non-reentrant.  The sibling function in
> eeprom_9287.c already uses an automatic (stack-local) pdadcValues,
> confirming this is the correct pattern.
>
> This keeps ~1 KB of data off the static data section at the cost of
> stack usage, consistent with the rest of the driver's coding style.

As pointed out by the test robot, putting this much data on the stack is
a bad idea. Pretty sure it's static for exactly this reason in the first
place.

-Toke

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-06-18  9:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-16  3:08 [PATCH ath-next] wifi: ath9k: drop static from local pdadc and vpdTable arrays Rosen Penev
2026-06-17  6:00 ` kernel test robot
2026-06-18  9:50 ` Toke Høiland-Jørgensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox