Skip to contentSkip to conversation

staging: r8188eu: Remove variables and simplify PHY_SwChnl8188E()

PATCH In review Fabio M. De Francesco 2 participants 2 messages Aug 13, 2021 – Aug 14, 2021 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: r8188eu: Remove variables and simplify PHY_SwChnl8188E()

Remove "bResult" and "tmpchannel" and all tests and assignments that are related to them in the code of PHY_SwChnl8188E().

"bResult" was always true, therefore its test led to a null statement. "tmpchannel" was used only to restore "pHalData->CurrentChannel" to its previous value only if _PHY_SwChnl8192C() was not called; therefore assign "channel" to "pHalData->CurrentChannel" if and only if _PHY_SwChnl8192C() is to be executed (and get rid of that temporary storage).

---
 drivers/staging/r8188eu/hal/rtl8188e_phycfg.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/staging/r8188eu/hal/rtl8188e_phycfg.c +1 -12
index 02955b8c4005..9af91ec92d36 100644
@@ -1091,8 +1091,6 @@ void PHY_SwChnl8188E(struct adapter *Adapter, u8 channel)
 {
 	/*  Call after initialization */
 	struct hal_data_8188e	*pHalData = GET_HAL_DATA(Adapter);
-	u8 tmpchannel = pHalData->CurrentChannel;
-	bool  bResult = true;
 
 	if (pHalData->rf_chip == RF_PSEUDO_11N)
 		return;		/* return immediately if it is peudo-phy */
@@ -1100,17 +1098,8 @@ void PHY_SwChnl8188E(struct adapter *Adapter, u8 channel)
 	if (channel == 0)
 		channel = 1;
 
-	pHalData->CurrentChannel = channel;
-
 	if ((!Adapter->bDriverStopped) && (!Adapter->bSurpriseRemoved)) {
+		pHalData->CurrentChannel = channel;
 		_PHY_SwChnl8192C(Adapter, channel);
-
-		if (bResult)
-			;
-		else
-			pHalData->CurrentChannel = tmpchannel;
-
-	} else {
-		pHalData->CurrentChannel = tmpchannel;
 	}
 }
Signature · 1 line
2.32.0
Acked-by on v1 1/1
#1 lore raw
Quoted 49 lines · Fabio M. De Francesco

Remove "bResult" and "tmpchannel" and all tests and assignments that are related to them in the code of PHY_SwChnl8188E().

"bResult" was always true, therefore its test led to a null statement. "tmpchannel" was used only to restore "pHalData->CurrentChannel" to its previous value only if _PHY_SwChnl8192C() was not called; therefore assign "channel" to "pHalData->CurrentChannel" if and only if _PHY_SwChnl8192C() is to be executed (and get rid of that temporary storage).

---
 drivers/staging/r8188eu/hal/rtl8188e_phycfg.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/staging/r8188eu/hal/rtl8188e_phycfg.c +1 -13
index 02955b8c4005..9af91ec92d36 100644
@@ -1091,8 +1091,6 @@ void PHY_SwChnl8188E(struct adapter *Adapter, u8 channel)
 {
        /*  Call after initialization */
        struct hal_data_8188e   *pHalData = GET_HAL_DATA(Adapter);
-       u8 tmpchannel = pHalData->CurrentChannel;
-       bool  bResult = true;
 
        if (pHalData->rf_chip == RF_PSEUDO_11N)
                return;         /* return immediately if it is peudo-phy */
@@ -1100,17 +1098,8 @@ void PHY_SwChnl8188E(struct adapter *Adapter, u8 channel)
        if (channel == 0)
                channel = 1;
 
-       pHalData->CurrentChannel = channel;
-
        if ((!Adapter->bDriverStopped) && (!Adapter->bSurpriseRemoved)) {
+               pHalData->CurrentChannel = channel;
                _PHY_SwChnl8192C(Adapter, channel);
-
-               if (bResult)
-                       ;
-               else
-                       pHalData->CurrentChannel = tmpchannel;
-
-       } else {
-               pHalData->CurrentChannel = tmpchannel;
        }
 }
--
Quoted 2 lines

2.32.0

Dear Fabio,

Good stuff, thanks.

Regards,
Phil