[v5,2/2] staging: rtl8192e: replace macro defines with variables
Commit Message
remove marco defines of array length, use variables instead and
initialize them from ARRAY_SIZE().
Signed-off-by: Jacob Bai <jacob.bai.au@gmail.com>
---
.../staging/rtl8192e/rtl8192e/r8192E_hwimg.c | 31 ++++++++++------
.../staging/rtl8192e/rtl8192e/r8192E_hwimg.h | 36 +++++++++----------
.../staging/rtl8192e/rtl8192e/r8192E_phy.h | 20 -----------
3 files changed, 38 insertions(+), 49 deletions(-)
Comments
On Thu, Nov 10, 2022 at 09:35:11PM +1100, Jacob Bai wrote:
> remove marco defines of array length, use variables instead and
> initialize them from ARRAY_SIZE().
>
> Signed-off-by: Jacob Bai <jacob.bai.au@gmail.com>
> ---
> .../staging/rtl8192e/rtl8192e/r8192E_hwimg.c | 31 ++++++++++------
> .../staging/rtl8192e/rtl8192e/r8192E_hwimg.h | 36 +++++++++----------
> .../staging/rtl8192e/rtl8192e/r8192E_phy.h | 20 -----------
> 3 files changed, 38 insertions(+), 49 deletions(-)
>
> diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_hwimg.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_hwimg.c
> index 8920283f340e..ec9e2de4c942 100644
> --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_hwimg.c
> +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_hwimg.c
> @@ -6,9 +6,10 @@
> */
> #include "r8192E_hwimg.h"
>
> -u32 RTL8192E_PHY_REG_ARRAY[RTL8192E_PHY_REG_ARRAY_LEN] = {0x0,};
> +u32 RTL8192E_PHY_REG_ARRAY[] = {0x0,};
> +u32 RTL8192E_PHY_REG_ARRAY_LEN = ARRAY_SIZE(RTL8192E_PHY_REG_ARRAY);
ARRAY is bad name for an array. It's like saying "int variable_i;"
It just makes the name longer but doesn't add any information.
Get rid of the RTL8192E_PHY_REG_ARRAY_LEN define. Use ARRAY_SIZE()
directly in the code. This is no need for a layer of indirection and
obfuscation.
regards,
dan carpenter
On Thu, Nov 10, 2022 at 09:35:11PM +1100, Jacob Bai wrote:
> -u32 RTL8192E_PHY_REG_1T2R_ARRAY[RTL8192E_PHY_REG_1T2R_ARRAY_LEN] = {
> +u32 RTL8192E_PHY_REG_1T2R_ARRAY[] = {
> 0x800, 0x00000000,
> 0x804, 0x00000001,
> 0x808, 0x0000fc00,
> @@ -158,8 +159,9 @@ u32 RTL8192E_PHY_REG_1T2R_ARRAY[RTL8192E_PHY_REG_1T2R_ARRAY_LEN] = {
> 0xe18, 0x161a1a1a,
> 0xe1c, 0x12121416,
> };
> +u32 RTL8192E_PHY_REG_1T2R_ARRAY_LEN = ARRAY_SIZE(RTL8192E_PHY_REG_1T2R_ARRAY);
This patch is kind of a headache to review. I have to go through and
count 148 array elements to ensure that the array hasn't changed size.
But the first patch renames all these arrays, so I first have go back
to patch #1 to find the original name. It might be easier to do the
renames afterward.
Also the commit message should say something like "I have checked the
object code and there is no change at all" or "I have counted all these
array elements and there is no change to the size of the array."
regards,
dan carpenter
Hi Jacob,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on staging/staging-testing]
url: https://github.com/intel-lab-lkp/linux/commits/Jacob-Bai/staging-rtl8192e-trivial-code-cleanup-patches/20221110-183704
patch link: https://lore.kernel.org/r/354847ce7b2f9ea4dc549bf13656192c1db7c231.1668075486.git.jacob.bai.au%40gmail.com
patch subject: [PATCH v5 2/2] staging: rtl8192e: replace macro defines with variables
config: ia64-allmodconfig
compiler: ia64-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/804af0545f19f5e713da7263f96da7e9268054a9
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Jacob-Bai/staging-rtl8192e-trivial-code-cleanup-patches/20221110-183704
git checkout 804af0545f19f5e713da7263f96da7e9268054a9
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=ia64 SHELL=/bin/bash drivers/staging/rtl8192e/rtl8192e/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c: In function 'rtl92e_config_mac':
>> drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c:310:30: error: 'MACPHY_Array_PGLength' undeclared (first use in this function)
310 | dwArrayLen = MACPHY_Array_PGLength;
| ^~~~~~~~~~~~~~~~~~~~~
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c:310:30: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c:311:28: error: 'Rtl819XMACPHY_Array_PG' undeclared (first use in this function)
311 | pdwArray = Rtl819XMACPHY_Array_PG;
| ^~~~~~~~~~~~~~~~~~~~~~
>> drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c:314:30: error: 'MACPHY_ArrayLength' undeclared (first use in this function)
314 | dwArrayLen = MACPHY_ArrayLength;
| ^~~~~~~~~~~~~~~~~~
>> drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c:315:28: error: 'Rtl819XMACPHY_Array' undeclared (first use in this function); did you mean 'rtl819XAGCTAB_Array'?
315 | pdwArray = Rtl819XMACPHY_Array;
| ^~~~~~~~~~~~~~~~~~~
| rtl819XAGCTAB_Array
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c: In function '_rtl92e_phy_config_bb':
>> drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c:335:27: error: 'AGCTAB_ArrayLength' undeclared (first use in this function); did you mean 'AGCTAB_ArrayLen'?
335 | AGCTAB_ArrayLen = AGCTAB_ArrayLength;
| ^~~~~~~~~~~~~~~~~~
| AGCTAB_ArrayLen
>> drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c:336:37: error: 'Rtl819XAGCTAB_Array' undeclared (first use in this function); did you mean 'rtl819XAGCTAB_Array'?
336 | Rtl819XAGCTAB_Array_Table = Rtl819XAGCTAB_Array;
| ^~~~~~~~~~~~~~~~~~~
| rtl819XAGCTAB_Array
>> drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c:338:35: error: 'PHY_REGArrayLength' undeclared (first use in this function); did you mean 'PHY_REGArrayLen'?
338 | PHY_REGArrayLen = PHY_REGArrayLength;
| ^~~~~~~~~~~~~~~~~~
| PHY_REGArrayLen
>> drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c:339:45: error: 'Rtl819XPHY_REGArray' undeclared (first use in this function); did you mean 'Rtl819XPHY_REGArray_Table'?
339 | Rtl819XPHY_REGArray_Table = Rtl819XPHY_REGArray;
| ^~~~~~~~~~~~~~~~~~~
| Rtl819XPHY_REGArray_Table
>> drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c:341:35: error: 'PHY_REG_1T2RArrayLength' undeclared (first use in this function); did you mean 'PHY_REGArrayLen'?
341 | PHY_REGArrayLen = PHY_REG_1T2RArrayLength;
| ^~~~~~~~~~~~~~~~~~~~~~~
| PHY_REGArrayLen
>> drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c:342:45: error: 'Rtl819XPHY_REG_1T2RArray' undeclared (first use in this function); did you mean 'RTL8192E_PHY_REG_1T2R_ARRAY'?
342 | Rtl819XPHY_REGArray_Table = Rtl819XPHY_REG_1T2RArray;
| ^~~~~~~~~~~~~~~~~~~~~~~~
| RTL8192E_PHY_REG_1T2R_ARRAY
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c: In function 'rtl92e_config_rf_path':
>> drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c:671:33: error: 'RadioA_ArrayLength' undeclared (first use in this function)
671 | for (i = 0; i < RadioA_ArrayLength; i += 2) {
| ^~~~~~~~~~~~~~~~~~
>> drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c:672:29: error: 'Rtl819XRadioA_Array' undeclared (first use in this function); did you mean 'rtl819XAGCTAB_Array'?
672 | if (Rtl819XRadioA_Array[i] == 0xfe) {
| ^~~~~~~~~~~~~~~~~~~
| rtl819XAGCTAB_Array
>> drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c:683:33: error: 'RadioB_ArrayLength' undeclared (first use in this function)
683 | for (i = 0; i < RadioB_ArrayLength; i += 2) {
| ^~~~~~~~~~~~~~~~~~
>> drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c:684:29: error: 'Rtl819XRadioB_Array' undeclared (first use in this function); did you mean 'rtl819XAGCTAB_Array'?
684 | if (Rtl819XRadioB_Array[i] == 0xfe) {
| ^~~~~~~~~~~~~~~~~~~
| rtl819XAGCTAB_Array
>> drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c:695:33: error: 'RadioC_ArrayLength' undeclared (first use in this function)
695 | for (i = 0; i < RadioC_ArrayLength; i += 2) {
| ^~~~~~~~~~~~~~~~~~
>> drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c:696:29: error: 'Rtl819XRadioC_Array' undeclared (first use in this function)
696 | if (Rtl819XRadioC_Array[i] == 0xfe) {
| ^~~~~~~~~~~~~~~~~~~
>> drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c:707:33: error: 'RadioD_ArrayLength' undeclared (first use in this function)
707 | for (i = 0; i < RadioD_ArrayLength; i += 2) {
| ^~~~~~~~~~~~~~~~~~
>> drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c:708:29: error: 'Rtl819XRadioD_Array' undeclared (first use in this function)
708 | if (Rtl819XRadioD_Array[i] == 0xfe) {
| ^~~~~~~~~~~~~~~~~~~
--
>> drivers/staging/rtl8192e/rtl8192e/r8192E_hwimg.c:10:34: error: implicit declaration of function 'ARRAY_SIZE' [-Werror=implicit-function-declaration]
10 | u32 RTL8192E_PHY_REG_ARRAY_LEN = ARRAY_SIZE(RTL8192E_PHY_REG_ARRAY);
| ^~~~~~~~~~
>> drivers/staging/rtl8192e/rtl8192e/r8192E_hwimg.c:10:34: error: initializer element is not constant
drivers/staging/rtl8192e/rtl8192e/r8192E_hwimg.c:162:39: error: initializer element is not constant
162 | u32 RTL8192E_PHY_REG_1T2R_ARRAY_LEN = ARRAY_SIZE(RTL8192E_PHY_REG_1T2R_ARRAY);
| ^~~~~~~~~~
drivers/staging/rtl8192e/rtl8192e/r8192E_hwimg.c:289:33: error: initializer element is not constant
289 | u32 RTL8192E_RADIOA_ARRAY_LEN = ARRAY_SIZE(RTL8192E_RADIOA_ARRAY);
| ^~~~~~~~~~
drivers/staging/rtl8192e/rtl8192e/r8192E_hwimg.c:332:33: error: initializer element is not constant
332 | u32 RTL8192E_RADIOB_ARRAY_LEN = ARRAY_SIZE(RTL8192E_RADIOB_ARRAY);
| ^~~~~~~~~~
drivers/staging/rtl8192e/rtl8192e/r8192E_hwimg.c:336:33: error: initializer element is not constant
336 | u32 RTL8192E_RADIOC_ARRAY_LEN = ARRAY_SIZE(RTL8192E_RADIOC_ARRAY);
| ^~~~~~~~~~
drivers/staging/rtl8192e/rtl8192e/r8192E_hwimg.c:340:33: error: initializer element is not constant
340 | u32 RTL8192E_RADIOD_ARRAY_LEN = ARRAY_SIZE(RTL8192E_RADIOD_ARRAY);
| ^~~~~~~~~~
drivers/staging/rtl8192e/rtl8192e/r8192E_hwimg.c:350:30: error: initializer element is not constant
350 | u32 RTL8192E_MAC_ARRAY_LEN = ARRAY_SIZE(RTL8192E_MAC_ARRAY);
| ^~~~~~~~~~
drivers/staging/rtl8192e/rtl8192e/r8192E_hwimg.c:364:33: error: initializer element is not constant
364 | u32 RTL8192E_MAC_ARRAY_PG_LEN = ARRAY_SIZE(RTL8192E_MAC_ARRAY_PG);
| ^~~~~~~~~~
drivers/staging/rtl8192e/rtl8192e/r8192E_hwimg.c:560:34: error: initializer element is not constant
560 | u32 RTL8192E_AGC_TAB_ARRAY_LEN = ARRAY_SIZE(RTL8192E_AGC_TAB_ARRAY);
| ^~~~~~~~~~
cc1: some warnings being treated as errors
vim +/MACPHY_Array_PGLength +310 drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
94a799425eee82 drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-23 301
94a799425eee82 drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-23 302
0efe7104ea2a1e drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c Mateusz Kulikowski 2015-07-19 303 void rtl92e_config_mac(struct net_device *dev)
94a799425eee82 drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-23 304 {
94a799425eee82 drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-23 305 u32 dwArrayLen = 0, i = 0;
94a799425eee82 drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-23 306 u32 *pdwArray = NULL;
94a799425eee82 drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-23 307 struct r8192_priv *priv = rtllib_priv(dev);
547d0c34b71b1c drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-25 308
547d0c34b71b1c drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-25 309 if (priv->bTXPowerDataReadFromEEPORM) {
94a799425eee82 drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-23 @310 dwArrayLen = MACPHY_Array_PGLength;
94a799425eee82 drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-23 @311 pdwArray = Rtl819XMACPHY_Array_PG;
94a799425eee82 drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-23 312
547d0c34b71b1c drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-25 313 } else {
94a799425eee82 drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-23 @314 dwArrayLen = MACPHY_ArrayLength;
94a799425eee82 drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-23 @315 pdwArray = Rtl819XMACPHY_Array;
94a799425eee82 drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-23 316 }
547d0c34b71b1c drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-25 317 for (i = 0; i < dwArrayLen; i += 3) {
94a799425eee82 drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-23 318 if (pdwArray[i] == 0x318)
94a799425eee82 drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-23 319 pdwArray[i+2] = 0x00000800;
153f9ddbe97828 drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c Mateusz Kulikowski 2015-07-19 320 rtl92e_set_bb_reg(dev, pdwArray[i], pdwArray[i+1],
547d0c34b71b1c drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-25 321 pdwArray[i+2]);
94a799425eee82 drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-23 322 }
94a799425eee82 drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-23 323 return;
94a799425eee82 drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-23 324
94a799425eee82 drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-23 325 }
94a799425eee82 drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-23 326
a059e47206d7f7 drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c Mateusz Kulikowski 2015-09-20 327 static void _rtl92e_phy_config_bb(struct net_device *dev, u8 ConfigType)
94a799425eee82 drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-23 328 {
94a799425eee82 drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-23 329 int i;
94a799425eee82 drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-23 330 u32 *Rtl819XPHY_REGArray_Table = NULL;
94a799425eee82 drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-23 331 u32 *Rtl819XAGCTAB_Array_Table = NULL;
94a799425eee82 drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-23 332 u16 AGCTAB_ArrayLen, PHY_REGArrayLen = 0;
94a799425eee82 drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-23 333 struct r8192_priv *priv = rtllib_priv(dev);
547d0c34b71b1c drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-25 334
94a799425eee82 drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-23 @335 AGCTAB_ArrayLen = AGCTAB_ArrayLength;
94a799425eee82 drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-23 @336 Rtl819XAGCTAB_Array_Table = Rtl819XAGCTAB_Array;
547d0c34b71b1c drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-25 337 if (priv->rf_type == RF_2T4R) {
94a799425eee82 drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-23 @338 PHY_REGArrayLen = PHY_REGArrayLength;
94a799425eee82 drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-23 @339 Rtl819XPHY_REGArray_Table = Rtl819XPHY_REGArray;
547d0c34b71b1c drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-25 340 } else if (priv->rf_type == RF_1T2R) {
94a799425eee82 drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-23 @341 PHY_REGArrayLen = PHY_REG_1T2RArrayLength;
94a799425eee82 drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-23 @342 Rtl819XPHY_REGArray_Table = Rtl819XPHY_REG_1T2RArray;
94a799425eee82 drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-23 343 }
94a799425eee82 drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-23 344
547d0c34b71b1c drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-25 345 if (ConfigType == BaseBand_Config_PHY_REG) {
547d0c34b71b1c drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-25 346 for (i = 0; i < PHY_REGArrayLen; i += 2) {
153f9ddbe97828 drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c Mateusz Kulikowski 2015-07-19 347 rtl92e_set_bb_reg(dev, Rtl819XPHY_REGArray_Table[i],
547d0c34b71b1c drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-25 348 bMaskDWord,
547d0c34b71b1c drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-25 349 Rtl819XPHY_REGArray_Table[i+1]);
547d0c34b71b1c drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-25 350 }
547d0c34b71b1c drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-25 351 } else if (ConfigType == BaseBand_Config_AGC_TAB) {
547d0c34b71b1c drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-25 352 for (i = 0; i < AGCTAB_ArrayLen; i += 2) {
153f9ddbe97828 drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c Mateusz Kulikowski 2015-07-19 353 rtl92e_set_bb_reg(dev, Rtl819XAGCTAB_Array_Table[i],
547d0c34b71b1c drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-25 354 bMaskDWord,
547d0c34b71b1c drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-25 355 Rtl819XAGCTAB_Array_Table[i+1]);
94a799425eee82 drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-23 356 }
94a799425eee82 drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-23 357 }
94a799425eee82 drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-23 358 }
547d0c34b71b1c drivers/staging/rtl8192e/r8192E_phy.c Larry Finger 2011-08-25 359
@@ -6,9 +6,10 @@
*/
#include "r8192E_hwimg.h"
-u32 RTL8192E_PHY_REG_ARRAY[RTL8192E_PHY_REG_ARRAY_LEN] = {0x0,};
+u32 RTL8192E_PHY_REG_ARRAY[] = {0x0,};
+u32 RTL8192E_PHY_REG_ARRAY_LEN = ARRAY_SIZE(RTL8192E_PHY_REG_ARRAY);
-u32 RTL8192E_PHY_REG_1T2R_ARRAY[RTL8192E_PHY_REG_1T2R_ARRAY_LEN] = {
+u32 RTL8192E_PHY_REG_1T2R_ARRAY[] = {
0x800, 0x00000000,
0x804, 0x00000001,
0x808, 0x0000fc00,
@@ -158,8 +159,9 @@ u32 RTL8192E_PHY_REG_1T2R_ARRAY[RTL8192E_PHY_REG_1T2R_ARRAY_LEN] = {
0xe18, 0x161a1a1a,
0xe1c, 0x12121416,
};
+u32 RTL8192E_PHY_REG_1T2R_ARRAY_LEN = ARRAY_SIZE(RTL8192E_PHY_REG_1T2R_ARRAY);
-u32 RTL8192E_RADIOA_ARRAY[RTL8192E_RADIOA_ARRAY_LEN] = {
+u32 RTL8192E_RADIOA_ARRAY[] = {
0x019, 0x00000003,
0x000, 0x000000bf,
0x001, 0x00000ee0,
@@ -284,8 +286,9 @@ u32 RTL8192E_RADIOA_ARRAY[RTL8192E_RADIOA_ARRAY_LEN] = {
0x004, 0x00000975,
0x007, 0x00000700,
};
+u32 RTL8192E_RADIOA_ARRAY_LEN = ARRAY_SIZE(RTL8192E_RADIOA_ARRAY);
-u32 RTL8192E_RADIOB_ARRAY[RTL8192E_RADIOB_ARRAY_LEN] = {
+u32 RTL8192E_RADIOB_ARRAY[] = {
0x019, 0x00000003,
0x000, 0x000000bf,
0x001, 0x000006e0,
@@ -326,14 +329,17 @@ u32 RTL8192E_RADIOB_ARRAY[RTL8192E_RADIOB_ARRAY_LEN] = {
0x004, 0x00000975,
0x007, 0x00000700,
};
+u32 RTL8192E_RADIOB_ARRAY_LEN = ARRAY_SIZE(RTL8192E_RADIOB_ARRAY);
-u32 RTL8192E_RADIOC_ARRAY[RTL8192E_RADIOC_ARRAY_LEN] = {
- 0x0, };
+u32 RTL8192E_RADIOC_ARRAY[] = {
+ 0x0, 0x0 };
+u32 RTL8192E_RADIOC_ARRAY_LEN = ARRAY_SIZE(RTL8192E_RADIOC_ARRAY);
-u32 RTL8192E_RADIOD_ARRAY[RTL8192E_RADIOD_ARRAY_LEN] = {
- 0x0, };
+u32 RTL8192E_RADIOD_ARRAY[] = {
+ 0x0, 0x0 };
+u32 RTL8192E_RADIOD_ARRAY_LEN = ARRAY_SIZE(RTL8192E_RADIOD_ARRAY);
-u32 RTL8192E_MAC_ARRAY[RTL8192E_MAC_ARRAY_LEN] = {
+u32 RTL8192E_MAC_ARRAY[] = {
0x03c, 0xffff0000, 0x00000f0f,
0x340, 0xffffffff, 0x161a1a1a,
0x344, 0xffffffff, 0x12121416,
@@ -341,8 +347,9 @@ u32 RTL8192E_MAC_ARRAY[RTL8192E_MAC_ARRAY_LEN] = {
0x12c, 0xffffffff, 0x04000802,
0x318, 0x00000fff, 0x00000100,
};
+u32 RTL8192E_MAC_ARRAY_LEN = ARRAY_SIZE(RTL8192E_MAC_ARRAY);
-u32 RTL8192E_MAC_ARRAY_PG[RTL8192E_MAC_ARRAY_PG_LEN] = {
+u32 RTL8192E_MAC_ARRAY_PG[] = {
0x03c, 0xffff0000, 0x00000f0f,
0xe00, 0xffffffff, 0x06090909,
0xe04, 0xffffffff, 0x00030306,
@@ -354,8 +361,9 @@ u32 RTL8192E_MAC_ARRAY_PG[RTL8192E_MAC_ARRAY_PG_LEN] = {
0x12c, 0xffffffff, 0x04000802,
0x318, 0x00000fff, 0x00000800,
};
+u32 RTL8192E_MAC_ARRAY_PG_LEN = ARRAY_SIZE(RTL8192E_MAC_ARRAY_PG);
-u32 RTL8192E_AGC_TAB_ARRAY[RTL8192E_AGC_TAB_ARRAY_LEN] = {
+u32 RTL8192E_AGC_TAB_ARRAY[] = {
0xc78, 0x7d000001,
0xc78, 0x7d010001,
0xc78, 0x7d020001,
@@ -549,3 +557,4 @@ u32 RTL8192E_AGC_TAB_ARRAY[RTL8192E_AGC_TAB_ARRAY_LEN] = {
0xc78, 0x693e001e,
0xc78, 0x6a3f001e,
};
+u32 RTL8192E_AGC_TAB_ARRAY_LEN = ARRAY_SIZE(RTL8192E_AGC_TAB_ARRAY);
@@ -11,23 +11,23 @@
#include <linux/types.h>
-#define RTL8192E_PHY_REG_ARRAY_LEN 1
-extern u32 RTL8192E_PHY_REG_ARRAY[RTL8192E_PHY_REG_ARRAY_LEN];
-#define RTL8192E_PHY_REG_1T2R_ARRAY_LEN 296
-extern u32 RTL8192E_PHY_REG_1T2R_ARRAY[RTL8192E_PHY_REG_1T2R_ARRAY_LEN];
-#define RTL8192E_RADIOA_ARRAY_LEN 246
-extern u32 RTL8192E_RADIOA_ARRAY[RTL8192E_RADIOA_ARRAY_LEN];
-#define RTL8192E_RADIOB_ARRAY_LEN 78
-extern u32 RTL8192E_RADIOB_ARRAY[RTL8192E_RADIOB_ARRAY_LEN];
-#define RTL8192E_RADIOC_ARRAY_LEN 2
-extern u32 RTL8192E_RADIOC_ARRAY[RTL8192E_RADIOC_ARRAY_LEN];
-#define RTL8192E_RADIOD_ARRAY_LEN 2
-extern u32 RTL8192E_RADIOD_ARRAY[RTL8192E_RADIOD_ARRAY_LEN];
-#define RTL8192E_MAC_ARRAY_LEN 18
-extern u32 RTL8192E_MAC_ARRAY[RTL8192E_MAC_ARRAY_LEN];
-#define RTL8192E_MAC_ARRAY_PG_LEN 30
-extern u32 RTL8192E_MAC_ARRAY_PG[RTL8192E_MAC_ARRAY_PG_LEN];
-#define RTL8192E_AGC_TAB_ARRAY_LEN 384
-extern u32 RTL8192E_AGC_TAB_ARRAY[RTL8192E_AGC_TAB_ARRAY_LEN];
+extern u32 RTL8192E_PHY_REG_ARRAY_LEN;
+extern u32 RTL8192E_PHY_REG_ARRAY[];
+extern u32 RTL8192E_PHY_REG_1T2R_ARRAY_LEN;
+extern u32 RTL8192E_PHY_REG_1T2R_ARRAY[];
+extern u32 RTL8192E_RADIOA_ARRAY_LEN;
+extern u32 RTL8192E_RADIOA_ARRAY[];
+extern u32 RTL8192E_RADIOB_ARRAY_LEN;
+extern u32 RTL8192E_RADIOB_ARRAY[];
+extern u32 RTL8192E_RADIOC_ARRAY_LEN;
+extern u32 RTL8192E_RADIOC_ARRAY[];
+extern u32 RTL8192E_RADIOD_ARRAY_LEN;
+extern u32 RTL8192E_RADIOD_ARRAY[];
+extern u32 RTL8192E_MAC_ARRAY_LEN;
+extern u32 RTL8192E_MAC_ARRAY[];
+extern u32 RTL8192E_MAC_ARRAY_PG_LEN;
+extern u32 RTL8192E_MAC_ARRAY_PG[];
+extern u32 RTL8192E_AGC_TAB_ARRAY_LEN;
+extern u32 RTL8192E_AGC_TAB_ARRAY[];
#endif
@@ -9,26 +9,6 @@
#define MAX_DOZE_WAITING_TIMES_9x 64
-#define AGCTAB_ArrayLength RTL8192E_AGC_TAB_ARRAY_LEN
-#define MACPHY_ArrayLength RTL8192E_MAC_ARRAY_LEN
-#define RadioA_ArrayLength RTL8192E_RADIOA_ARRAY_LEN
-#define RadioB_ArrayLength RTL8192E_RADIOB_ARRAY_LEN
-#define MACPHY_Array_PGLength RTL8192E_MAC_ARRAY_PG_LEN
-#define RadioC_ArrayLength RTL8192E_RADIOC_ARRAY_LEN
-#define RadioD_ArrayLength RTL8192E_RADIOD_ARRAY_LEN
-#define PHY_REGArrayLength RTL8192E_PHY_REG_ARRAY_LEN
-#define PHY_REG_1T2RArrayLength RTL8192E_PHY_REG_1T2R_ARRAY_LEN
-
-#define Rtl819XMACPHY_Array_PG RTL8192E_MAC_ARRAY_PG
-#define Rtl819XMACPHY_Array RTL8192E_MAC_ARRAY
-#define Rtl819XRadioA_Array RTL8192E_RADIOA_ARRAY
-#define Rtl819XRadioB_Array RTL8192E_RADIOB_ARRAY
-#define Rtl819XRadioC_Array RTL8192E_RADIOC_ARRAY
-#define Rtl819XRadioD_Array RTL8192E_RADIOD_ARRAY
-#define Rtl819XAGCTAB_Array RTL8192E_AGC_TAB_ARRAY
-#define Rtl819XPHY_REGArray RTL8192E_PHY_REG_ARRAY
-#define Rtl819XPHY_REG_1T2RArray RTL8192E_PHY_REG_1T2R_ARRAY
-
extern u32 rtl819XAGCTAB_Array[];
enum hw90_block {