linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: r8188eu: remove ODM_GetRightChnlPlaceforIQK()
@ 2021-08-14  7:39 Michael Straube
  2021-08-14 10:20 ` Fabio M. De Francesco
  2021-08-14 17:21 ` Phillip Potter
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Straube @ 2021-08-14  7:39 UTC (permalink / raw)
  To: gregkh
  Cc: Larry.Finger, phil, martin, fmdefrancesco, linux-staging,
	linux-kernel, Michael Straube

Function ODM_GetRightChnlPlaceforIQK() returns always zero for
channels <= 14. The driver is for chips that do not support 5 GHz,
so remove the function and replace the usage of its return value
with zero.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
 drivers/staging/r8188eu/hal/HalPhyRf_8188e.c | 29 ++------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c
index 643a4d348b2e..c92a76aebc11 100644
--- a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c
+++ b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c
@@ -1004,27 +1004,6 @@ static void phy_IQCalibrate_8188E(struct adapter *adapt, s32 result[][8], u8 t,
 	}
 }
 
-#define ODM_TARGET_CHNL_NUM_2G_5G	59
-static u8 ODM_GetRightChnlPlaceforIQK(u8 chnl)
-{
-	u8	channel_all[ODM_TARGET_CHNL_NUM_2G_5G] = {
-		1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
-		36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64,
-		100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122,
-		124, 126, 128, 130, 132, 134, 136, 138, 140, 149, 151, 153,
-		155, 157, 159, 161, 163, 165
-	};
-	u8	place = chnl;
-
-	if (chnl > 14) {
-		for (place = 14; place < sizeof(channel_all); place++) {
-			if (channel_all[place] == chnl)
-				return place-13;
-		}
-	}
-	return 0;
-}
-
 static void phy_LCCalibrate_8188E(struct adapter *adapt, bool is2t)
 {
 	u8 tmpreg;
@@ -1088,7 +1067,7 @@ void PHY_IQCalibrate_8188E(struct adapter *adapt, bool recovery)
 	struct odm_dm_struct *dm_odm = &pHalData->odmpriv;
 	struct mpt_context *pMptCtx = &adapt->mppriv.MptCtx;
 	s32 result[4][8];	/* last is final result */
-	u8 i, final_candidate, Indexforchannel;
+	u8 i, final_candidate;
 	bool pathaok, pathbok;
 	s32 RegE94, RegE9C, RegEA4, RegEB4, RegEBC, RegEC4;
 	bool is12simular, is13simular, is23simular;
@@ -1200,14 +1179,12 @@ void PHY_IQCalibrate_8188E(struct adapter *adapt, bool recovery)
 			pathb_fill_iqk(adapt, pathbok, result, final_candidate, (RegEC4 == 0));
 	}
 
-	Indexforchannel = ODM_GetRightChnlPlaceforIQK(pHalData->CurrentChannel);
-
 /* To Fix BSOD when final_candidate is 0xff */
 /* by sherry 20120321 */
 	if (final_candidate < 4) {
 		for (i = 0; i < IQK_Matrix_REG_NUM; i++)
-			dm_odm->RFCalibrateInfo.IQKMatrixRegSetting[Indexforchannel].Value[0][i] = result[final_candidate][i];
-		dm_odm->RFCalibrateInfo.IQKMatrixRegSetting[Indexforchannel].bIQKDone = true;
+			dm_odm->RFCalibrateInfo.IQKMatrixRegSetting[0].Value[0][i] = result[final_candidate][i];
+		dm_odm->RFCalibrateInfo.IQKMatrixRegSetting[0].bIQKDone = true;
 	}
 
 	_PHY_SaveADDARegisters(adapt, IQK_BB_REG_92C, dm_odm->RFCalibrateInfo.IQK_BB_backup_recover, 9);
-- 
2.32.0


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

* Re: [PATCH] staging: r8188eu: remove ODM_GetRightChnlPlaceforIQK()
  2021-08-14  7:39 [PATCH] staging: r8188eu: remove ODM_GetRightChnlPlaceforIQK() Michael Straube
@ 2021-08-14 10:20 ` Fabio M. De Francesco
  2021-08-14 17:21 ` Phillip Potter
  1 sibling, 0 replies; 3+ messages in thread
From: Fabio M. De Francesco @ 2021-08-14 10:20 UTC (permalink / raw)
  To: gregkh, Michael Straube
  Cc: Larry.Finger, phil, martin, linux-staging, linux-kernel, Michael Straube

On Saturday, August 14, 2021 9:39:20 AM CEST Michael Straube wrote:
> Function ODM_GetRightChnlPlaceforIQK() returns always zero for
> channels <= 14. The driver is for chips that do not support 5 GHz,
> so remove the function and replace the usage of its return value
> with zero.
> 
> Signed-off-by: Michael Straube <straube.linux@gmail.com>

There appears to be some superfluous code left for the 5GHz band.
Nice removal, so ...

