staging: rdma: hfi1: Use setup_timer

Author: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>

The function setup_timer combines the initialization of a timer with the
initialization of the timer's function and data fields.

The multiline code for timer initialization is now replaced with function
setup_timer.

This was done with Coccinelle.

@@ expression e1, e2, e3; type T; @@
- init_timer(&e1);
...
(
- e1.function = e2;
...
- e1.data = (T)e3;
+ setup_timer(&e1, e2, (T)e3);
|
- e1.data = (T)e3;
...
- e1.function = e2;
+ setup_timer(&e1, e2, (T)e3);
|
- e1.function = e2;
+ setup_timer(&e1, e2, 0);
)

Signed-off-by: Bhaktipriya Shridhar 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/staging/rdma/hfi1/verbs.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
 
diff --git a/drivers/staging/rdma/hfi1/verbs.c b/drivers/staging/rdma/hfi1/verbs.c
index 09b8d41..1761686 100644
--- a/drivers/staging/rdma/hfi1/verbs.c
+++ b/drivers/staging/rdma/hfi1/verbs.c
@@ -1926,9 +1926,7 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd)
 	spin_lock_init(&dev->n_qps_lock);
 	spin_lock_init(&dev->n_srqs_lock);
 	spin_lock_init(&dev->n_mcast_grps_lock);
-	init_timer(&dev->mem_timer);
-	dev->mem_timer.function = mem_timer;
-	dev->mem_timer.data = (unsigned long) dev;
+	setup_timer(&dev->mem_timer, mem_timer, (unsigned long)dev);
 
 	/*
 	 * The top hfi1_lkey_table_size bits are used to index the
BtrLinux
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.