Skip to content

Commit b09064b

Browse files
keesdavem330
authored andcommitted
bna: 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: Rasesh Mody <[email protected]> Cc: Sudarsana Kalluru <[email protected]> Cc: [email protected] Cc: [email protected] Signed-off-by: Kees Cook <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 495ad98 commit b09064b

File tree

1 file changed

+19
-24
lines changed
  • drivers/net/ethernet/brocade/bna

1 file changed

+19
-24
lines changed

drivers/net/ethernet/brocade/bna/bnad.c

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1693,9 +1693,9 @@ bnad_rx_res_alloc(struct bnad *bnad, struct bna_res_info *res_info,
16931693
/* Timer callbacks */
16941694
/* a) IOC timer */
16951695
static void
1696-
bnad_ioc_timeout(unsigned long data)
1696+
bnad_ioc_timeout(struct timer_list *t)
16971697
{
1698-
struct bnad *bnad = (struct bnad *)data;
1698+
struct bnad *bnad = from_timer(bnad, t, bna.ioceth.ioc.ioc_timer);
16991699
unsigned long flags;
17001700

17011701
spin_lock_irqsave(&bnad->bna_lock, flags);
@@ -1704,9 +1704,9 @@ bnad_ioc_timeout(unsigned long data)
17041704
}
17051705

17061706
static void
1707-
bnad_ioc_hb_check(unsigned long data)
1707+
bnad_ioc_hb_check(struct timer_list *t)
17081708
{
1709-
struct bnad *bnad = (struct bnad *)data;
1709+
struct bnad *bnad = from_timer(bnad, t, bna.ioceth.ioc.hb_timer);
17101710
unsigned long flags;
17111711

17121712
spin_lock_irqsave(&bnad->bna_lock, flags);
@@ -1715,9 +1715,9 @@ bnad_ioc_hb_check(unsigned long data)
17151715
}
17161716

17171717
static void
1718-
bnad_iocpf_timeout(unsigned long data)
1718+
bnad_iocpf_timeout(struct timer_list *t)
17191719
{
1720-
struct bnad *bnad = (struct bnad *)data;
1720+
struct bnad *bnad = from_timer(bnad, t, bna.ioceth.ioc.iocpf_timer);
17211721
unsigned long flags;
17221722

17231723
spin_lock_irqsave(&bnad->bna_lock, flags);
@@ -1726,9 +1726,9 @@ bnad_iocpf_timeout(unsigned long data)
17261726
}
17271727

17281728
static void
1729-
bnad_iocpf_sem_timeout(unsigned long data)
1729+
bnad_iocpf_sem_timeout(struct timer_list *t)
17301730
{
1731-
struct bnad *bnad = (struct bnad *)data;
1731+
struct bnad *bnad = from_timer(bnad, t, bna.ioceth.ioc.sem_timer);
17321732
unsigned long flags;
17331733

17341734
spin_lock_irqsave(&bnad->bna_lock, flags);
@@ -1748,9 +1748,9 @@ bnad_iocpf_sem_timeout(unsigned long data)
17481748

17491749
/* b) Dynamic Interrupt Moderation Timer */
17501750
static void
1751-
bnad_dim_timeout(unsigned long data)
1751+
bnad_dim_timeout(struct timer_list *t)
17521752
{
1753-
struct bnad *bnad = (struct bnad *)data;
1753+
struct bnad *bnad = from_timer(bnad, t, dim_timer);
17541754
struct bnad_rx_info *rx_info;
17551755
struct bnad_rx_ctrl *rx_ctrl;
17561756
int i, j;
@@ -1781,9 +1781,9 @@ bnad_dim_timeout(unsigned long data)
17811781

17821782
/* c) Statistics Timer */
17831783
static void
1784-
bnad_stats_timeout(unsigned long data)
1784+
bnad_stats_timeout(struct timer_list *t)
17851785
{
1786-
struct bnad *bnad = (struct bnad *)data;
1786+
struct bnad *bnad = from_timer(bnad, t, stats_timer);
17871787
unsigned long flags;
17881788

17891789
if (!netif_running(bnad->netdev) ||
@@ -1804,8 +1804,7 @@ bnad_dim_timer_start(struct bnad *bnad)
18041804
{
18051805
if (bnad->cfg_flags & BNAD_CF_DIM_ENABLED &&
18061806
!test_bit(BNAD_RF_DIM_TIMER_RUNNING, &bnad->run_flags)) {
1807-
setup_timer(&bnad->dim_timer, bnad_dim_timeout,
1808-
(unsigned long)bnad);
1807+
timer_setup(&bnad->dim_timer, bnad_dim_timeout, 0);
18091808
set_bit(BNAD_RF_DIM_TIMER_RUNNING, &bnad->run_flags);
18101809
mod_timer(&bnad->dim_timer,
18111810
jiffies + msecs_to_jiffies(BNAD_DIM_TIMER_FREQ));
@@ -1823,8 +1822,7 @@ bnad_stats_timer_start(struct bnad *bnad)
18231822

18241823
spin_lock_irqsave(&bnad->bna_lock, flags);
18251824
if (!test_and_set_bit(BNAD_RF_STATS_TIMER_RUNNING, &bnad->run_flags)) {
1826-
setup_timer(&bnad->stats_timer, bnad_stats_timeout,
1827-
(unsigned long)bnad);
1825+
timer_setup(&bnad->stats_timer, bnad_stats_timeout, 0);
18281826
mod_timer(&bnad->stats_timer,
18291827
jiffies + msecs_to_jiffies(BNAD_STATS_TIMER_FREQ));
18301828
}
@@ -3692,14 +3690,11 @@ bnad_pci_probe(struct pci_dev *pdev,
36923690
goto res_free;
36933691

36943692
/* Set up timers */
3695-
setup_timer(&bnad->bna.ioceth.ioc.ioc_timer, bnad_ioc_timeout,
3696-
(unsigned long)bnad);
3697-
setup_timer(&bnad->bna.ioceth.ioc.hb_timer, bnad_ioc_hb_check,
3698-
(unsigned long)bnad);
3699-
setup_timer(&bnad->bna.ioceth.ioc.iocpf_timer, bnad_iocpf_timeout,
3700-
(unsigned long)bnad);
3701-
setup_timer(&bnad->bna.ioceth.ioc.sem_timer, bnad_iocpf_sem_timeout,
3702-
(unsigned long)bnad);
3693+
timer_setup(&bnad->bna.ioceth.ioc.ioc_timer, bnad_ioc_timeout, 0);
3694+
timer_setup(&bnad->bna.ioceth.ioc.hb_timer, bnad_ioc_hb_check, 0);
3695+
timer_setup(&bnad->bna.ioceth.ioc.iocpf_timer, bnad_iocpf_timeout, 0);
3696+
timer_setup(&bnad->bna.ioceth.ioc.sem_timer, bnad_iocpf_sem_timeout,
3697+
0);
37033698

37043699
/*
37053700
* Start the chip

0 commit comments

Comments
 (0)