[PATCH v2 2/4] staging: r8188eu: remove HAL_DEF_IS_SUPPORT_ANT_DIV

From: Michael Straube
Date: Tue Apr 05 2022 - 20:20:19 EST


In order to get rid of the function GetHalDefVar8188EUsb(), remove
the HAL_DEF_IS_SUPPORT_ANT_DIV case from it and move the functionality
into a new function. This is part of the ongoing effort to get rid of
the unwanted hal layer.

Signed-off-by: Michael Straube <straube.linux@xxxxxxxxx>
---
v2:
- made the function static
- used a more obvious function name

drivers/staging/r8188eu/core/rtw_cmd.c | 11 ++++++++---
drivers/staging/r8188eu/hal/usb_halinit.c | 3 ---
drivers/staging/r8188eu/include/hal_intf.h | 1 -
3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_cmd.c b/drivers/staging/r8188eu/core/rtw_cmd.c
index 8b24330e97c1..66d4346a34ee 100644
--- a/drivers/staging/r8188eu/core/rtw_cmd.c
+++ b/drivers/staging/r8188eu/core/rtw_cmd.c
@@ -1094,16 +1094,21 @@ static void antenna_select_wk_hdl(struct adapter *padapter, u8 antenna)
}
}

+static bool rtw_antenna_diversity(struct adapter *adapter)
+{
+ struct hal_data_8188e *haldata = &adapter->haldata;
+
+ return haldata->AntDivCfg != 0;
+}
+
u8 rtw_antenna_select_cmd(struct adapter *padapter, u8 antenna, u8 enqueue)
{
struct cmd_obj *ph2c;
struct drvextra_cmd_parm *pdrvextra_cmd_parm;
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
- u8 support_ant_div;
u8 res = _SUCCESS;

- GetHalDefVar8188EUsb(padapter, HAL_DEF_IS_SUPPORT_ANT_DIV, &support_ant_div);
- if (!support_ant_div)
+ if (!rtw_antenna_diversity(padapter))
return res;

if (enqueue) {
diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c
index 4bc6b08fb282..805460bd6340 100644
--- a/drivers/staging/r8188eu/hal/usb_halinit.c
+++ b/drivers/staging/r8188eu/hal/usb_halinit.c
@@ -1204,9 +1204,6 @@ void GetHalDefVar8188EUsb(struct adapter *Adapter, enum hal_def_variable eVariab
struct hal_data_8188e *haldata = &Adapter->haldata;

switch (eVariable) {
- case HAL_DEF_IS_SUPPORT_ANT_DIV:
- *((u8 *)pValue) = (haldata->AntDivCfg == 0) ? false : true;
- break;
case HAL_DEF_CURRENT_ANTENNA:
*((u8 *)pValue) = haldata->CurAntenna;
break;
diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h
index e222ab89bfc5..6a80e517a7ad 100644
--- a/drivers/staging/r8188eu/include/hal_intf.h
+++ b/drivers/staging/r8188eu/include/hal_intf.h
@@ -28,7 +28,6 @@ enum hw_variables {
};

enum hal_def_variable {
- HAL_DEF_IS_SUPPORT_ANT_DIV,
HAL_DEF_CURRENT_ANTENNA,
HAL_DEF_DBG_DM_FUNC,/* for dbg */
};
--
2.35.1