Skip to content

Commit

Permalink
iwlwifi: correct math in elapsed_jiffies
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Eric Sandeen authored and David S. Miller committed Feb 1, 2008
1 parent 303d9bf commit 9e7d1a4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/wireless/iwlwifi/iwl-helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9e7d1a4

Please sign in to comment.