Acked-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>

Thanks,

Fabio




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

* Re: [PATCH] staging: r8188eu: remove ODM_GetRightChnlPlaceforIQK()
  2021-08-14  7:39 [PATCH] staging: r8188eu: remove ODM_GetRightChnlPlaceforIQK() Michael Straube
  2021-08-14 10:20 ` Fabio M. De Francesco
@ 2021-08-14 17:21 ` Phillip Potter
  1 sibling, 0 replies; 3+ messages in thread
From: Phillip Potter @ 2021-08-14 17:21 UTC (permalink / raw)
  To: Michael Straube
  Cc: Greg KH, Larry Finger, Martin Kaiser, Fabio M. De Francesco,
	linux-staging, Linux Kernel Mailing List

On Sat, 14 Aug 2021 at 08:40, Michael Straube <straube.linux@gmail.com> wrote:
>
> Function ODM_GetRightChnlPlaceforIQK() returns always zero for
> channels <= 14. The driver is for chips that do not support 5 GHz,
> so remove the function and replace the usage of its return value
> with zero.
>
> Signed-off-by: Michael Straube <straube.linux@gmail.com>
> ---
>  drivers/staging/r8188eu/hal/HalPhyRf_8188e.c | 29 ++------------------
>  1 file changed, 3 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c
> index 643a4d348b2e..c92a76aebc11 100644
> --- a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c
> +++ b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c
> @@ -1004,27 +1004,6 @@ static void phy_IQCalibrate_8188E(struct adapter *adapt, s32 result[][8], u8 t,
>         }
>  }
>
> -#define ODM_TARGET_CHNL_NUM_2G_5G      59
> -static u8 ODM_GetRightChnlPlaceforIQK(u8 chnl)
> -{
> -       u8      channel_all[ODM_TARGET_CHNL_NUM_2G_5G] = {
> -               1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
> -               36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64,
> -               100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122,
> -               124, 126, 128, 130, 132, 134, 136, 138, 140, 149, 151, 153,
> -               155, 157, 159, 161, 163, 165
> -       };
> -       u8      place = chnl;
> -
> -       if (chnl > 14) {
> -               for (place = 14; place < sizeof(channel_all); place++) {
> -                       if (channel_all[place] == chnl)
> -                               return place-13;
> -               }
> -       }
> -       return 0;
> -}
> -
>  static void phy_LCCalibrate_8188E(struct adapter *adapt, bool is2t)
>  {
>         u8 tmpreg;
> @@ -1088,7 +1067,7 @@ void PHY_IQCalibrate_8188E(struct adapter *adapt, bool recovery)
>         struct odm_dm_struct *dm_odm = &pHalData->odmpriv;
>         struct mpt_context *pMptCtx = &adapt->mppriv.MptCtx;
>         s32 result[4][8];       /* last is final result */
> -       u8 i, final_candidate, Indexforchannel;
> +       u8 i, final_candidate;
>         bool pathaok, pathbok;
>         s32 RegE94, RegE9C, RegEA4, RegEB4, RegEBC, RegEC4;
>         bool is12simular, is13simular, is23simular;
> @@ -1200,14 +1179,12 @@ void PHY_IQCalibrate_8188E(struct adapter *adapt, bool recovery)
>                         pathb_fill_iqk(adapt, pathbok, result, final_candidate, (RegEC4 == 0));
>         }
>
> -       Indexforchannel = ODM_GetRightChnlPlaceforIQK(pHalData->CurrentChannel);
> -
>  /* To Fix BSOD when final_candidate is 0xff */
>  /* by sherry 20120321 */
>         if (final_candidate < 4) {
>                 for (i = 0; i < IQK_Matrix_REG_NUM; i++)
> -                       dm_odm->RFCalibrateInfo.IQKMatrixRegSetting[Indexforchannel].Value[0][i] = result[final_candidate][i];
> -               dm_odm->RFCalibrateInfo.IQKMatrixRegSetting[Indexforchannel].bIQKDone = true;
> +                       dm_odm->RFCalibrateInfo.IQKMatrixRegSetting[0].Value[0][i] = result[final_candidate][i];
> +               dm_odm->RFCalibrateInfo.IQKMatrixRegSetting[0].bIQKDone = true;
>         }
>
>         _PHY_SaveADDARegisters(adapt, IQK_BB_REG_92C, dm_odm->RFCalibrateInfo.IQK_BB_backup_recover, 9);
> --
> 2.32.0
>

Nice work, thanks.

Acked-by: Phillip Potter <phil@philpotter.co.uk>

Regards,
Phil

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

end of thread, other threads:[~2021-08-14 17:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-14  7:39 [PATCH] staging: r8188eu: remove ODM_GetRightChnlPlaceforIQK() Michael Straube
2021-08-14 10:20 ` Fabio M. De Francesco
2021-08-14 17:21 ` Phillip Potter

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).