diff options
author | Manuel Schölling <manuel.schoelling@gmx.de> | 2014-05-25 15:05:24 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-05-25 11:14:10 -0700 |
commit | e017a92b2e768c13503765e1eabfa566bf791807 (patch) | |
tree | e1d0eb2202e8e8857a1e4c972fd4460136a3a857 /drivers/staging/rtl8188eu/core/rtw_pwrctrl.c | |
parent | 83991567b15ac0fac45f515dbc128a792d83e562 (diff) |
staging: rtl8188eu: use time_before/time_after and change type of ips_deny_time
To be future-proof and for better readability the time comparisons are
modified to use time_before/_after() instead of plain, error-prone math.
To suppress compiler warnings the type of ips_deny_time was changed.
Signed-off-by: Manuel Schölling <manuel.schoelling@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/rtl8188eu/core/rtw_pwrctrl.c')
-rw-r--r-- | drivers/staging/rtl8188eu/core/rtw_pwrctrl.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c b/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c index f6583734aefa..eaf26304143c 100644 --- a/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c +++ b/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c @@ -122,7 +122,7 @@ static bool rtw_pwr_unassociated_idle(struct adapter *adapter) bool ret = false; - if (adapter->pwrctrlpriv.ips_deny_time >= jiffies) + if (time_after_eq(adapter->pwrctrlpriv.ips_deny_time, jiffies)) goto exit; if (check_fwstate(pmlmepriv, WIFI_ASOC_STATE|WIFI_SITE_MONITOR) || @@ -523,9 +523,11 @@ int _rtw_pwr_wakeup(struct adapter *padapter, u32 ips_deffer_ms, const char *cal { struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + unsigned long expires; int ret = _SUCCESS; - if (pwrpriv->ips_deny_time < jiffies + rtw_ms_to_systime(ips_deffer_ms)) + expires = jiffies + rtw_ms_to_systime(ips_deffer_ms); + if (time_before(pwrpriv->ips_deny_time, expires)) pwrpriv->ips_deny_time = jiffies + rtw_ms_to_systime(ips_deffer_ms); { @@ -580,7 +582,8 @@ int _rtw_pwr_wakeup(struct adapter *padapter, u32 ips_deffer_ms, const char *cal } exit: - if (pwrpriv->ips_deny_time < jiffies + rtw_ms_to_systime(ips_deffer_ms)) + expires = jiffies + rtw_ms_to_systime(ips_deffer_ms); + if (time_before(pwrpriv->ips_deny_time, expires)) pwrpriv->ips_deny_time = jiffies + rtw_ms_to_systime(ips_deffer_ms); return ret; } |