staging: rtl8192e: Removing empty arrays ..RadioC_A.. and ..ERadioD_A..
cover staging: rtl8192e: Removing empty arrays ..RadioC_A.. and ..ERadioD_A..
Rtl8192PciERadioC_Array and Rtl8192PciERadioD_Array contain only two values set to 0. Reviewing the other Arrays in table.c and looking into other realtek drivers (rtl8192se and rtl8192ee) this arrays are not containing valid data.
Tested with rtl8192e
Transferred this patch over wlan connection of rtl8192e
This patch series requires the patches:
"[PATCH 0/2] staging: rtl8192e: Removing rf_type RF_2T4R from driver" "[PATCH] staging: rtl8192e: Change filename r8192E_hwimg.x to table.x" "[PATCH] staging: rtl8192e: Remove call_usermodehelper starting RadioPower.sh" "[PATCH] staging: rtl8192e: Remove function ..dm_check_ac_dc_power calling a script"
Philipp Hortmann (2):
staging: rtl8192e: Remove empty Array Rtl8192PciERadioC_Array
staging: rtl8192e: Remove empty Array Rtl8192PciERadioD_Array
.../staging/rtl8192e/rtl8192e/r8192E_phy.c | 24 ------------------- .../staging/rtl8192e/rtl8192e/r8192E_phy.h | 4 ---- drivers/staging/rtl8192e/rtl8192e/table.c | 6 ----- drivers/staging/rtl8192e/rtl8192e/table.h | 4 ---- 4 files changed, 38 deletions(-)
Signature · 1 line
2.39.2
PATCH 1/2 staging: rtl8192e: Remove empty Array Rtl8192PciERadioC_Array
Remove empty array Rtl8192PciERadioC_Array and the code where it is used because it is dead code.
--- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 12 ------------ drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 2 -- drivers/staging/rtl8192e/rtl8192e/table.c | 3 --- drivers/staging/rtl8192e/rtl8192e/table.h | 2 -- 4 files changed, 19 deletions(-)
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +0 -12
@@ -649,18 +649,6 @@ u8 rtl92e_config_rf_path(struct net_device *dev, enum rf90_radio_path eRFPath) bMask12Bits, Rtl819XRadioB_Array[i+1]); - } -break ; -case RF90_PATH_C : -for (i =0 ; i < RadioC_ArrayLength; i +=2 ) { -if (Rtl819XRadioC_Array[i] ==0xfe ) { -msleep (100 ); -continue ; - } -rtl92e_set_rf_reg (dev, eRFPath, Rtl819XRadioC_Array[i], - bMask12Bits, - Rtl819XRadioC_Array[i+1 ]); - }break ;case RF90_PATH_D :
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +0 -2
@@ -14,7 +14,6 @@#define RadioA_ArrayLength RadioA_ArrayLengthPciE#define RadioB_ArrayLength RadioB_ArrayLengthPciE#define MACPHY_Array_PGLength MACPHY_Array_PGLengthPciE -#define RadioC_ArrayLength RadioC_ArrayLengthPciE#define RadioD_ArrayLength RadioD_ArrayLengthPciE#define PHY_REG_1T2RArrayLength PHY_REG_1T2RArrayLengthPciE
@@ -22,7 +21,6 @@#define Rtl819XMACPHY_Array Rtl8192PciEMACPHY_Array#define Rtl819XRadioA_Array Rtl8192PciERadioA_Array#define Rtl819XRadioB_Array Rtl8192PciERadioB_Array -#define Rtl819XRadioC_Array Rtl8192PciERadioC_Array#define Rtl819XRadioD_Array Rtl8192PciERadioD_Array#define Rtl819XAGCTAB_Array Rtl8192PciEAGCTAB_Array#define Rtl819XPHY_REG_1T2RArray Rtl8192PciEPHY_REG_1T2RArray
drivers/staging/rtl8192e/rtl8192e/table.c +0 -3
@@ -325,9 +325,6 @@ u32 Rtl8192PciERadioB_Array[RadioB_ArrayLengthPciE] = { 0x007, 0x00000700, }; -u32 Rtl8192PciERadioC_Array[RadioC_ArrayLengthPciE] = { -0x0 , }; -u32 Rtl8192PciERadioD_Array[RadioD_ArrayLengthPciE] = {0x0 , };
drivers/staging/rtl8192e/rtl8192e/table.h +0 -2
@@ -17,8 +17,6 @@ extern u32 Rtl8192PciEPHY_REG_1T2RArray[PHY_REG_1T2RArrayLengthPciE];extern u32 Rtl8192PciERadioA_Array[RadioA_ArrayLengthPciE];#define RadioB_ArrayLengthPciE 78extern u32 Rtl8192PciERadioB_Array[RadioB_ArrayLengthPciE]; -#define RadioC_ArrayLengthPciE 2 -extern u32 Rtl8192PciERadioC_Array[RadioC_ArrayLengthPciE];#define RadioD_ArrayLengthPciE 2extern u32 Rtl8192PciERadioD_Array[RadioD_ArrayLengthPciE];#define MACPHY_ArrayLengthPciE 18
Signature · 1 line
2.39.2
PATCH 2/2 staging: rtl8192e: Remove empty Array Rtl8192PciERadioD_Array
In reply to Philipp HortmannRemove empty array Rtl8192PciERadioD_Array and the code where it is used because it is dead code.
--- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 12 ------------ drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 2 -- drivers/staging/rtl8192e/rtl8192e/table.c | 3 --- drivers/staging/rtl8192e/rtl8192e/table.h | 2 -- 4 files changed, 19 deletions(-)
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +0 -12
@@ -649,18 +649,6 @@ u8 rtl92e_config_rf_path(struct net_device *dev, enum rf90_radio_path eRFPath) bMask12Bits, Rtl819XRadioB_Array[i+1]); - } -break ; -case RF90_PATH_D : -for (i =0 ; i < RadioD_ArrayLength; i +=2 ) { -if (Rtl819XRadioD_Array[i] ==0xfe ) { -msleep (100 ); -continue ; - } -rtl92e_set_rf_reg (dev, eRFPath, Rtl819XRadioD_Array[i], - bMask12Bits, - Rtl819XRadioD_Array[i+1 ]); - }break ;default :
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +0 -2
@@ -14,14 +14,12 @@#define RadioA_ArrayLength RadioA_ArrayLengthPciE#define RadioB_ArrayLength RadioB_ArrayLengthPciE#define MACPHY_Array_PGLength MACPHY_Array_PGLengthPciE -#define RadioD_ArrayLength RadioD_ArrayLengthPciE#define PHY_REG_1T2RArrayLength PHY_REG_1T2RArrayLengthPciE#define Rtl819XMACPHY_Array_PG Rtl8192PciEMACPHY_Array_PG#define Rtl819XMACPHY_Array Rtl8192PciEMACPHY_Array#define Rtl819XRadioA_Array Rtl8192PciERadioA_Array#define Rtl819XRadioB_Array Rtl8192PciERadioB_Array -#define Rtl819XRadioD_Array Rtl8192PciERadioD_Array#define Rtl819XAGCTAB_Array Rtl8192PciEAGCTAB_Array#define Rtl819XPHY_REG_1T2RArray Rtl8192PciEPHY_REG_1T2RArray
drivers/staging/rtl8192e/rtl8192e/table.c +0 -3
@@ -325,9 +325,6 @@ u32 Rtl8192PciERadioB_Array[RadioB_ArrayLengthPciE] = { 0x007, 0x00000700, }; -u32 Rtl8192PciERadioD_Array[RadioD_ArrayLengthPciE] = { -0x0 , }; -u32 Rtl8192PciEMACPHY_Array[] = {0x03c ,0xffff0000 ,0x00000f0f ,0x340 ,0xffffffff ,0x161a1a1a ,
drivers/staging/rtl8192e/rtl8192e/table.h +0 -2
@@ -17,8 +17,6 @@ extern u32 Rtl8192PciEPHY_REG_1T2RArray[PHY_REG_1T2RArrayLengthPciE];extern u32 Rtl8192PciERadioA_Array[RadioA_ArrayLengthPciE];#define RadioB_ArrayLengthPciE 78extern u32 Rtl8192PciERadioB_Array[RadioB_ArrayLengthPciE]; -#define RadioD_ArrayLengthPciE 2 -extern u32 Rtl8192PciERadioD_Array[RadioD_ArrayLengthPciE];#define MACPHY_ArrayLengthPciE 18extern u32 Rtl8192PciEMACPHY_Array[MACPHY_ArrayLengthPciE];#define MACPHY_Array_PGLengthPciE 30
Signature · 1 line
2.39.2
Re: [PATCH 1/2] staging: rtl8192e: Remove empty Array Rtl8192PciERadioC_Array
In reply to Philipp HortmannQuoted 21 lines · Philipp Hortmann
Remove empty array
Rtl8192PciERadioC_Arrayand the code where it is used because it is dead code.Signed-off-by Philipp Hortmann <[email protected]>--- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 12 ------------ drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 2 -- drivers/staging/rtl8192e/rtl8192e/table.c | 3 --- drivers/staging/rtl8192e/rtl8192e/table.h | 2 -- 4 files changed, 19 deletions(-)drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +0
-2@@ -649,18 +649,6 @@ u8 rtl92e_config_rf_path(struct net_device *dev, enum rf90_radio_path eRFPath) bMask12Bits, Rtl819XRadioB_Array[i+1]); - } -break ;
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c u8 rtl92e_config_rf_path(struct net_device *dev, enum rf90_radio_path eRFPath) · line 663
Quoted 10 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +0
-10-case RF90_PATH_C : -for (i =0 ; i < RadioC_ArrayLength; i +=2 ) { -if (Rtl819XRadioC_Array[i] ==0xfe ) { -msleep (100 ); -continue ; - } -rtl92e_set_rf_reg (dev, eRFPath, Rtl819XRadioC_Array[i], - bMask12Bits, - Rtl819XRadioC_Array[i+1 ]); -
Why is this dead code? So far as I can see "== 0xfe" is always false so this calls rtl92e_set_rf_reg() on every iteration through the loop. It only does one iteration through the loop.
Is it dead code because case RF90_PATH_C is always false? If so then that needs to be explained in the commit message.
regards,
dan carpenter
Re: [PATCH 2/2] staging: rtl8192e: Remove empty Array Rtl8192PciERadioD_Array
In reply to Philipp HortmannQuoted 4 lines · Philipp Hortmann
Remove empty array
Rtl8192PciERadioD_Arrayand the code where it is used because it is dead code.Signed-off-by Philipp Hortmann <[email protected]>
Same comments as for the earlier commit.
regards,
dan carpenter
Re: [PATCH 2/2] staging: rtl8192e: Remove empty Array Rtl8192PciERadioD_Array
In reply to Philipp HortmannQuoted 2 lines · Philipp Hortmann
Remove empty array
Rtl8192PciERadioD_Arrayand the code where it is used because it is dead code.
It's not really empty. It has two zeroes in it.
regards,
dan carpenter
Re: [PATCH 1/2] staging: rtl8192e: Remove empty Array Rtl8192PciERadioC_Array
In reply to Dan CarpenterQuoted 37 lines · Dan Carpenter
Quoted 21 lines · Philipp Hortmann
Remove empty array
Rtl8192PciERadioC_Arrayand the code where it is used because it is dead code.Signed-off-by Philipp Hortmann <[email protected]>--- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 12 ------------ drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 2 -- drivers/staging/rtl8192e/rtl8192e/table.c | 3 --- drivers/staging/rtl8192e/rtl8192e/table.h | 2 -- 4 files changed, 19 deletions(-)drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +0
-2@@ -649,18 +649,6 @@ u8 rtl92e_config_rf_path(struct net_device *dev, enum rf90_radio_path eRFPath) bMask12Bits, Rtl819XRadioB_Array[i+1]); - } -break ;drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c u8 rtl92e_config_rf_path(struct net_device *dev, enum rf90_radio_path eRFPath) · line 663
Quoted 10 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +0
-10-case RF90_PATH_C : -for (i =0 ; i < RadioC_ArrayLength; i +=2 ) { -if (Rtl819XRadioC_Array[i] ==0xfe ) { -msleep (100 ); -continue ; - } -rtl92e_set_rf_reg (dev, eRFPath, Rtl819XRadioC_Array[i], - bMask12Bits, - Rtl819XRadioC_Array[i+1 ]); -Why is this dead code? So far as I can see "==
0xfe" is always false so this callsrtl92e_set_rf_reg()on every iteration through the loop. It only does one iteration through the loop.
Quoted 6 lines
Is it dead code because case
RF90_PATH_Cis always false? If so then that needs to be explained in the commit message.regards,
dan carpenter
Hi Dan,
thanks for the review. Here some answers to your questions:
With patch: "[PATCH] staging: rtl8192e: Change filename r8192E_hwimg.x to table.x" I changed the filename of r8192E_hwimg.c to table.c and r8192E_hwimg.h to table.h to adapt filenames from drivers/net/wireless/realtek/rtlwifi rtl8192ee and rtl8192se. Task is from TODO file.
The explanation from the cover letter of this patch series was:
Rtl8192PciERadioC_Array and Rtl8192PciERadioD_Array contain only two values set to 0. Reviewing the other Arrays in table.c and looking into other realtek drivers (rtl8192se and rtl8192ee) this arrays are not containing valid data.
Here some more examples of my thoughts:
A valid filled array is looking like this:
u32 Rtl8192PciERadioA_Array[RadioA_ArrayLengthPciE] = {
0x019, 0x00000003,
0x000, 0x000000bf,
0x001, 0x00000ee0,
...
over 100 lines but no 0x000, 0x00000000,
...
0x004, 0x00000975,
0x007, 0x00000700,
};u32 Rtl8192PciERadioB_Array[RadioB_ArrayLengthPciE] = {
0x019, 0x00000003,
0x000, 0x000000bf,
0x001, 0x000006e0,
...
over 30 lines but no 0x000, 0x00000000,
...
0x004, 0x00000975,
0x007, 0x00000700,
};The empty (it is not empty but compared to the ones filled with data it is empty) one is looking like this:
u32 Rtl8192PciERadioC_Array[RadioC_ArrayLengthPciE] = {
0x0, };Looking into other cleaned up drivers from the same family:
Example: drivers/net/wireless/realtek/rtlwifi/rtl8192se Arrays RadioA and RadioB are filled RadioC and RadioD do not exist.
Example: drivers/net/wireless/realtek/rtlwifi/rtl8192ee Arrays RadioA and RadioB are filled RadioC and RadioD do not exist.
Example: drivers/net/wireless/realtek/rtlwifi/rtl8192de Arrays RadioA and RadioB are filled RadioC and RadioD do not exist.
In Example: drivers/net/wireless/realtek/rtlwifi/rtl8192cu I can find a RadioB Array that is just filled with one 0 which is odd:
#define RTL8192CURADIOB_1TARRAYLENGTH 1
u32 RTL8192CU_RADIOB_1TARRAY[RTL8192CURADIOB_1TARRAYLENGTH] = {
0x0,
};Here it is written to a variable:
rtlphy->hwparam_tables[RADIOB_1T].length = RTL8192CURADIOB_1TARRAYLENGTH; rtlphy->hwparam_tables[RADIOB_1T].pdata = RTL8192CU_RADIOB_1TARRAY;
Written to an another variable:
radiob_arraylen = rtlphy->hwparam_tables[RADIOB_1T].length; radiob_array_table = rtlphy->hwparam_tables[RADIOB_1T].pdata;
And then accessed after with i + 1 the element that is random/undefined.
case RF90_PATH_B:
for (i = 0; i < radiob_arraylen; i = i + 2) {
rtl_rfreg_delay(hw, rfpath, radiob_array_table[i],
RFREG_OFFSET_MASK,
radiob_array_table[i + 1]);
}May be another patch.
I hope this can convince you that Arrays for RadioX that do only contain one or two 0 are not in use.
Please let me know your thoughts.
Thanks
Philipp
Re: [PATCH 1/2] staging: rtl8192e: Remove empty Array Rtl8192PciERadioC_Array
Quoted 11 lines · Philipp Hortmann
Hi Dan,
thanks for the review. Here some answers to your questions:
With patch: "[PATCH] staging: rtl8192e: Change filename r8192E_hwimg.x to table.x" I changed the filename of
r8192E_hwimg.ctotable.candr8192E_hwimg.htotable.hto adapt filenames fromdrivers/net/wireless/realtek/rtlwifirtl8192ee and rtl8192se. Task is from TODO file.The explanation from the cover letter of this patch series was:
I never read cover letters. No one is ever going to see the cover letter when they look through git log -p so I don't see the point...
Quoted 66 lines
Rtl8192PciERadioC_ArrayandRtl8192PciERadioD_Arraycontain only two values set to 0. Reviewing the other Arrays intable.cand looking into other realtek drivers (rtl8192se and rtl8192ee) this arrays are not containing valid data.Here some more examples of my thoughts:
A valid filled array is looking like this:
u32 Rtl8192PciERadioA_Array[RadioA_ArrayLengthPciE] = { 0x019, 0x00000003, 0x000, 0x000000bf, 0x001, 0x00000ee0, ... over 100 lines but no 0x000, 0x00000000, ... 0x004, 0x00000975, 0x007, 0x00000700, };u32 Rtl8192PciERadioB_Array[RadioB_ArrayLengthPciE] = { 0x019, 0x00000003, 0x000, 0x000000bf, 0x001, 0x000006e0, ... over 30 lines but no 0x000, 0x00000000, ... 0x004, 0x00000975, 0x007, 0x00000700, };The empty (it is not empty but compared to the ones filled with data it is empty) one is looking like this:
u32 Rtl8192PciERadioC_Array[RadioC_ArrayLengthPciE] = { 0x0, };Looking into other cleaned up drivers from the same family:
Example:drivers/net/wireless/realtek/rtlwifi/rtl8192seArrays RadioA and RadioB are filled RadioC and RadioD do not exist.
Example:drivers/net/wireless/realtek/rtlwifi/rtl8192eeArrays RadioA and RadioB are filled RadioC and RadioD do not exist.
Example:drivers/net/wireless/realtek/rtlwifi/rtl8192deArrays RadioA and RadioB are filled RadioC and RadioD do not exist.In Example:
drivers/net/wireless/realtek/rtlwifi/rtl8192cuI can find a RadioB Array that is just filled with one 0 which is odd:
#defineRTL8192CURADIOB_1TARRAYLENGTH1u32 RTL8192CU_RADIOB_1TARRAY[RTL8192CURADIOB_1TARRAYLENGTH] = { 0x0, };Here it is written to a variable:
rtlphy->hwparam_tables[RADIOB_1T].length = RTL8192CURADIOB_1TARRAYLENGTH; rtlphy->hwparam_tables[RADIOB_1T].pdata = RTL8192CU_RADIOB_1TARRAY;Written to an another variable:
radiob_arraylen = rtlphy->hwparam_tables[RADIOB_1T].length; radiob_array_table = rtlphy->hwparam_tables[RADIOB_1T].pdata;
Quoted 8 lines
And then accessed after with i + 1 the element that is random/undefined.
case RF90_PATH_B: for (i = 0; i < radiob_arraylen; i = i + 2) { rtl_rfreg_delay(hw, rfpath, radiob_array_table[i], RFREG_OFFSET_MASK, radiob_array_table[i + 1]);
You make a really compelling argument that the code in rtl8192cu should be deleted, but that's a different driver from what we're discussing here.
Quoted 6 lines
}May be another patch.
I hope this can convince you that Arrays for RadioX that do only contain one or two 0 are not in use.
I can easily be convinced of that, but that's not what the commit message says. The commit message says the array is "empty" and that you are deleting "dead code". When actually you're deleting a call to rtl92e_set_rf_reg(). So the commit message is just wrong about the facts.
What you need to do is figure out what the call to rtl92e_set_rf_reg() does and why it's not required.
I don't have a problem with this *patch* but the commit message says things which are false.
regards,
dan carpenter