All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] staging: r8188eu: some trivial cleanups
@ 2022-01-02 17:59 Martin Kaiser
  2022-01-02 17:59 ` [PATCH 1/5] staging: r8188eu: remove unused power management defines Martin Kaiser
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Martin Kaiser @ 2022-01-02 17:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

Remove unused variables and defines in several places.

Martin Kaiser (5):
  staging: r8188eu: remove unused power management defines
  staging: r8188eu: internal autosuspend is always false
  staging: r8188eu: fix_rate is set but not used.
  staging: r8188eu: cmd_issued_cnt is set but not used
  staging: r8188eu: turbo scan is always off for r8188eu

 drivers/staging/r8188eu/core/rtw_cmd.c        |  3 ---
 drivers/staging/r8188eu/core/rtw_pwrctrl.c    |  9 +-------
 drivers/staging/r8188eu/hal/rtl8188e_dm.c     |  1 -
 drivers/staging/r8188eu/hal/rtl8188e_rf6052.c | 21 +++++++------------
 drivers/staging/r8188eu/include/drv_types.h   |  2 --
 drivers/staging/r8188eu/include/rtw_cmd.h     |  1 -
 drivers/staging/r8188eu/include/rtw_pwrctrl.h |  5 -----
 drivers/staging/r8188eu/os_dep/ioctl_linux.c  |  6 ------
 drivers/staging/r8188eu/os_dep/os_intfs.c     |  4 ----
 drivers/staging/r8188eu/os_dep/usb_intf.c     |  3 +--
 10 files changed, 9 insertions(+), 46 deletions(-)

-- 
2.30.2


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

* [PATCH 1/5] staging: r8188eu: remove unused power management defines
  2022-01-02 17:59 [PATCH 0/5] staging: r8188eu: some trivial cleanups Martin Kaiser
@ 2022-01-02 17:59 ` Martin Kaiser
  2022-01-02 17:59 ` [PATCH 2/5] staging: r8188eu: internal autosuspend is always false Martin Kaiser
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Martin Kaiser @ 2022-01-02 17:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

Remove unused defines from enum power_mgnt.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/include/rtw_pwrctrl.h | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/r8188eu/include/rtw_pwrctrl.h b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
index 849e144c90dd..40032447355d 100644
--- a/drivers/staging/r8188eu/include/rtw_pwrctrl.h
+++ b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
@@ -19,10 +19,6 @@ enum power_mgnt {
 	PS_MODE_DTIM,
 	PS_MODE_VOIP,
 	PS_MODE_UAPSD_WMM,
-	PS_MODE_UAPSD,
-	PS_MODE_IBSS,
-	PS_MODE_WWLAN,
-	PM_Radio_Off,
 	PM_Card_Disable,
 	PS_MODE_NUM
 };
-- 
2.30.2


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

* [PATCH 2/5] staging: r8188eu: internal autosuspend is always false
  2022-01-02 17:59 [PATCH 0/5] staging: r8188eu: some trivial cleanups Martin Kaiser
  2022-01-02 17:59 ` [PATCH 1/5] staging: r8188eu: remove unused power management defines Martin Kaiser
@ 2022-01-02 17:59 ` Martin Kaiser
  2022-01-02 17:59 ` [PATCH 3/5] staging: r8188eu: fix_rate is set but not used Martin Kaiser
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Martin Kaiser @ 2022-01-02 17:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

bInternalAutoSuspend is always false. Remove the variable and related
checks.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/core/rtw_pwrctrl.c    | 9 +--------
 drivers/staging/r8188eu/include/rtw_pwrctrl.h | 1 -
 drivers/staging/r8188eu/os_dep/os_intfs.c     | 4 ----
 drivers/staging/r8188eu/os_dep/usb_intf.c     | 3 +--
 4 files changed, 2 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_pwrctrl.c b/drivers/staging/r8188eu/core/rtw_pwrctrl.c
index 7fa4516af6ec..46e44aee587f 100644
--- a/drivers/staging/r8188eu/core/rtw_pwrctrl.c
+++ b/drivers/staging/r8188eu/core/rtw_pwrctrl.c
@@ -351,7 +351,6 @@ void rtw_init_pwrctrl_priv(struct adapter *padapter)
 
 	pwrctrlpriv->pwr_state_check_interval = RTW_PWR_STATE_CHK_INTERVAL;
 	pwrctrlpriv->pwr_state_check_cnts = 0;
