Skip to content

Commit

Permalink
uwb: use time_after() when purging stale beacons
Browse files Browse the repository at this point in the history
Signed-off-by: David Vrabel <david.vrabel@csr.com>
  • Loading branch information
David Vrabel committed Oct 15, 2008
1 parent 99ee3a6 commit 45c16cd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/uwb/beacon.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,12 @@ struct uwb_beca_e *__uwb_beca_add(struct uwb_rc_evt_beacon *be,
void uwb_beca_purge(void)
{
struct uwb_beca_e *bce, *next;
unsigned long now = jiffies;
unsigned long expires;

mutex_lock(&uwb_beca.mutex);
list_for_each_entry_safe(bce, next, &uwb_beca.list, node) {
if (now - bce->ts_jiffies
> msecs_to_jiffies(beacon_timeout_ms)) {
expires = bce->ts_jiffies + msecs_to_jiffies(beacon_timeout_ms);
if (time_after(jiffies, expires)) {
uwbd_dev_offair(bce);
list_del(&bce->node);
uwb_bce_put(bce);
Expand Down

0 comments on commit 45c16cd

Please sign in to comment.