linux-staging.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: r8188eu: replace one element 2D array by 1D array
@ 2022-11-03 11:56 Deepak R Varma
  2022-11-03 13:27 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Deepak R Varma @ 2022-11-03 11:56 UTC (permalink / raw)
  To: outreachy, Larry Finger, Phillip Potter, Pavel Skripkin,
	Greg Kroah-Hartman, linux-staging, linux-kernel

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.

Suggested-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Deepak R Varma <drv@mailo.com>
---
 drivers/staging/r8188eu/hal/HalPhyRf_8188e.c | 2 +-
 drivers/staging/r8188eu/include/odm.h        | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c
index 622f95d3f2ed..c0706c5b3fd8 100644
--- a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c
+++ b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c
@@ -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;
 	}

diff --git a/drivers/staging/r8188eu/include/odm.h b/drivers/staging/r8188eu/include/odm.h
index 89b01dd614ba..0008615ba858 100644
--- a/drivers/staging/r8188eu/include/odm.h
+++ b/drivers/staging/r8188eu/include/odm.h
@@ -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




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

* Re: [PATCH] staging: r8188eu: replace one element 2D array by 1D array
  2022-11-03 11:56 [PATCH] staging: r8188eu: replace one element 2D array by 1D array Deepak R Varma
@ 2022-11-03 13:27 ` Greg Kroah-Hartman
  2022-11-03 14:28   ` Deepak R Varma
  0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2022-11-03 13:27 UTC (permalink / raw)
  To: Deepak R Varma
  Cc: outreachy, Larry Finger, Phillip Potter, Pavel Skripkin,
	linux-staging, linux-kernel

On Thu, Nov 03, 2022 at 05:26:01PM +0530, Deepak R Varma wrote:
> 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.
> 
> Suggested-by: Dan Carpenter <error27@gmail.com>
> Signed-off-by: Deepak R Varma <drv@mailo.com>
> ---
>  drivers/staging/r8188eu/hal/HalPhyRf_8188e.c | 2 +-
>  drivers/staging/r8188eu/include/odm.h        | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c
> index 622f95d3f2ed..c0706c5b3fd8 100644
> --- a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c
> +++ b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c
> @@ -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

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

* Re: [PATCH] staging: r8188eu: replace one element 2D array by 1D array
  2022-11-03 13:27 ` Greg Kroah-Hartman
@ 2022-11-03 14:28   ` Deepak R Varma
  0 siblings, 0 replies; 3+ messages in thread
From: Deepak R Varma @ 2022-11-03 14:28 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: outreachy, Larry Finger, Phillip Potter, Pavel Skripkin,
	linux-staging, linux-kernel

On Thu, Nov 03, 2022 at 10:27:12PM +0900, Greg Kroah-Hartman wrote:
> On Thu, Nov 03, 2022 at 05:26:01PM +0530, Deepak R Varma wrote:
> > 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.
> >
> > Suggested-by: Dan Carpenter <error27@gmail.com>
> > Signed-off-by: Deepak R Varma <drv@mailo.com>
> > ---
> >  drivers/staging/r8188eu/hal/HalPhyRf_8188e.c | 2 +-
> >  drivers/staging/r8188eu/include/odm.h        | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c
> > index 622f95d3f2ed..c0706c5b3fd8 100644
> > --- a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c
> > +++ b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c
> > @@ -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?

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

>
> thanks,
>
> greg k-h



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

end of thread, other threads:[~2022-11-03 14:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-03 11:56 [PATCH] staging: r8188eu: replace one element 2D array by 1D array Deepak R Varma
2022-11-03 13:27 ` Greg Kroah-Hartman
2022-11-03 14:28   ` Deepak R Varma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).