diff options
author | Antonio Quartulli <ordex@autistici.org> | 2012-12-25 07:14:37 -0500 |
---|---|---|
committer | Antonio Quartulli <ordex@autistici.org> | 2013-01-19 08:18:09 -0500 |
commit | 7241444209f88f804ea33483394a601c1afb1d64 (patch) | |
tree | 28f2b2dae11c5367182eec51d9ad2ff422217406 /net/batman-adv/translation-table.c | |
parent | 1ad759d8479b4b28f2a6c874d380066cf987b341 (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/translation-table.c')
-rw-r--r-- | net/batman-adv/translation-table.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index d4b27b65d6e9..877acd149178 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c | |||
@@ -52,13 +52,6 @@ static int batadv_compare_tt(const struct hlist_node *node, const void *data2) | |||
52 | return (memcmp(data1, data2, ETH_ALEN) == 0 ? 1 : 0); | 52 | return (memcmp(data1, data2, ETH_ALEN) == 0 ? 1 : 0); |
53 | } | 53 | } |
54 | 54 | ||
55 | static void batadv_tt_start_timer(struct batadv_priv *bat_priv) | ||
56 | { | ||
57 | INIT_DELAYED_WORK(&bat_priv->tt.work, batadv_tt_purge); | ||
58 | queue_delayed_work(batadv_event_workqueue, &bat_priv->tt.work, | ||
59 | msecs_to_jiffies(5000)); | ||
60 | } | ||
61 | |||
62 | static struct batadv_tt_common_entry * | 55 | static struct batadv_tt_common_entry * |
63 | batadv_tt_hash_find(struct batadv_hashtable *hash, const void *data) | 56 | batadv_tt_hash_find(struct batadv_hashtable *hash, const void *data) |
64 | { | 57 | { |
@@ -2136,7 +2129,9 @@ int batadv_tt_init(struct batadv_priv *bat_priv) | |||
2136 | if (ret < 0) | 2129 | if (ret < 0) |
2137 | return ret; | 2130 | return ret; |
2138 | 2131 | ||
2139 | batadv_tt_start_timer(bat_priv); | 2132 | INIT_DELAYED_WORK(&bat_priv->tt.work, batadv_tt_purge); |
2133 | queue_delayed_work(batadv_event_workqueue, &bat_priv->tt.work, | ||
2134 | msecs_to_jiffies(BATADV_TT_WORK_PERIOD)); | ||
2140 | 2135 | ||
2141 | return 1; | 2136 | return 1; |
2142 | } | 2137 | } |
@@ -2286,7 +2281,8 @@ static void batadv_tt_purge(struct work_struct *work) | |||
2286 | batadv_tt_req_purge(bat_priv); | 2281 | batadv_tt_req_purge(bat_priv); |
2287 | batadv_tt_roam_purge(bat_priv); | 2282 | batadv_tt_roam_purge(bat_priv); |
2288 | 2283 | ||
2289 | batadv_tt_start_timer(bat_priv); | 2284 | queue_delayed_work(batadv_event_workqueue, &bat_priv->tt.work, |
2285 | msecs_to_jiffies(BATADV_TT_WORK_PERIOD)); | ||
2290 | } | 2286 | } |
2291 | 2287 | ||
2292 | void batadv_tt_free(struct batadv_priv *bat_priv) | 2288 | void batadv_tt_free(struct batadv_priv *bat_priv) |