diff options
Diffstat (limited to 'drivers/staging/rtl8192e/rtl8192e/rtl_ps.c')
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/rtl_ps.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c index 0bbffec0c2ae..404cb83153d9 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c @@ -28,6 +28,7 @@ #include "r8192E_phyreg.h" #include "r8190P_rtl8256.h" /* RTL8225 Radio frontend */ #include "r8192E_cmdpkt.h" +#include <linux/jiffies.h> static void rtl8192_hw_sleep_down(struct net_device *dev) { @@ -93,19 +94,21 @@ void rtl8192_hw_to_sleep(struct net_device *dev, u64 time) u32 tmp; unsigned long flags; + unsigned long timeout; spin_lock_irqsave(&priv->ps_lock, flags); time -= msecs_to_jiffies(8 + 16 + 7); - if ((time - jiffies) <= msecs_to_jiffies(MIN_SLEEP_TIME)) { + timeout = jiffies + msecs_to_jiffies(MIN_SLEEP_TIME); + if (time_before((unsigned long)time, timeout)) { spin_unlock_irqrestore(&priv->ps_lock, flags); netdev_info(dev, "too short to sleep::%lld < %ld\n", time - jiffies, msecs_to_jiffies(MIN_SLEEP_TIME)); return; } - - if ((time - jiffies) > msecs_to_jiffies(MAX_SLEEP_TIME)) { + timeout = jiffies + msecs_to_jiffies(MAX_SLEEP_TIME); + if (time_after((unsigned long)time, timeout)) { netdev_info(dev, "========>too long to sleep:%lld > %ld\n", time - jiffies, msecs_to_jiffies(MAX_SLEEP_TIME)); spin_unlock_irqrestore(&priv->ps_lock, flags); @@ -199,8 +202,8 @@ void rtllib_ips_leave_wq(struct net_device *dev) if (priv->rtllib->PowerSaveControl.bInactivePs) { if (rtState == eRfOff) { if (priv->rtllib->RfOffReason > RF_CHANGE_BY_IPS) { - RT_TRACE(COMP_ERR, "%s(): RF is OFF.\n", - __func__); + netdev_warn(dev, "%s(): RF is OFF.\n", + __func__); return; } netdev_info(dev, "=========>%s(): IPSLeave\n", |