Skip to content

Commit d993567

Browse files
keesdavem330
authored andcommitted
forcedeth: 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" <davem@davemloft.net> Cc: Zhu Yanjun <yanjun.zhu@oracle.com> Cc: Philippe Reynes <tremyfr@gmail.com> Cc: netdev@vger.kernel.org Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 11dd894 commit d993567

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

drivers/net/ethernet/nvidia/forcedeth.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1884,10 +1884,9 @@ static int nv_alloc_rx_optimized(struct net_device *dev)
18841884
}
18851885

18861886
/* If rx bufs are exhausted called after 50ms to attempt to refresh */
1887-
static void nv_do_rx_refill(unsigned long data)
1887+
static void nv_do_rx_refill(struct timer_list *t)
18881888
{
1889-
struct net_device *dev = (struct net_device *) data;
1890-
struct fe_priv *np = netdev_priv(dev);
1889+
struct fe_priv *np = from_timer(np, t, oom_kick);
18911890

18921891
/* Just reschedule NAPI rx processing */
18931892
napi_schedule(&np->napi);
@@ -4065,10 +4064,10 @@ static void nv_free_irq(struct net_device *dev)
40654064
}
40664065
}
40674066

4068-
static void nv_do_nic_poll(unsigned long data)
4067+
static void nv_do_nic_poll(struct timer_list *t)
40694068
{
4070-
struct net_device *dev = (struct net_device *) data;
4071-
struct fe_priv *np = netdev_priv(dev);
4069+
struct fe_priv *np = from_timer(np, t, nic_poll);
4070+
struct net_device *dev = np->dev;
40724071
u8 __iomem *base = get_hwbase(dev);
40734072
u32 mask = 0;
40744073
unsigned long flags;
@@ -4176,16 +4175,18 @@ static void nv_do_nic_poll(unsigned long data)
41764175
#ifdef CONFIG_NET_POLL_CONTROLLER
41774176
static void nv_poll_controller(struct net_device *dev)
41784177
{
4179-
nv_do_nic_poll((unsigned long) dev);
4178+
struct fe_priv *np = netdev_priv(dev);
4179+
4180+
nv_do_nic_poll(&np->nic_poll);
41804181
}
41814182
#endif
41824183

4183-
static void nv_do_stats_poll(unsigned long data)
4184+
static void nv_do_stats_poll(struct timer_list *t)
41844185
__acquires(&netdev_priv(dev)->hwstats_lock)
41854186
__releases(&netdev_priv(dev)->hwstats_lock)
41864187
{
4187-
struct net_device *dev = (struct net_device *) data;
4188-
struct fe_priv *np = netdev_priv(dev);
4188+
struct fe_priv *np = from_timer(np, t, stats_poll);
4189+
struct net_device *dev = np->dev;
41894190

41904191
/* If lock is currently taken, the stats are being refreshed
41914192
* and hence fresh enough */
@@ -5631,10 +5632,9 @@ static int nv_probe(struct pci_dev *pci_dev, const struct pci_device_id *id)
56315632
u64_stats_init(&np->swstats_rx_syncp);
56325633
u64_stats_init(&np->swstats_tx_syncp);
56335634

5634-
setup_timer(&np->oom_kick, nv_do_rx_refill, (unsigned long)dev);
5635-
setup_timer(&np->nic_poll, nv_do_nic_poll, (unsigned long)dev);
5636-
setup_deferrable_timer(&np->stats_poll, nv_do_stats_poll,
5637-
(unsigned long)dev);
5635+
timer_setup(&np->oom_kick, nv_do_rx_refill, 0);
5636+
timer_setup(&np->nic_poll, nv_do_nic_poll, 0);
5637+
timer_setup(&np->stats_poll, nv_do_stats_poll, TIMER_DEFERRABLE);
56385638

56395639
err = pci_enable_device(pci_dev);
56405640
if (err)

0 commit comments

Comments
 (0)