Skip to content

Commit e1ac263

Browse files
himanshujha199640dledford
authored andcommitted
IB/qib: Use setup_timer and mod_timer
Use setup_timer and mod_timer API instead of structure assignments. This is done using Coccinelle and semantic patch used for this as follows: @@ expression x,y,z,a,b; @@ -init_timer (&x); +setup_timer (&x, y, z); +mod_timer (&a, b); -x.function = y; -x.data = z; -x.expires = b; -add_timer(&a); Signed-off-by: Himanshu Jha <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
1 parent e538e0a commit e1ac263

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

drivers/infiniband/hw/qib/qib_driver.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -735,11 +735,9 @@ void qib_set_led_override(struct qib_pportdata *ppd, unsigned int val)
735735
*/
736736
if (atomic_inc_return(&ppd->led_override_timer_active) == 1) {
737737
/* Need to start timer */
738-
init_timer(&ppd->led_override_timer);
739-
ppd->led_override_timer.function = qib_run_led_override;
740-
ppd->led_override_timer.data = (unsigned long) ppd;
741-
ppd->led_override_timer.expires = jiffies + 1;
742-
add_timer(&ppd->led_override_timer);
738+
setup_timer(&ppd->led_override_timer, qib_run_led_override,
739+
(unsigned long)ppd);
740+
mod_timer(&ppd->led_override_timer, jiffies + 1);
743741
} else {
744742
if (ppd->led_override_vals[0] || ppd->led_override_vals[1])
745743
mod_timer(&ppd->led_override_timer, jiffies + 1);

drivers/infiniband/hw/qib/qib_mad.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2478,12 +2478,10 @@ void qib_notify_create_mad_agent(struct rvt_dev_info *rdi, int port_idx)
24782478

24792479
/* Initialize xmit_wait structure */
24802480
dd->pport[port_idx].cong_stats.counter = 0;
2481-
init_timer(&dd->pport[port_idx].cong_stats.timer);
2482-
dd->pport[port_idx].cong_stats.timer.function = xmit_wait_timer_func;
2483-
dd->pport[port_idx].cong_stats.timer.data =
2484-
(unsigned long)(&dd->pport[port_idx]);
2485-
dd->pport[port_idx].cong_stats.timer.expires = 0;
2486-
add_timer(&dd->pport[port_idx].cong_stats.timer);
2481+
setup_timer(&dd->pport[port_idx].cong_stats.timer,
2482+
xmit_wait_timer_func,
2483+
(unsigned long)(&dd->pport[port_idx]));
2484+
mod_timer(&dd->pport[port_idx].cong_stats.timer, 0);
24872485
}
24882486

24892487
void qib_notify_free_mad_agent(struct rvt_dev_info *rdi, int port_idx)

0 commit comments

Comments
 (0)