[PATCHv2]staging: rtl8192e: use time_before() macro

Gujulan Elango, Hari Prasath (H.) hgujulan at visteon.com
Fri May 8 11:04:43 UTC 2015


This patch replaces the condition check for time elapsed with a
simplified time_before() macro

Signed-off-by: Hari Prasath Gujulan Elango <hgujulan at visteon.com>
---
	v2:Fixes a build warning.time_before() macro requires both of
its arguments to be unsigned long.Build warning was missed & later
reported by the kbuild test robot.Previous version of this patch was
sent with a wrong subject line i.e it was showing rtl8712e instead of
the rtl8192e.
---
 drivers/staging/rtl8192e/rtl8192e/rtl_ps.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c
index 840dda9..386ae0c 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c
@@ -100,7 +100,8 @@ void rtl8192_hw_to_sleep(struct net_device *dev, u64 time)
 
 	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));
-- 
1.9.1


More information about the devel mailing list