Commit e017a92b authored by Manuel Schölling's avatar Manuel Schölling Committed by Greg Kroah-Hartman
Browse files

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: default avatarManuel Schölling <manuel.schoelling@gmx.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 83991567
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -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;
}
+1 −1
Original line number Diff line number Diff line
@@ -192,7 +192,7 @@ struct pwrctrl_priv {
	u8	ips_mode_req;	/*  used to accept the mode setting request,
				 *  will update to ipsmode later */
	uint bips_processing;
	u32 ips_deny_time; /* will deny IPS when system time less than this */
	unsigned long ips_deny_time; /* will deny IPS when system time less than this */
	u8 ps_processing; /* temp used to mark whether in rtw_ps_processor */

	u8	bLeisurePs;