summaryrefslogtreecommitdiffstats
path: root/net/hsr
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2017-10-24 04:46:16 -0400
committerDavid S. Miller <davem@davemloft.net>2017-10-25 00:00:27 -0400
commitdda436b7accffd5313e8fd8338f724376c6fcda2 (patch)
tree7d66d2102e889dbec3bff3f6bf6ecfccc8b87793 /net/hsr
parent839a6094140ade97ccc548fcd63179506c5d7fe4 (diff)
net: hsr: Convert timers to use timer_setup()
In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Cc: Arvid Brodin <arvid.brodin@alten.se> Cc: "David S. Miller" <davem@davemloft.net> Cc: netdev@vger.kernel.org Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/hsr')
-rw-r--r--net/hsr/hsr_device.c9
-rw-r--r--net/hsr/hsr_framereg.c6
-rw-r--r--net/hsr/hsr_framereg.h2
3 files changed, 7 insertions, 10 deletions
diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c
index 172d8309f89e..b8cd43c9ed5b 100644
--- a/net/hsr/hsr_device.c
+++ b/net/hsr/hsr_device.c
@@ -328,12 +328,12 @@ out:
328 328
329/* Announce (supervision frame) timer function 329/* Announce (supervision frame) timer function
330 */ 330 */
331static void hsr_announce(unsigned long data) 331static void hsr_announce(struct timer_list *t)
332{ 332{
333 struct hsr_priv *hsr; 333 struct hsr_priv *hsr;
334 struct hsr_port *master; 334 struct hsr_port *master;
335 335
336 hsr = (struct hsr_priv *) data; 336 hsr = from_timer(hsr, t, announce_timer);
337 337
338 rcu_read_lock(); 338 rcu_read_lock();
339 master = hsr_port_get_hsr(hsr, HSR_PT_MASTER); 339 master = hsr_port_get_hsr(hsr, HSR_PT_MASTER);
@@ -463,9 +463,8 @@ int hsr_dev_finalize(struct net_device *hsr_dev, struct net_device *slave[2],
463 hsr->sequence_nr = HSR_SEQNR_START; 463 hsr->sequence_nr = HSR_SEQNR_START;
464 hsr->sup_sequence_nr = HSR_SUP_SEQNR_START; 464 hsr->sup_sequence_nr = HSR_SUP_SEQNR_START;
465 465
466 setup_timer(&hsr->announce_timer, hsr_announce, (unsigned long)hsr); 466 timer_setup(&hsr->announce_timer, hsr_announce, 0);
467 467 timer_setup(&hsr->prune_timer, hsr_prune_nodes, 0);
468 setup_timer(&hsr->prune_timer, hsr_prune_nodes, (unsigned long)hsr);
469 468
470 ether_addr_copy(hsr->sup_multicast_addr, def_multicast_addr); 469 ether_addr_copy(hsr->sup_multicast_addr, def_multicast_addr);
471 hsr->sup_multicast_addr[ETH_ALEN - 1] = multicast_spec; 470 hsr->sup_multicast_addr[ETH_ALEN - 1] = multicast_spec;
diff --git a/net/hsr/hsr_framereg.c b/net/hsr/hsr_framereg.c
index 284a9b820df8..286ceb41ac0c 100644
--- a/net/hsr/hsr_framereg.c
+++ b/net/hsr/hsr_framereg.c
@@ -365,16 +365,14 @@ static struct hsr_port *get_late_port(struct hsr_priv *hsr,
365/* Remove stale sequence_nr records. Called by timer every 365/* Remove stale sequence_nr records. Called by timer every
366 * HSR_LIFE_CHECK_INTERVAL (two seconds or so). 366 * HSR_LIFE_CHECK_INTERVAL (two seconds or so).
367 */ 367 */
368void hsr_prune_nodes(unsigned long data) 368void hsr_prune_nodes(struct timer_list *t)
369{ 369{
370 struct hsr_priv *hsr; 370 struct hsr_priv *hsr = from_timer(hsr, t, prune_timer);
371 struct hsr_node *node; 371 struct hsr_node *node;
372 struct hsr_port *port; 372 struct hsr_port *port;
373 unsigned long timestamp; 373 unsigned long timestamp;
374 unsigned long time_a, time_b; 374 unsigned long time_a, time_b;
375 375
376 hsr = (struct hsr_priv *) data;
377
378 rcu_read_lock(); 376 rcu_read_lock();
379 list_for_each_entry_rcu(node, &hsr->node_db, mac_list) { 377 list_for_each_entry_rcu(node, &hsr->node_db, mac_list) {
380 /* Shorthand */ 378 /* Shorthand */
diff --git a/net/hsr/hsr_framereg.h b/net/hsr/hsr_framereg.h
index 4e04f0e868e9..370b45998121 100644
--- a/net/hsr/hsr_framereg.h
+++ b/net/hsr/hsr_framereg.h
@@ -33,7 +33,7 @@ void hsr_register_frame_in(struct hsr_node *node, struct hsr_port *port,
33int hsr_register_frame_out(struct hsr_port *port, struct hsr_node *node, 33int hsr_register_frame_out(struct hsr_port *port, struct hsr_node *node,
34 u16 sequence_nr); 34 u16 sequence_nr);
35 35
36void hsr_prune_nodes(unsigned long data); 36void hsr_prune_nodes(struct timer_list *t);
37 37
38int hsr_create_self_node(struct list_head *self_node_db, 38int hsr_create_self_node(struct list_head *self_node_db,
39 unsigned char addr_a[ETH_ALEN], 39 unsigned char addr_a[ETH_ALEN],