From: Eric Sandeen Date: Thu, 24 Jan 2008 20:47:39 +0000 (-0500) Subject: iwlwifi: correct math in elapsed_jiffies X-Git-Tag: v2.6.25-rc1~1089^2~155 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=9e7d1a445ed0d5c1d8863945d6c4c6f018a4aa83;p=karo-tx-linux.git 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 Signed-off-by: David S. Miller --- diff --git a/drivers/net/wireless/iwlwifi/iwl-helpers.h b/drivers/net/wireless/iwlwifi/iwl-helpers.h index cd2eb1848310..cb009f4c401f 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)