diff options
Diffstat (limited to 'drivers/staging/r8188eu/core/rtw_pwrctrl.c')
-rw-r--r-- | drivers/staging/r8188eu/core/rtw_pwrctrl.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/drivers/staging/r8188eu/core/rtw_pwrctrl.c b/drivers/staging/r8188eu/core/rtw_pwrctrl.c index 7b816b824947..10550bd2c16d 100644 --- a/drivers/staging/r8188eu/core/rtw_pwrctrl.c +++ b/drivers/staging/r8188eu/core/rtw_pwrctrl.c @@ -229,6 +229,9 @@ 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) { + int res; + u32 reg; + /* 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, */ @@ -236,7 +239,11 @@ static bool lps_rf_on(struct adapter *adapter) return true; } - if (rtw_read32(adapter, REG_RCR) & 0x00070000) + res = rtw_read32(adapter, REG_RCR, ®); + if (res) + return false; + + if (reg & 0x00070000) return false; return true; @@ -266,7 +273,7 @@ static s32 LPS_RF_ON_check(struct adapter *padapter, u32 delay_ms) err = -1; break; } - rtw_usleep_os(100); + msleep(1); } return err; @@ -374,24 +381,24 @@ int rtw_pwr_wakeup(struct adapter *padapter) struct mlme_priv *pmlmepriv = &padapter->mlmepriv; unsigned long timeout = jiffies + msecs_to_jiffies(3000); unsigned long deny_time; - int ret = _SUCCESS; + int ret; while (pwrpriv->ps_processing && time_before(jiffies, timeout)) msleep(10); /* I think this should be check in IPS, LPS, autosuspend functions... */ - if (check_fwstate(pmlmepriv, _FW_LINKED)) { - ret = _SUCCESS; + /* Below goto is a success path taken for already linked devices */ + ret = 0; + if (check_fwstate(pmlmepriv, _FW_LINKED)) goto exit; - } if (pwrpriv->rf_pwrstate == rf_off && ips_leave(padapter) == _FAIL) { - ret = _FAIL; + ret = -ENOMEM; goto exit; } if (padapter->bDriverStopped || !padapter->bup || !padapter->hw_init_completed) { - ret = _FAIL; + ret = -EBUSY; goto exit; } @@ -432,7 +439,7 @@ int rtw_pm_set_ips(struct adapter *padapter, u8 mode) return 0; } else if (mode == IPS_NONE) { rtw_ips_mode_req(pwrctrlpriv, mode); - if ((padapter->bSurpriseRemoved == 0) && (rtw_pwr_wakeup(padapter) == _FAIL)) + if ((padapter->bSurpriseRemoved == 0) && rtw_pwr_wakeup(padapter)) return -EFAULT; } else { return -EINVAL; |