Commit 45c16cd9 authored by David Vrabel's avatar David Vrabel

uwb: use time_after() when purging stale beacons

Signed-off-by: default avatarDavid Vrabel <david.vrabel@csr.com>
parent 99ee3a6d
...@@ -298,11 +298,12 @@ struct uwb_beca_e *__uwb_beca_add(struct uwb_rc_evt_beacon *be, ...@@ -298,11 +298,12 @@ struct uwb_beca_e *__uwb_beca_add(struct uwb_rc_evt_beacon *be,
void uwb_beca_purge(void) void uwb_beca_purge(void)
{ {
struct uwb_beca_e *bce, *next; struct uwb_beca_e *bce, *next;
unsigned long now = jiffies; unsigned long expires;
mutex_lock(&uwb_beca.mutex); mutex_lock(&uwb_beca.mutex);
list_for_each_entry_safe(bce, next, &uwb_beca.list, node) { list_for_each_entry_safe(bce, next, &uwb_beca.list, node) {
if (now - bce->ts_jiffies expires = bce->ts_jiffies + msecs_to_jiffies(beacon_timeout_ms);
> msecs_to_jiffies(beacon_timeout_ms)) { if (time_after(jiffies, expires)) {
uwbd_dev_offair(bce); uwbd_dev_offair(bce);
list_del(&bce->node); list_del(&bce->node);
uwb_bce_put(bce); uwb_bce_put(bce);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment