Skip to content

Commit

Permalink
ath5k: Disable interrupts in ath5k_hw_get_tsf64
Browse files Browse the repository at this point in the history
The code in ath5k_hw_get_tsf64() is time critical and will return wrong results
if we get interrupted, so disable local interrupts.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Bruno Randolf authored and John W. Linville committed Sep 28, 2010
1 parent 11f21df commit 28df897
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/net/wireless/ath/ath5k/pcu.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,10 @@ u64 ath5k_hw_get_tsf64(struct ath5k_hw *ah)
{
u32 tsf_lower, tsf_upper1, tsf_upper2;
int i;
unsigned long flags;

/* This code is time critical - we don't want to be interrupted here */
local_irq_save(flags);

/*
* While reading TSF upper and then lower part, the clock is still
Expand All @@ -517,6 +521,8 @@ u64 ath5k_hw_get_tsf64(struct ath5k_hw *ah)
tsf_upper1 = tsf_upper2;
}

local_irq_restore(flags);

WARN_ON( i == ATH5K_MAX_TSF_READ );

return (((u64)tsf_upper1 << 32) | tsf_lower);
Expand Down

0 comments on commit 28df897

Please sign in to comment.