Commit 9bbf1ecd authored by Linus Lüssing's avatar Linus Lüssing Committed by Greg Kroah-Hartman

Staging: batman-adv: Fixes rounding issues in vis.c

This patches fixes two rounding issues in vis.c for sending and
purging vis packets. Before, the timers and timeouts always got
rounded down to seconds, though we want a precision in
milliseconds.

This also fixes a kernel panic that occures when lowering the
timer for sending vis packets (vis_interval) to less than 1000ms
in main.c manually.
Signed-off-by: default avatarLinus Lüssing <linus.luessing@web.de>
Acked-by: default avatarMarek Lindner <lindner_marek@yahoo.de>
Signed-off-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent cec4a69c
...@@ -377,7 +377,7 @@ static void purge_vis_packets(void) ...@@ -377,7 +377,7 @@ static void purge_vis_packets(void)
if (info == my_vis_info) /* never purge own data. */ if (info == my_vis_info) /* never purge own data. */
continue; continue;
if (time_after(jiffies, if (time_after(jiffies,
info->first_seen + (VIS_TIMEOUT/1000)*HZ)) { info->first_seen + (VIS_TIMEOUT*HZ)/1000)) {
hash_remove_bucket(vis_hash, &hashit); hash_remove_bucket(vis_hash, &hashit);
free_info(info); free_info(info);
} }
...@@ -556,6 +556,6 @@ void vis_quit(void) ...@@ -556,6 +556,6 @@ void vis_quit(void)
static void start_vis_timer(void) static void start_vis_timer(void)
{ {
queue_delayed_work(bat_event_workqueue, &vis_timer_wq, queue_delayed_work(bat_event_workqueue, &vis_timer_wq,
(atomic_read(&vis_interval)/1000) * HZ); (atomic_read(&vis_interval) * HZ) / 1000);
} }
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