Skip to content

Commit cacd2b3

Browse files
keesdavem330
authored andcommitted
chelsio: 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: "David S. Miller" <[email protected]> Cc: Johannes Berg <[email protected]> Cc: Eric Dumazet <[email protected]> Cc: [email protected] Signed-off-by: Kees Cook <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7974c0f commit cacd2b3

File tree

1 file changed

+13
-16
lines changed
  • drivers/net/ethernet/chelsio/cxgb

1 file changed

+13
-16
lines changed

drivers/net/ethernet/chelsio/cxgb/sge.c

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1882,10 +1882,10 @@ netdev_tx_t t1_start_xmit(struct sk_buff *skb, struct net_device *dev)
18821882
/*
18831883
* Callback for the Tx buffer reclaim timer. Runs with softirqs disabled.
18841884
*/
1885-
static void sge_tx_reclaim_cb(unsigned long data)
1885+
static void sge_tx_reclaim_cb(struct timer_list *t)
18861886
{
18871887
int i;
1888-
struct sge *sge = (struct sge *)data;
1888+
struct sge *sge = from_timer(sge, t, tx_reclaim_timer);
18891889

18901890
for (i = 0; i < SGE_CMDQ_N; ++i) {
18911891
struct cmdQ *q = &sge->cmdQ[i];
@@ -1978,10 +1978,10 @@ void t1_sge_start(struct sge *sge)
19781978
/*
19791979
* Callback for the T2 ESPI 'stuck packet feature' workaorund
19801980
*/
1981-
static void espibug_workaround_t204(unsigned long data)
1981+
static void espibug_workaround_t204(struct timer_list *t)
19821982
{
1983-
struct adapter *adapter = (struct adapter *)data;
1984-
struct sge *sge = adapter->sge;
1983+
struct sge *sge = from_timer(sge, t, espibug_timer);
1984+
struct adapter *adapter = sge->adapter;
19851985
unsigned int nports = adapter->params.nports;
19861986
u32 seop[MAX_NPORTS];
19871987

@@ -2021,10 +2021,10 @@ static void espibug_workaround_t204(unsigned long data)
20212021
mod_timer(&sge->espibug_timer, jiffies + sge->espibug_timeout);
20222022
}
20232023

2024-
static void espibug_workaround(unsigned long data)
2024+
static void espibug_workaround(struct timer_list *t)
20252025
{
2026-
struct adapter *adapter = (struct adapter *)data;
2027-
struct sge *sge = adapter->sge;
2026+
struct sge *sge = from_timer(sge, t, espibug_timer);
2027+
struct adapter *adapter = sge->adapter;
20282028

20292029
if (netif_running(adapter->port[0].dev)) {
20302030
struct sk_buff *skb = sge->espibug_skb[0];
@@ -2075,18 +2075,15 @@ struct sge *t1_sge_create(struct adapter *adapter, struct sge_params *p)
20752075
goto nomem_port;
20762076
}
20772077

2078-
setup_timer(&sge->tx_reclaim_timer, sge_tx_reclaim_cb,
2079-
(unsigned long)sge);
2078+
timer_setup(&sge->tx_reclaim_timer, sge_tx_reclaim_cb, 0);
20802079

20812080
if (is_T2(sge->adapter)) {
2082-
init_timer(&sge->espibug_timer);
2081+
timer_setup(&sge->espibug_timer,
2082+
adapter->params.nports > 1 ? espibug_workaround_t204 : espibug_workaround,
2083+
0);
20832084

2084-
if (adapter->params.nports > 1) {
2085+
if (adapter->params.nports > 1)
20852086
tx_sched_init(sge);
2086-
sge->espibug_timer.function = espibug_workaround_t204;
2087-
} else
2088-
sge->espibug_timer.function = espibug_workaround;
2089-
sge->espibug_timer.data = (unsigned long)sge->adapter;
20902087

20912088
sge->espibug_timeout = 1;
20922089
/* for T204, every 10ms */

0 commit comments

Comments
 (0)