aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/originator.c
diff options
context:
space:
mode:
authorAntonio Quartulli <ordex@autistici.org>2012-12-25 07:14:37 -0500
committerAntonio Quartulli <ordex@autistici.org>2013-01-19 08:18:09 -0500
commit7241444209f88f804ea33483394a601c1afb1d64 (patch)
tree28f2b2dae11c5367182eec51d9ad2ff422217406 /net/batman-adv/originator.c
parent1ad759d8479b4b28f2a6c874d380066cf987b341 (diff)
batman-adv: a delayed_work has to be initialised once
A delayed_work struct does not need to be initialized each every time before being enqueued. Therefore the INIT_DELAYED_WORK() macro should be used during the initialization process only. Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Diffstat (limited to 'net/batman-adv/originator.c')
-rw-r--r--net/batman-adv/originator.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index fa88b2bec986..92a55fddf44b 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -34,13 +34,6 @@ static struct lock_class_key batadv_orig_hash_lock_class_key;
34 34
35static void batadv_purge_orig(struct work_struct *work); 35static void batadv_purge_orig(struct work_struct *work);
36 36
37static void batadv_start_purge_timer(struct batadv_priv *bat_priv)
38{
39 INIT_DELAYED_WORK(&bat_priv->orig_work, batadv_purge_orig);
40 queue_delayed_work(batadv_event_workqueue,
41 &bat_priv->orig_work, msecs_to_jiffies(1000));
42}
43
44/* returns 1 if they are the same originator */ 37/* returns 1 if they are the same originator */
45static int batadv_compare_orig(const struct hlist_node *node, const void *data2) 38static int batadv_compare_orig(const struct hlist_node *node, const void *data2)
46{ 39{
@@ -63,7 +56,11 @@ int batadv_originator_init(struct batadv_priv *bat_priv)
63 batadv_hash_set_lock_class(bat_priv->orig_hash, 56 batadv_hash_set_lock_class(bat_priv->orig_hash,
64 &batadv_orig_hash_lock_class_key); 57 &batadv_orig_hash_lock_class_key);
65 58
66 batadv_start_purge_timer(bat_priv); 59 INIT_DELAYED_WORK(&bat_priv->orig_work, batadv_purge_orig);
60 queue_delayed_work(batadv_event_workqueue,
61 &bat_priv->orig_work,
62 msecs_to_jiffies(BATADV_ORIG_WORK_PERIOD));
63
67 return 0; 64 return 0;
68 65
69err: 66err:
@@ -396,7 +393,9 @@ static void batadv_purge_orig(struct work_struct *work)
396 delayed_work = container_of(work, struct delayed_work, work); 393 delayed_work = container_of(work, struct delayed_work, work);
397 bat_priv = container_of(delayed_work, struct batadv_priv, orig_work); 394 bat_priv = container_of(delayed_work, struct batadv_priv, orig_work);
398 _batadv_purge_orig(bat_priv); 395 _batadv_purge_orig(bat_priv);
399 batadv_start_purge_timer(bat_priv); 396 queue_delayed_work(batadv_event_workqueue,
397 &bat_priv->orig_work,
398 msecs_to_jiffies(BATADV_ORIG_WORK_PERIOD));
400} 399}
401 400
402void batadv_purge_orig_ref(struct batadv_priv *bat_priv) 401void batadv_purge_orig_ref(struct batadv_priv *bat_priv)