-	pwrctrlpriv->bInternalAutoSuspend = false;
 	pwrctrlpriv->bInSuspend = false;
 	pwrctrlpriv->bkeepfwalive = false;
 
@@ -396,7 +395,7 @@ int _rtw_pwr_wakeup(struct adapter *padapter, u32 ips_deffer_ms, const char *cal
 	}
 
 	/* System suspend is not allowed to wakeup */
-	if ((!pwrpriv->bInternalAutoSuspend) && pwrpriv->bInSuspend) {
+	if (pwrpriv->bInSuspend) {
 		while (pwrpriv->bInSuspend &&
 		       (rtw_get_passing_time_ms(start) <= 3000 ||
 		       (rtw_get_passing_time_ms(start) <= 500)))
@@ -407,12 +406,6 @@ int _rtw_pwr_wakeup(struct adapter *padapter, u32 ips_deffer_ms, const char *cal
 			DBG_88E("%s wait bInSuspend done\n", __func__);
 	}
 
-	/* block??? */
-	if ((pwrpriv->bInternalAutoSuspend)  && (padapter->net_closed)) {
-		ret = _FAIL;
-		goto exit;
-	}
-
 	/* I think this should be check in IPS, LPS, autosuspend functions... */
 	if (check_fwstate(pmlmepriv, _FW_LINKED)) {
 		ret = _SUCCESS;
diff --git a/drivers/staging/r8188eu/include/rtw_pwrctrl.h b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
index 40032447355d..2d5298373d74 100644
--- a/drivers/staging/r8188eu/include/rtw_pwrctrl.h
+++ b/drivers/staging/r8188eu/include/rtw_pwrctrl.h
@@ -75,7 +75,6 @@ struct pwrctrl_priv {
 	s32		pnp_current_pwr_state;
 	u8		pnp_bstop_trx;
 
-	u8		bInternalAutoSuspend;
 	u8		bInSuspend;
 	u8		bSupportRemoteWakeup;
 	struct timer_list pwr_state_check_timer;
diff --git a/drivers/staging/r8188eu/os_dep/os_intfs.c b/drivers/staging/r8188eu/os_dep/os_intfs.c
index f81e26785d66..b65e44f97826 100644
--- a/drivers/staging/r8188eu/os_dep/os_intfs.c
+++ b/drivers/staging/r8188eu/os_dep/os_intfs.c
@@ -760,10 +760,6 @@ int netdev_close(struct net_device *pnetdev)
 	struct adapter *padapter = (struct adapter *)rtw_netdev_priv(pnetdev);
 	struct dvobj_priv *dvobj = adapter_to_dvobj(padapter);
 
-	if (padapter->pwrctrlpriv.bInternalAutoSuspend) {
-		if (padapter->pwrctrlpriv.rf_pwrstate == rf_off)
-			padapter->pwrctrlpriv.ps_flag = true;
-	}
 	padapter->net_closed = true;
 
 	if (padapter->pwrctrlpriv.rf_pwrstate == rf_on) {
diff --git a/drivers/staging/r8188eu/os_dep/usb_intf.c b/drivers/staging/r8188eu/os_dep/usb_intf.c
index 5c1faf01cb51..91792dfd3bbe 100644
--- a/drivers/staging/r8188eu/os_dep/usb_intf.c
+++ b/drivers/staging/r8188eu/os_dep/usb_intf.c
@@ -192,8 +192,7 @@ static void rtw_dev_unload(struct adapter *padapter)
 		if (padapter->intf_stop)
 			padapter->intf_stop(padapter);
 		/* s4. */
-		if (!padapter->pwrctrlpriv.bInternalAutoSuspend)
-			rtw_stop_drv_threads(padapter);
+		rtw_stop_drv_threads(padapter);
 
 		/* s5. */
 		if (!padapter->bSurpriseRemoved) {
-- 
2.30.2


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

* [PATCH 3/5] staging: r8188eu: fix_rate is set but not used.
  2022-01-02 17:59 [PATCH 0/5] staging: r8188eu: some trivial cleanups Martin Kaiser
  2022-01-02 17:59 ` [PATCH 1/5] staging: r8188eu: remove unused power management defines Martin Kaiser
  2022-01-02 17:59 ` [PATCH 2/5] staging: r8188eu: internal autosuspend is always false Martin Kaiser
@ 2022-01-02 17:59 ` Martin Kaiser
  2022-01-02 17:59 ` [PATCH 4/5] staging: r8188eu: cmd_issued_cnt " Martin Kaiser
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Martin Kaiser @ 2022-01-02 17:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

fix_rate in struct adapter is set but not used. Remove the variable and
the private ioctl code to set it.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/hal/rtl8188e_dm.c    | 1 -
 drivers/staging/r8188eu/include/drv_types.h  | 2 --
 drivers/staging/r8188eu/os_dep/ioctl_linux.c | 6 ------
 3 files changed, 9 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/rtl8188e_dm.c b/drivers/staging/r8188eu/hal/rtl8188e_dm.c
index 685431034495..bd6eb3878060 100644
--- a/drivers/staging/r8188eu/hal/rtl8188e_dm.c
+++ b/drivers/staging/r8188eu/hal/rtl8188e_dm.c
@@ -84,7 +84,6 @@ void rtl8188e_InitHalDm(struct adapter *Adapter)
 	dm_InitGPIOSetting(Adapter);
 	Update_ODM_ComInfo_88E(Adapter);
 	ODM_DMInit(dm_odm);
-	Adapter->fix_rate = 0xFF;
 }
 
 void rtl8188e_HalDmWatchDog(struct adapter *Adapter)
diff --git a/drivers/staging/r8188eu/include/drv_types.h b/drivers/staging/r8188eu/include/drv_types.h
index c586a35014d8..2dd5ebaaa921 100644
--- a/drivers/staging/r8188eu/include/drv_types.h
+++ b/drivers/staging/r8188eu/include/drv_types.h
@@ -264,8 +264,6 @@ struct adapter {
 	unsigned char			br_ip[4];
 	struct br_ext_info		ethBrExtInfo;
 
-	u8	fix_rate;
-
 	unsigned char     in_cta_test;
 };
 
diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
index 9d277151a5ee..6e9a6d4db089 100644
--- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
@@ -3978,12 +3978,6 @@ static int rtw_dbg_port(struct net_device *dev,
 			DBG_88E("turn %s the bShowGetP2PState Variable\n", (extra_arg == 1) ? "on" : "off");
 			padapter->bShowGetP2PState = extra_arg;
 			break;
-		case 0xaa:
-			if (extra_arg > 0x13)
-				extra_arg = 0xFF;
-			DBG_88E("chang data rate to :0x%02x\n", extra_arg);
-			padapter->fix_rate = extra_arg;
-			break;
 		case 0xdd:/* registers dump, 0 for mac reg, 1 for bb reg, 2 for rf reg */
 			if (extra_arg == 0)
 				mac_reg_dump(padapter);
-- 
2.30.2


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

* [PATCH 4/5] staging: r8188eu: cmd_issued_cnt is set but not used
  2022-01-02 17:59 [PATCH 0/5] staging: r8188eu: some trivial cleanups Martin Kaiser
                   ` (2 preceding siblings ...)
  2022-01-02 17:59 ` [PATCH 3/5] staging: r8188eu: fix_rate is set but not used Martin Kaiser
@ 2022-01-02 17:59 ` Martin Kaiser
  2022-01-02 17:59 ` [PATCH 5/5] staging: r8188eu: turbo scan is always off for r8188eu Martin Kaiser
  2022-01-02 18:41 ` [PATCH 0/5] staging: r8188eu: some trivial cleanups Michael Straube
  5 siblings, 0 replies; 10+ messages in thread
From: Martin Kaiser @ 2022-01-02 17:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

cmd_issued_cnt in struct cmd_priv is set but not used. It can
be removed.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/core/rtw_cmd.c    | 3 ---
 drivers/staging/r8188eu/include/rtw_cmd.h | 1 -
 2 files changed, 4 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_cmd.c b/drivers/staging/r8188eu/core/rtw_cmd.c
index 6d503eb7ff26..8bfb01c2ebb5 100644
--- a/drivers/staging/r8188eu/core/rtw_cmd.c
+++ b/drivers/staging/r8188eu/core/rtw_cmd.c
@@ -50,7 +50,6 @@ static int _rtw_init_cmd_priv(struct cmd_priv *pcmdpriv)
 
 	pcmdpriv->rsp_buf = pcmdpriv->rsp_allocated_buf  +  4 - ((size_t)(pcmdpriv->rsp_allocated_buf) & 3);
 
-	pcmdpriv->cmd_issued_cnt = 0;
 	pcmdpriv->cmd_done_cnt = 0;
 	pcmdpriv->rsp_cnt = 0;
 exit:
@@ -269,8 +268,6 @@ int rtw_cmd_thread(void *context)
 			goto post_process;
 		}
 
-		pcmdpriv->cmd_issued_cnt++;
-
 		pcmd->cmdsz = _RND4((pcmd->cmdsz));/* _RND4 */
 
 		memcpy(pcmdbuf, pcmd->parmbuf, pcmd->cmdsz);
diff --git a/drivers/staging/r8188eu/include/rtw_cmd.h b/drivers/staging/r8188eu/include/rtw_cmd.h
index 47c3c80cc24a..cf0945ae11c1 100644
--- a/drivers/staging/r8188eu/include/rtw_cmd.h
+++ b/drivers/staging/r8188eu/include/rtw_cmd.h
@@ -42,7 +42,6 @@ struct cmd_priv {
 	u8	*cmd_allocated_buf;
 	u8	*rsp_buf;	/* shall be non-paged, and 4 bytes aligned */
 	u8	*rsp_allocated_buf;
-	u32	cmd_issued_cnt;
 	u32	cmd_done_cnt;
 	u32	rsp_cnt;
 	u8 cmdthd_running;
-- 
2.30.2


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

* [PATCH 5/5] staging: r8188eu: turbo scan is always off for r8188eu
  2022-01-02 17:59 [PATCH 0/5] staging: r8188eu: some trivial cleanups Martin Kaiser
                   ` (3 preceding siblings ...)
  2022-01-02 17:59 ` [PATCH 4/5] staging: r8188eu: cmd_issued_cnt " Martin Kaiser
@ 2022-01-02 17:59 ` Martin Kaiser
  2022-01-02 21:44   ` Pavel Skripkin
  2022-01-02 18:41 ` [PATCH 0/5] staging: r8188eu: some trivial cleanups Michael Straube
  5 siblings, 1 reply; 10+ messages in thread
From: Martin Kaiser @ 2022-01-02 17:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

Turbo scan is always disabled. Remove the TurboScanOff variable and
related checks.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/hal/rtl8188e_rf6052.c | 21 +++++++------------
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c b/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c
index 0b982cc7c86f..6e0231099986 100644
--- a/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c
+++ b/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c
@@ -87,28 +87,21 @@ rtl8188e_PHY_RF6052SetCckTxPower(
 	struct hal_data_8188e *pHalData = &Adapter->haldata;
 	struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv;
 	u32 TxAGC[2] = {0, 0}, tmpval = 0, pwrtrac_value;
-	bool TurboScanOff = false;
 	u8 idx1, idx2;
 	u8 *ptr;
 	u8 direction;
-	/* FOR CE ,must disable turbo scan */
-	TurboScanOff = true;
 
 	if (pmlmeext->sitesurvey_res.state == SCAN_PROCESS) {
 		TxAGC[RF_PATH_A] = 0x3f3f3f3f;
 		TxAGC[RF_PATH_B] = 0x3f3f3f3f;
 
-		TurboScanOff = true;/* disable turbo scan */
-
-		if (TurboScanOff) {
-			for (idx1 = RF_PATH_A; idx1 <= RF_PATH_B; idx1++) {
-				TxAGC[idx1] =
-					pPowerlevel[idx1] | (pPowerlevel[idx1] << 8) |
-					(pPowerlevel[idx1] << 16) | (pPowerlevel[idx1] << 24);
-				/*  2010/10/18 MH For external PA module. We need to limit power index to be less than 0x20. */
-				if (TxAGC[idx1] > 0x20 && pHalData->ExternalPA)
-					TxAGC[idx1] = 0x20;
-			}
+		for (idx1 = RF_PATH_A; idx1 <= RF_PATH_B; idx1++) {
+			TxAGC[idx1] =
+				pPowerlevel[idx1] | (pPowerlevel[idx1] << 8) |
+				(pPowerlevel[idx1] << 16) | (pPowerlevel[idx1] << 24);
+			/*  2010/10/18 MH For external PA module. We need to limit power index to be less than 0x20. */
+			if (TxAGC[idx1] > 0x20 && pHalData->ExternalPA)
+				TxAGC[idx1] = 0x20;
 		}
 	} else {
 		for (idx1 = RF_PATH_A; idx1 <= RF_PATH_B; idx1++) {
-- 
2.30.2


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

* Re: [PATCH 0/5] staging: r8188eu: some trivial cleanups
  2022-01-02 17:59 [PATCH 0/5] staging: r8188eu: some trivial cleanups Martin Kaiser
                   ` (4 preceding siblings ...)
  2022-01-02 17:59 ` [PATCH 5/5] staging: r8188eu: turbo scan is always off for r8188eu Martin Kaiser
@ 2022-01-02 18:41 ` Michael Straube
  5 siblings, 0 replies; 10+ messages in thread
From: Michael Straube @ 2022-01-02 18:41 UTC (permalink / raw)
  To: Martin Kaiser, Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, linux-staging, linux-kernel

On 1/2/22 18:59, Martin Kaiser wrote:
> Remove unused variables and defines in several places.
> 
> Martin Kaiser (5):
>    staging: r8188eu: remove unused power management defines
>    staging: r8188eu: internal autosuspend is always false
>    staging: r8188eu: fix_rate is set but not used.
>    staging: r8188eu: cmd_issued_cnt is set but not used
>    staging: r8188eu: turbo scan is always off for r8188eu
> 
>   drivers/staging/r8188eu/core/rtw_cmd.c        |  3 ---
>   drivers/staging/r8188eu/core/rtw_pwrctrl.c    |  9 +-------
>   drivers/staging/r8188eu/hal/rtl8188e_dm.c     |  1 -
>   drivers/staging/r8188eu/hal/rtl8188e_rf6052.c | 21 +++++++------------
>   drivers/staging/r8188eu/include/drv_types.h   |  2 --
>   drivers/staging/r8188eu/include/rtw_cmd.h     |  1 -
>   drivers/staging/r8188eu/include/rtw_pwrctrl.h |  5 -----
>   drivers/staging/r8188eu/os_dep/ioctl_linux.c  |  6 ------
>   drivers/staging/r8188eu/os_dep/os_intfs.c     |  4 ----
>   drivers/staging/r8188eu/os_dep/usb_intf.c     |  3 +--
>   10 files changed, 9 insertions(+), 46 deletions(-)
> 

Looks good to me. For all patches:

Acked-by: Michael Straube <straube.linux@gmail.com>

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

* Re: [PATCH 5/5] staging: r8188eu: turbo scan is always off for r8188eu
  2022-01-02 17:59 ` [PATCH 5/5] staging: r8188eu: turbo scan is always off for r8188eu Martin Kaiser
@ 2022-01-02 21:44   ` Pavel Skripkin
  2022-01-04 20:51     ` Martin Kaiser
  0 siblings, 1 reply; 10+ messages in thread
From: Pavel Skripkin @ 2022-01-02 21:44 UTC (permalink / raw)
  To: Martin Kaiser, Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel

On 1/2/22 20:59, Martin Kaiser wrote:
> Turbo scan is always disabled. Remove the TurboScanOff variable and
> related checks.
> 
> Signed-off-by: Martin Kaiser <martin@kaiser.cx>
> ---
>   drivers/staging/r8188eu/hal/rtl8188e_rf6052.c | 21 +++++++------------
>   1 file changed, 7 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c b/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c
> index 0b982cc7c86f..6e0231099986 100644
> --- a/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c
> +++ b/drivers/staging/r8188eu/hal/rtl8188e_rf6052.c
> @@ -87,28 +87,21 @@ rtl8188e_PHY_RF6052SetCckTxPower(
>   	struct hal_data_8188e *pHalData = &Adapter->haldata;
>   	struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv;
>   	u32 TxAGC[2] = {0, 0}, tmpval = 0, pwrtrac_value;
> -	bool TurboScanOff = false;
>   	u8 idx1, idx2;
>   	u8 *ptr;
>   	u8 direction;
> -	/* FOR CE ,must disable turbo scan */
> -	TurboScanOff = true;
>   
>   	if (pmlmeext->sitesurvey_res.state == SCAN_PROCESS) {
>   		TxAGC[RF_PATH_A] = 0x3f3f3f3f;
>   		TxAGC[RF_PATH_B] = 0x3f3f3f3f;
>   
> -		TurboScanOff = true;/* disable turbo scan */
> -
> -		if (TurboScanOff) {
> -			for (idx1 = RF_PATH_A; idx1 <= RF_PATH_B; idx1++) {
> -				TxAGC[idx1] =
> -					pPowerlevel[idx1] | (pPowerlevel[idx1] << 8) |
> -					(pPowerlevel[idx1] << 16) | (pPowerlevel[idx1] << 24);
> -				/*  2010/10/18 MH For external PA module. We need to limit power index to be less than 0x20. */
> -				if (TxAGC[idx1] > 0x20 && pHalData->ExternalPA)
> -					TxAGC[idx1] = 0x20;
> -			}
> +		for (idx1 = RF_PATH_A; idx1 <= RF_PATH_B; idx1++) {
> +			TxAGC[idx1] =
> +				pPowerlevel[idx1] | (pPowerlevel[idx1] << 8) |
> +				(pPowerlevel[idx1] << 16) | (pPowerlevel[idx1] << 24);
> +			/*  2010/10/18 MH For external PA module. We need to limit power index to be less than 0x20. */
> +			if (TxAGC[idx1] > 0x20 && pHalData->ExternalPA)
> +				TxAGC[idx1] = 0x20;
>   		}
>   	} else {
>   		for (idx1 = RF_PATH_A; idx1 <= RF_PATH_B; idx1++) {

Hi Martin,

thanks for your clean up work!


It's a bit unrelated to the patch, but I found it while reviewing this. 
It's in the same function rtl8188e_PHY_RF6052SetCckTxPower():

89: 	u32 TxAGC[2] = {0, 0};
...
92	u8 *ptr;
...
129	for (idx1 = RF_PATH_A; idx1 <= RF_PATH_B; idx1++) {
130		ptr = (u8 *)(&TxAGC[idx1]);
131		for (idx2 = 0; idx2 < 4; idx2++) {
132			if (*ptr > RF6052_MAX_TX_PWR)
133				*ptr = RF6052_MAX_TX_PWR;
134			ptr++;
135		}
136	}


What is going on here? Code just checks and writes to random place on 
stack outside TxAGC array? I might be missing something, but it looks 
wrong...

Just wanted to share, since I believe your knowledge about this driver 
is much deeper than mine :)

thanks


With regards,
Pavel Skripkin

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

* Re: [PATCH 5/5] staging: r8188eu: turbo scan is always off for r8188eu
  2022-01-02 21:44   ` Pavel Skripkin
@ 2022-01-04 20:51     ` Martin Kaiser
  2022-01-04 20:52       ` Pavel Skripkin
  0 siblings, 1 reply; 10+ messages in thread
From: Martin Kaiser @ 2022-01-04 20:51 UTC (permalink / raw)
  To: Pavel Skripkin
  Cc: Greg Kroah-Hartman, Larry Finger, Phillip Potter,
	Michael Straube, linux-staging, linux-kernel

Hi Pavel,

Thus wrote Pavel Skripkin (paskripkin@gmail.com):

> It's a bit unrelated to the patch, but I found it while reviewing this. It's
> in the same function rtl8188e_PHY_RF6052SetCckTxPower():

> 89: 	u32 TxAGC[2] = {0, 0};
> ...
> 92	u8 *ptr;
> ...
> 129	for (idx1 = RF_PATH_A; idx1 <= RF_PATH_B; idx1++) {
> 130		ptr = (u8 *)(&TxAGC[idx1]);
> 131		for (idx2 = 0; idx2 < 4; idx2++) {
> 132			if (*ptr > RF6052_MAX_TX_PWR)
> 133				*ptr = RF6052_MAX_TX_PWR;
> 134			ptr++;
> 135		}
> 136	}


> What is going on here? Code just checks and writes to random place on stack
> outside TxAGC array? I might be missing something, but it looks wrong...

TxAGC is two 32-bit values, i.e. 2 x 4 Bytes. The outer loop selects a
32-bit array entry, the inner loop iterates over each byte of this entry
and checks that it is <= RF6052_MAX_TX_PWR. I don't think this writes past
the end of the TxAGC[] array.

The rtlwifi driver contains a similar check in
rtl92ce_phy_rf6052_set_cck_txpower().

Best regards,
Martin

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

* Re: [PATCH 5/5] staging: r8188eu: turbo scan is always off for r8188eu
  2022-01-04 20:51     ` Martin Kaiser
@ 2022-01-04 20:52       ` Pavel Skripkin
  0 siblings, 0 replies; 10+ messages in thread
From: Pavel Skripkin @ 2022-01-04 20:52 UTC (permalink / raw)
  To: Martin Kaiser
  Cc: Greg Kroah-Hartman, Larry Finger, Phillip Potter,
	Michael Straube, linux-staging, linux-kernel

On 1/4/22 23:51, Martin Kaiser wrote:
> Hi Pavel,
> 
> Thus wrote Pavel Skripkin (paskripkin@gmail.com):
> 
>> It's a bit unrelated to the patch, but I found it while reviewing this. It's
>> in the same function rtl8188e_PHY_RF6052SetCckTxPower():
> 
>> 89: 	u32 TxAGC[2] = {0, 0};
>> ...
>> 92	u8 *ptr;
>> ...
>> 129	for (idx1 = RF_PATH_A; idx1 <= RF_PATH_B; idx1++) {
>> 130		ptr = (u8 *)(&TxAGC[idx1]);
>> 131		for (idx2 = 0; idx2 < 4; idx2++) {
>> 132			if (*ptr > RF6052_MAX_TX_PWR)
>> 133				*ptr = RF6052_MAX_TX_PWR;
>> 134			ptr++;
>> 135		}
>> 136	}
> 
> 
>> What is going on here? Code just checks and writes to random place on stack
>> outside TxAGC array? I might be missing something, but it looks wrong...
> 
> TxAGC is two 32-bit values, i.e. 2 x 4 Bytes. The outer loop selects a
> 32-bit array entry, the inner loop iterates over each byte of this entry
> and checks that it is <= RF6052_MAX_TX_PWR. I don't think this writes past
> the end of the TxAGC[] array.
> 

Oh.... I should have go to sleep earlier that evening, sorry. I've 
missed, that this array is u32, but not u8.

Sorry for that noise :(




With regards,
Pavel Skripkin

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

end of thread, other threads:[~2022-01-04 20:52 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-02 17:59 [PATCH 0/5] staging: r8188eu: some trivial cleanups Martin Kaiser
2022-01-02 17:59 ` [PATCH 1/5] staging: r8188eu: remove unused power management defines Martin Kaiser
2022-01-02 17:59 ` [PATCH 2/5] staging: r8188eu: internal autosuspend is always false Martin Kaiser
2022-01-02 17:59 ` [PATCH 3/5] staging: r8188eu: fix_rate is set but not used Martin Kaiser
2022-01-02 17:59 ` [PATCH 4/5] staging: r8188eu: cmd_issued_cnt " Martin Kaiser
2022-01-02 17:59 ` [PATCH 5/5] staging: r8188eu: turbo scan is always off for r8188eu Martin Kaiser
2022-01-02 21:44   ` Pavel Skripkin
2022-01-04 20:51     ` Martin Kaiser
2022-01-04 20:52       ` Pavel Skripkin
2022-01-02 18:41 ` [PATCH 0/5] staging: r8188eu: some trivial cleanups Michael Straube

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.