aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/r8188eu/core/rtw_pwrctrl.c
diff options
context:
space:
mode:
authorMartin Kaiser <martin@kaiser.cx>2022-04-13 21:36:52 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-04-14 09:06:59 +0200
commit1dd0ac70494c1d04073de2dd5b51a60215f4d760 (patch)
tree22beb709fc59aa53a1ed6086c677341b154d3ec5 /drivers/staging/r8188eu/core/rtw_pwrctrl.c
parentstaging: r8188eu: use kernel functions for timeout handling (diff)
downloadlinux-dev-1dd0ac70494c1d04073de2dd5b51a60215f4d760.tar.xz
linux-dev-1dd0ac70494c1d04073de2dd5b51a60215f4d760.zip
staging: r8188eu: clean up the code to set ips_deny_time
Clean up the code in rtw_pwr_wakeup that sets pwrpriv->ips_deny_time. Make ips_deny_time an unsigned long, this type is used by the kernel functions that process jiffies. Remove the temporary variable ips_deffer_ms and use RTW_PWR_STATE_CHK_INTERVAL directly. There's no need to set ips_deny_time twice, it's sufficient to set it at the end of rtw_pwr_wakeup. Use time_before to check if ips_deny_time should be updated. We can now remove rtw_ms_to_systime, this function is not used any more. Signed-off-by: Martin Kaiser <martin@kaiser.cx> Link: https://lore.kernel.org/r/20220413193654.258507-7-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/r8188eu/core/rtw_pwrctrl.c')
-rw-r--r--drivers/staging/r8188eu/core/rtw_pwrctrl.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/drivers/staging/r8188eu/core/rtw_pwrctrl.c b/drivers/staging/r8188eu/core/rtw_pwrctrl.c
index 2ad6105e6ec4..605210d89f32 100644
--- a/drivers/staging/r8188eu/core/rtw_pwrctrl.c
+++ b/drivers/staging/r8188eu/core/rtw_pwrctrl.c
@@ -373,14 +373,8 @@ int rtw_pwr_wakeup(struct adapter *padapter)
struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
unsigned long timeout = jiffies + msecs_to_jiffies(3000);
+ unsigned long deny_time;
int ret = _SUCCESS;
- u32 ips_deffer_ms;
-
- /* the ms will prevent from falling into IPS after wakeup */
- ips_deffer_ms = RTW_PWR_STATE_CHK_INTERVAL;
-
- if (pwrpriv->ips_deny_time < jiffies + rtw_ms_to_systime(ips_deffer_ms))
- pwrpriv->ips_deny_time = jiffies + rtw_ms_to_systime(ips_deffer_ms);
while (pwrpriv->ps_processing && time_before(jiffies, timeout))
msleep(10);
@@ -406,8 +400,9 @@ int rtw_pwr_wakeup(struct adapter *padapter)
}
exit:
- if (pwrpriv->ips_deny_time < jiffies + rtw_ms_to_systime(ips_deffer_ms))
- pwrpriv->ips_deny_time = jiffies + rtw_ms_to_systime(ips_deffer_ms);
+ deny_time = jiffies + msecs_to_jiffies(RTW_PWR_STATE_CHK_INTERVAL);
+ if (time_before(pwrpriv->ips_deny_time, deny_time))
+ pwrpriv->ips_deny_time = deny_time;
return ret;
}