[PATCH 4/7] staging: r8188eu: remove HW_VAR_ANTENNA_DIVERSITY_SELECT from SetHwReg8188EU()

From: Michael Straube
Date: Sat Apr 02 2022 - 05:24:18 EST


Remove the HW_VAR_ANTENNA_DIVERSITY_SELECT case from SetHwReg8188EU()
and move its functionality to rtw_cmd.c where it is actually used.
This is part of the ongoing effort to get rid of the unwanted hal
layer.

Signed-off-by: Michael Straube <straube.linux@xxxxxxxxx>
---
drivers/staging/r8188eu/core/rtw_cmd.c | 8 +++++++-
drivers/staging/r8188eu/hal/usb_halinit.c | 13 -------------
drivers/staging/r8188eu/include/hal_intf.h | 1 -
3 files changed, 7 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_cmd.c b/drivers/staging/r8188eu/core/rtw_cmd.c
index 4fda2fe07ecc..a9152db589c7 100644
--- a/drivers/staging/r8188eu/core/rtw_cmd.c
+++ b/drivers/staging/r8188eu/core/rtw_cmd.c
@@ -1086,7 +1086,13 @@ u8 rtw_rpt_timer_cfg_cmd(struct adapter *padapter, u16 min_time)

static void antenna_select_wk_hdl(struct adapter *padapter, u8 antenna)
{
- SetHwReg8188EU(padapter, HW_VAR_ANTENNA_DIVERSITY_SELECT, (u8 *)(&antenna));
+ struct hal_data_8188e *haldata = &padapter->haldata;
+
+ /* switch current antenna to optimum antenna */
+ if (haldata->CurAntenna != antenna) {
+ ODM_UpdateRxIdleAnt_88E(&haldata->odmpriv, antenna == 2 ? MAIN_ANT : AUX_ANT);
+ haldata->CurAntenna = antenna;
+ }
}

u8 rtw_antenna_select_cmd(struct adapter *padapter, u8 antenna, u8 enqueue)
diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c
index 7b231e9a2193..39db038d75fd 100644
--- a/drivers/staging/r8188eu/hal/usb_halinit.c
+++ b/drivers/staging/r8188eu/hal/usb_halinit.c
@@ -1181,19 +1181,6 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val)
ODM_RA_Set_TxRPT_Time(podmpriv, min_rpt_time);
}
break;
- case HW_VAR_ANTENNA_DIVERSITY_SELECT:
- {
- u8 Optimum_antenna = (*(u8 *)val);
- u8 Ant;
- /* switch antenna to Optimum_antenna */
- if (haldata->CurAntenna != Optimum_antenna) {
- Ant = (Optimum_antenna == 2) ? MAIN_ANT : AUX_ANT;
- ODM_UpdateRxIdleAnt_88E(&haldata->odmpriv, Ant);
-
- haldata->CurAntenna = Optimum_antenna;
- }
- }
- break;
case HW_VAR_FIFO_CLEARN_UP:
{
struct pwrctrl_priv *pwrpriv = &Adapter->pwrctrlpriv;
diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h
index c18ff1469c2b..1ba2eb0a46b2 100644
--- a/drivers/staging/r8188eu/include/hal_intf.h
+++ b/drivers/staging/r8188eu/include/hal_intf.h
@@ -25,7 +25,6 @@ enum hw_variables {
HW_VAR_H2C_FW_JOINBSSRPT,
HW_VAR_H2C_FW_P2P_PS_OFFLOAD,
HW_VAR_INITIAL_GAIN,
- HW_VAR_ANTENNA_DIVERSITY_SELECT,
HW_VAR_FIFO_CLEARN_UP,
HW_VAR_RPT_TIMER_SETTING,
HW_VAR_H2C_MEDIA_STATUS_RPT,
--
2.35.1