Move the functionality of the HW_VAR_FWLPS_RF_ON case in GetHwReg8188EU() to a static function in rtw_pwrctrl.c and remove the HW_VAR_FWLPS_RF_ON case from GetHwReg8188EU(). 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_pwrctrl.c | 19 ++++++++++++++++--- drivers/staging/r8188eu/hal/usb_halinit.c | 18 ------------------ drivers/staging/r8188eu/include/hal_intf.h | 1 - 3 files changed, 16 insertions(+), 22 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_pwrctrl.c b/drivers/staging/r8188eu/core/rtw_pwrctrl.c index 7beabf82eb92..0141de7ab08c 100644 --- a/drivers/staging/r8188eu/core/rtw_pwrctrl.c +++ b/drivers/staging/r8188eu/core/rtw_pwrctrl.c @@ -217,6 +217,21 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_a } +static bool lps_rf_on(struct adapter *adapter) +{ + /* When we halt NIC, we should check if FW LPS is leave. */ + if (adapter->pwrctrlpriv.rf_pwrstate == rf_off) { + /* If it is in HW/SW Radio OFF or IPS state, we do not check Fw LPS Leave, */ + /* because Fw is unload. */ + return true; + } + + if (rtw_read32(adapter, REG_RCR) & 0x00070000) + return false; + + return true; +} + /* * Return: * 0: Leave OK @@ -226,13 +241,11 @@ void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_a s32 LPS_RF_ON_check(struct adapter *padapter, u32 delay_ms) { u32 start_time; - u8 bAwake = false; s32 err = 0; start_time = jiffies; while (1) { - GetHwReg8188EU(padapter, HW_VAR_FWLPS_RF_ON, &bAwake); - if (bAwake) + if (lps_rf_on(padapter)) break; if (padapter->bSurpriseRemoved) { diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c index 611785caa17f..37c56690b13a 100644 --- a/drivers/staging/r8188eu/hal/usb_halinit.c +++ b/drivers/staging/r8188eu/hal/usb_halinit.c @@ -1292,24 +1292,6 @@ void GetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val) case HW_VAR_DM_FLAG: val[0] = podmpriv->SupportAbility; break; - case HW_VAR_FWLPS_RF_ON: - { - /* When we halt NIC, we should check if FW LPS is leave. */ - if (Adapter->pwrctrlpriv.rf_pwrstate == rf_off) { - /* If it is in HW/SW Radio OFF or IPS state, we do not check Fw LPS Leave, */ - /* because Fw is unload. */ - val[0] = true; - } else { - u32 valRCR; - valRCR = rtw_read32(Adapter, REG_RCR); - valRCR &= 0x00070000; - if (valRCR) - val[0] = false; - else - val[0] = true; - } - } - break; default: break; } diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h index f0a6d697e68b..0033a0aca27b 100644 --- a/drivers/staging/r8188eu/include/hal_intf.h +++ b/drivers/staging/r8188eu/include/hal_intf.h @@ -26,7 +26,6 @@ enum hw_variables { HW_VAR_AMPDU_FACTOR, HW_VAR_H2C_FW_PWRMODE, HW_VAR_H2C_FW_JOINBSSRPT, - HW_VAR_FWLPS_RF_ON, HW_VAR_H2C_FW_P2P_PS_OFFLOAD, HW_VAR_INITIAL_GAIN, HW_VAR_ANTENNA_DIVERSITY_SELECT, -- 2.35.1