Commit 0e23daeb authored by Kees Cook's avatar Kees Cook Committed by David S. Miller

drivers/net: chelsio/cxgb*: 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: Santosh Raspatur <santosh@chelsio.com>
Cc: Ganesh Goudar <ganeshgr@chelsio.com>
Cc: Casey Leedom <leedom@chelsio.com>
Cc: netdev@vger.kernel.org
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 70a42ac1
...@@ -2853,9 +2853,9 @@ void t3_sge_err_intr_handler(struct adapter *adapter) ...@@ -2853,9 +2853,9 @@ void t3_sge_err_intr_handler(struct adapter *adapter)
* bother cleaning them up here. * bother cleaning them up here.
* *
*/ */
static void sge_timer_tx(unsigned long data) static void sge_timer_tx(struct timer_list *t)
{ {
struct sge_qset *qs = (struct sge_qset *)data; struct sge_qset *qs = from_timer(qs, t, tx_reclaim_timer);
struct port_info *pi = netdev_priv(qs->netdev); struct port_info *pi = netdev_priv(qs->netdev);
struct adapter *adap = pi->adapter; struct adapter *adap = pi->adapter;
unsigned int tbd[SGE_TXQ_PER_SET] = {0, 0}; unsigned int tbd[SGE_TXQ_PER_SET] = {0, 0};
...@@ -2893,10 +2893,10 @@ static void sge_timer_tx(unsigned long data) ...@@ -2893,10 +2893,10 @@ static void sge_timer_tx(unsigned long data)
* starved. * starved.
* *
*/ */
static void sge_timer_rx(unsigned long data) static void sge_timer_rx(struct timer_list *t)
{ {
spinlock_t *lock; spinlock_t *lock;
struct sge_qset *qs = (struct sge_qset *)data; struct sge_qset *qs = from_timer(qs, t, rx_reclaim_timer);
struct port_info *pi = netdev_priv(qs->netdev); struct port_info *pi = netdev_priv(qs->netdev);
struct adapter *adap = pi->adapter; struct adapter *adap = pi->adapter;
u32 status; u32 status;
...@@ -2976,8 +2976,8 @@ int t3_sge_alloc_qset(struct adapter *adapter, unsigned int id, int nports, ...@@ -2976,8 +2976,8 @@ int t3_sge_alloc_qset(struct adapter *adapter, unsigned int id, int nports,
struct sge_qset *q = &adapter->sge.qs[id]; struct sge_qset *q = &adapter->sge.qs[id];
init_qset_cntxt(q, id); init_qset_cntxt(q, id);
setup_timer(&q->tx_reclaim_timer, sge_timer_tx, (unsigned long)q); timer_setup(&q->tx_reclaim_timer, sge_timer_tx, 0);
setup_timer(&q->rx_reclaim_timer, sge_timer_rx, (unsigned long)q); timer_setup(&q->rx_reclaim_timer, sge_timer_rx, 0);
q->fl[0].desc = alloc_ring(adapter->pdev, p->fl_size, q->fl[0].desc = alloc_ring(adapter->pdev, p->fl_size,
sizeof(struct rx_desc), sizeof(struct rx_desc),
......
...@@ -741,9 +741,9 @@ int cxgb4_tc_flower_destroy(struct net_device *dev, ...@@ -741,9 +741,9 @@ int cxgb4_tc_flower_destroy(struct net_device *dev,
return ret; return ret;
} }
static void ch_flower_stats_cb(unsigned long data) static void ch_flower_stats_cb(struct timer_list *t)
{ {
struct adapter *adap = (struct adapter *)data; struct adapter *adap = from_timer(adap, t, flower_stats_timer);
struct ch_tc_flower_entry *flower_entry; struct ch_tc_flower_entry *flower_entry;
struct ch_tc_flower_stats *ofld_stats; struct ch_tc_flower_stats *ofld_stats;
unsigned int i; unsigned int i;
...@@ -815,8 +815,7 @@ int cxgb4_tc_flower_stats(struct net_device *dev, ...@@ -815,8 +815,7 @@ int cxgb4_tc_flower_stats(struct net_device *dev,
void cxgb4_init_tc_flower(struct adapter *adap) void cxgb4_init_tc_flower(struct adapter *adap)
{ {
hash_init(adap->flower_anymatch_tbl); hash_init(adap->flower_anymatch_tbl);
setup_timer(&adap->flower_stats_timer, ch_flower_stats_cb, timer_setup(&adap->flower_stats_timer, ch_flower_stats_cb, 0);
(unsigned long)adap);
mod_timer(&adap->flower_stats_timer, jiffies + STATS_CHECK_PERIOD); mod_timer(&adap->flower_stats_timer, jiffies + STATS_CHECK_PERIOD);
} }
......
...@@ -2583,11 +2583,11 @@ irq_handler_t t4_intr_handler(struct adapter *adap) ...@@ -2583,11 +2583,11 @@ irq_handler_t t4_intr_handler(struct adapter *adap)
return t4_intr_intx; return t4_intr_intx;
} }
static void sge_rx_timer_cb(unsigned long data) static void sge_rx_timer_cb(struct timer_list *t)
{ {
unsigned long m; unsigned long m;
unsigned int i; unsigned int i;
struct adapter *adap = (struct adapter *)data; struct adapter *adap = from_timer(adap, t, sge.rx_timer);
struct sge *s = &adap->sge; struct sge *s = &adap->sge;
for (i = 0; i < BITS_TO_LONGS(s->egr_sz); i++) for (i = 0; i < BITS_TO_LONGS(s->egr_sz); i++)
...@@ -2620,11 +2620,11 @@ static void sge_rx_timer_cb(unsigned long data) ...@@ -2620,11 +2620,11 @@ static void sge_rx_timer_cb(unsigned long data)
mod_timer(&s->rx_timer, jiffies + RX_QCHECK_PERIOD); mod_timer(&s->rx_timer, jiffies + RX_QCHECK_PERIOD);
} }
static void sge_tx_timer_cb(unsigned long data) static void sge_tx_timer_cb(struct timer_list *t)
{ {
unsigned long m; unsigned long m;
unsigned int i, budget; unsigned int i, budget;
struct adapter *adap = (struct adapter *)data; struct adapter *adap = from_timer(adap, t, sge.tx_timer);
struct sge *s = &adap->sge; struct sge *s = &adap->sge;
for (i = 0; i < BITS_TO_LONGS(s->egr_sz); i++) for (i = 0; i < BITS_TO_LONGS(s->egr_sz); i++)
...@@ -3458,8 +3458,8 @@ int t4_sge_init(struct adapter *adap) ...@@ -3458,8 +3458,8 @@ int t4_sge_init(struct adapter *adap)
/* Set up timers used for recuring callbacks to process RX and TX /* Set up timers used for recuring callbacks to process RX and TX
* administrative tasks. * administrative tasks.
*/ */
setup_timer(&s->rx_timer, sge_rx_timer_cb, (unsigned long)adap); timer_setup(&s->rx_timer, sge_rx_timer_cb, 0);
setup_timer(&s->tx_timer, sge_tx_timer_cb, (unsigned long)adap); timer_setup(&s->tx_timer, sge_tx_timer_cb, 0);
spin_lock_init(&s->intrq_lock); spin_lock_init(&s->intrq_lock);
......
...@@ -2058,9 +2058,9 @@ irq_handler_t t4vf_intr_handler(struct adapter *adapter) ...@@ -2058,9 +2058,9 @@ irq_handler_t t4vf_intr_handler(struct adapter *adapter)
* when out of memory a queue can become empty. We schedule NAPI to do * when out of memory a queue can become empty. We schedule NAPI to do
* the actual refill. * the actual refill.
*/ */
static void sge_rx_timer_cb(unsigned long data) static void sge_rx_timer_cb(struct timer_list *t)
{ {
struct adapter *adapter = (struct adapter *)data; struct adapter *adapter = from_timer(adapter, t, sge.rx_timer);
struct sge *s = &adapter->sge; struct sge *s = &adapter->sge;
unsigned int i; unsigned int i;
...@@ -2117,9 +2117,9 @@ static void sge_rx_timer_cb(unsigned long data) ...@@ -2117,9 +2117,9 @@ static void sge_rx_timer_cb(unsigned long data)
* when no new packets are being submitted. This is essential for pktgen, * when no new packets are being submitted. This is essential for pktgen,
* at least. * at least.
*/ */
static void sge_tx_timer_cb(unsigned long data) static void sge_tx_timer_cb(struct timer_list *t)
{ {
struct adapter *adapter = (struct adapter *)data; struct adapter *adapter = from_timer(adapter, t, sge.tx_timer);
struct sge *s = &adapter->sge; struct sge *s = &adapter->sge;
unsigned int i, budget; unsigned int i, budget;
...@@ -2676,8 +2676,8 @@ int t4vf_sge_init(struct adapter *adapter) ...@@ -2676,8 +2676,8 @@ int t4vf_sge_init(struct adapter *adapter)
/* /*
* Set up tasklet timers. * Set up tasklet timers.
*/ */
setup_timer(&s->rx_timer, sge_rx_timer_cb, (unsigned long)adapter); timer_setup(&s->rx_timer, sge_rx_timer_cb, 0);
setup_timer(&s->tx_timer, sge_tx_timer_cb, (unsigned long)adapter); timer_setup(&s->tx_timer, sge_tx_timer_cb, 0);
/* /*
* Initialize Forwarded Interrupt Queue lock. * Initialize Forwarded Interrupt Queue lock.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment