Skip to contentSkip to conversation

staging: r8188eu: replace one element 2D array by 1D array

PATCH In review Deepak R Varma 2 participants 3 messages Nov 3, 2022 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: r8188eu: replace one element 2D array by 1D array

A single element two dimensional array is constrained to index 0 for that element. This constraint makes it similar to a one dimensional array. Hence convert such array to a simplified one dimensional equivalent. Resultant code is simpler and easy to maintain.

---
 drivers/staging/r8188eu/hal/HalPhyRf_8188e.c | 2 +-
 drivers/staging/r8188eu/include/odm.h        | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/r8188eu/hal/HalPhyRf_8188e.c +1 -1
index 622f95d3f2ed..c0706c5b3fd8 100644
@@ -886,7 +886,7 @@ void PHY_IQCalibrate_8188E(struct adapter *adapt, bool recovery)
 /* by sherry 20120321 */
 	if (final_candidate < 4) {
 		for (i = 0; i < IQK_Matrix_REG_NUM; i++)
-			dm_odm->RFCalibrateInfo.IQKMatrixRegSetting.Value[0][i] = result[final_candidate][i];
+			dm_odm->RFCalibrateInfo.IQKMatrixRegSetting.Value[i] = result[final_candidate][i];
 		dm_odm->RFCalibrateInfo.IQKMatrixRegSetting.bIQKDone = true;
 	}
 
drivers/staging/r8188eu/include/odm.h +1 -1
index 89b01dd614ba..0008615ba858 100644
@@ -166,7 +166,7 @@ struct odm_ra_info {
 
 struct ijk_matrix_regs_set {
 	bool	bIQKDone;
-	s32	Value[1][IQK_Matrix_REG_NUM];
+	s32	Value[IQK_Matrix_REG_NUM];
 };
 
 struct odm_rf_cal {

--
2.34.1

#1 lore raw
Quoted 17 lines · Deepak R Varma

A single element two dimensional array is constrained to index 0 for that element. This constraint makes it similar to a one dimensional array. Hence convert such array to a simplified one dimensional equivalent. Resultant code is simpler and easy to maintain.

---
 drivers/staging/r8188eu/hal/HalPhyRf_8188e.c | 2 +-
 drivers/staging/r8188eu/include/odm.h        | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/r8188eu/hal/HalPhyRf_8188e.c +0 -0
index 622f95d3f2ed..c0706c5b3fd8 100644

drivers/staging/r8188eu/hal/HalPhyRf_8188e.c void PHY_IQCalibrate_8188E(struct adapter *adapt, bool recovery) · line 889

Quoted 5 lines
drivers/staging/r8188eu/hal/HalPhyRf_8188e.c +1 -1
@@ -886,7 +886,7 @@ void PHY_IQCalibrate_8188E(struct adapter *adapt, bool recovery)
 /* by sherry 20120321 */
 	if (final_candidate < 4) {
 		for (i = 0; i < IQK_Matrix_REG_NUM; i++)
-			dm_odm->RFCalibrateInfo.IQKMatrixRegSetting.Value[0][i] = result[final_candidate][i];
+			dm_odm->RFCalibrateInfo.IQKMatrixRegSetting.Value[i] = result[final_candidate][i];

Why is this field only being set and never used?

Is it even needed at all? If not, why not just remove it entirely?

thanks,

greg k-h

#2 lore raw
Quoted 26 lines · Greg Kroah-Hartman
Quoted 17 lines · Deepak R Varma

A single element two dimensional array is constrained to index 0 for that element. This constraint makes it similar to a one dimensional array. Hence convert such array to a simplified one dimensional equivalent. Resultant code is simpler and easy to maintain.

---
 drivers/staging/r8188eu/hal/HalPhyRf_8188e.c | 2 +-
 drivers/staging/r8188eu/include/odm.h        | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/r8188eu/hal/HalPhyRf_8188e.c +0 -0
index 622f95d3f2ed..c0706c5b3fd8 100644

drivers/staging/r8188eu/hal/HalPhyRf_8188e.c void PHY_IQCalibrate_8188E(struct adapter *adapt, bool recovery) · line 889

Quoted 5 lines
drivers/staging/r8188eu/hal/HalPhyRf_8188e.c +1 -1
@@ -886,7 +886,7 @@ void PHY_IQCalibrate_8188E(struct adapter *adapt, bool recovery)
 /* by sherry 20120321 */
 	if (final_candidate < 4) {
 		for (i = 0; i < IQK_Matrix_REG_NUM; i++)
-			dm_odm->RFCalibrateInfo.IQKMatrixRegSetting.Value[0][i] = result[final_candidate][i];
+			dm_odm->RFCalibrateInfo.IQKMatrixRegSetting.Value[i] = result[final_candidate][i];

Why is this field only being set and never used?

Quoted 1 line

Is it even needed at all? If not, why not just remove it entirely?

I looked through the code and indeed have not found this member being used anywhere. I will send in a revision shortly.

Thank you.
./drv

Quoted 4 lines

thanks,

greg k-h