iwlwifi: correct math in elapsed_jiffies

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Friday, February 1, 2008 - 3:59 am

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9e7d1a...
Commit:     9e7d1a445ed0d5c1d8863945d6c4c6f018a4aa83
Parent:     303d9bf6bb64ead8e3f1d7e29904a4025502e591
Author:     Eric Sandeen <sandeen@redhat.com>
AuthorDate: Thu Jan 24 15:47:39 2008 -0500
Committer:  David S. Miller <davem@davemloft.net>
CommitDate: Thu Jan 31 19:26:47 2008 -0800

    iwlwifi: correct math in elapsed_jiffies
    
    w/o the first change: if end == start you get MAX_JIFFY_OFFSET which
    isn't what you want...
    
    For the latter I think to be technically correct you need the +1 to
    account for the jiffy between MAX_JIFFY_OFFSET and 0
    
    (hmm w/ the 2nd change the first isn't strictly needed... ah well)
    
    Signed-off-by: John W. Linville <linville@tuxdriver.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
---
 drivers/net/wireless/iwlwifi/iwl-helpers.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-helpers.h b/drivers/net/wireless/iwlwifi/iwl-helpers.h
index cd2eb18..cb009f4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-helpers.h
+++ b/drivers/net/wireless/iwlwifi/iwl-helpers.h
@@ -246,10 +246,10 @@ static inline int iwl_check_bits(unsigned long field, unsigned long mask)
 static inline unsigned long elapsed_jiffies(unsigned long start,
 					    unsigned long end)
 {
-	if (end > start)
+	if (end >= start)
 		return end - start;
 
-	return end + (MAX_JIFFY_OFFSET - start);
+	return end + (MAX_JIFFY_OFFSET - start) + 1;
 }
 
 static inline u8 iwl_get_dma_hi_address(dma_addr_t addr)
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
iwlwifi: correct math in elapsed_jiffies, Linux Kernel Mailing ..., (Fri Feb 1, 3:59 am)