[PATCH 3/7] staging: r8188eu: remove HW_VAR_AMPDU_MIN_SPACE from SetHwReg8188EU()

From: Michael Straube
Date: Sat Apr 02 2022 - 05:23:57 EST


Remove the HW_VAR_AMPDU_MIN_SPACE case from SetHwReg8188EU() and move
its functionality to rtw_wlan_util.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_wlan_util.c | 31 +++++++++++++++++++-
drivers/staging/r8188eu/hal/usb_halinit.c | 28 ------------------
drivers/staging/r8188eu/include/hal_intf.h | 1 -
3 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_wlan_util.c b/drivers/staging/r8188eu/core/rtw_wlan_util.c
index acc554627adc..b526715a70bc 100644
--- a/drivers/staging/r8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/r8188eu/core/rtw_wlan_util.c
@@ -760,6 +760,35 @@ void HT_info_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE)
memcpy(&pmlmeinfo->HT_info, pIE->data, pIE->Length);
}

+static void set_min_ampdu_spacing(struct adapter *adapter, u8 spacing)
+{
+ u8 sec_spacing;
+
+ if (spacing <= 7) {
+ switch (adapter->securitypriv.dot11PrivacyAlgrthm) {
+ case _NO_PRIVACY_:
+ case _AES_:
+ sec_spacing = 0;
+ break;
+ case _WEP40_:
+ case _WEP104_:
+ case _TKIP_:
+ case _TKIP_WTMIC_:
+ sec_spacing = 6;
+ break;
+ default:
+ sec_spacing = 7;
+ break;
+ }
+
+ if (spacing < sec_spacing)
+ spacing = sec_spacing;
+
+ rtw_write8(adapter, REG_AMPDU_MIN_SPACE,
+ (rtw_read8(adapter, REG_AMPDU_MIN_SPACE) & 0xf8) | spacing);
+ }
+}
+
void HTOnAssocRsp(struct adapter *padapter)
{
unsigned char max_AMPDU_len;
@@ -784,7 +813,7 @@ void HTOnAssocRsp(struct adapter *padapter)

min_MPDU_spacing = (pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c) >> 2;

- SetHwReg8188EU(padapter, HW_VAR_AMPDU_MIN_SPACE, (u8 *)(&min_MPDU_spacing));
+ set_min_ampdu_spacing(padapter, min_MPDU_spacing);

SetHwReg8188EU(padapter, HW_VAR_AMPDU_FACTOR, (u8 *)(&max_AMPDU_len));
}
diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c
index 9326a6080819..7b231e9a2193 100644
--- a/drivers/staging/r8188eu/hal/usb_halinit.c
+++ b/drivers/staging/r8188eu/hal/usb_halinit.c
@@ -1113,34 +1113,6 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val)
haldata->AcParam_BE = ((u32 *)(val))[0];
rtw_write32(Adapter, REG_EDCA_BE_PARAM, ((u32 *)(val))[0]);
break;
- case HW_VAR_AMPDU_MIN_SPACE:
- {
- u8 MinSpacingToSet;
- u8 SecMinSpace;
-
- MinSpacingToSet = *((u8 *)val);
- if (MinSpacingToSet <= 7) {
- switch (Adapter->securitypriv.dot11PrivacyAlgrthm) {
- case _NO_PRIVACY_:
- case _AES_:
- SecMinSpace = 0;
- break;
- case _WEP40_:
- case _WEP104_:
- case _TKIP_:
- case _TKIP_WTMIC_:
- SecMinSpace = 6;
- break;
- default:
- SecMinSpace = 7;
- break;
- }
- if (MinSpacingToSet < SecMinSpace)
- MinSpacingToSet = SecMinSpace;
- rtw_write8(Adapter, REG_AMPDU_MIN_SPACE, (rtw_read8(Adapter, REG_AMPDU_MIN_SPACE) & 0xf8) | MinSpacingToSet);
- }
- }
- break;
case HW_VAR_AMPDU_FACTOR:
{
u8 RegToSet_Normal[4] = {0x41, 0xa8, 0x72, 0xb9};
diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h
index c2b97fa4e372..c18ff1469c2b 100644
--- a/drivers/staging/r8188eu/include/hal_intf.h
+++ b/drivers/staging/r8188eu/include/hal_intf.h
@@ -20,7 +20,6 @@ enum hw_variables {
HW_VAR_DM_FUNC_RESET,
HW_VAR_DM_FUNC_CLR,
HW_VAR_AC_PARAM_BE,
- HW_VAR_AMPDU_MIN_SPACE,
HW_VAR_AMPDU_FACTOR,
HW_VAR_H2C_FW_PWRMODE,
HW_VAR_H2C_FW_JOINBSSRPT,
--
2.35.1