瀏覽代碼

net: dl2k: 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: Jarod Wilson <jarod@redhat.com>
Cc: Tobias Klauser <tklauser@distanz.ch>
Cc: Philippe Reynes <tremyfr@gmail.com>
Cc: netdev@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Kees Cook 7 年之前
父節點
當前提交
6fa35bd0e9
共有 1 個文件被更改,包括 5 次插入5 次删除
  1. 5 5
      drivers/net/ethernet/dlink/dl2k.c

+ 5 - 5
drivers/net/ethernet/dlink/dl2k.c

@@ -68,7 +68,7 @@ static const int max_intrloop = 50;
 static const int multicast_filter_limit = 0x40;
 static const int multicast_filter_limit = 0x40;
 
 
 static int rio_open (struct net_device *dev);
 static int rio_open (struct net_device *dev);
-static void rio_timer (unsigned long data);
+static void rio_timer (struct timer_list *t);
 static void rio_tx_timeout (struct net_device *dev);
 static void rio_tx_timeout (struct net_device *dev);
 static netdev_tx_t start_xmit (struct sk_buff *skb, struct net_device *dev);
 static netdev_tx_t start_xmit (struct sk_buff *skb, struct net_device *dev);
 static irqreturn_t rio_interrupt (int irq, void *dev_instance);
 static irqreturn_t rio_interrupt (int irq, void *dev_instance);
@@ -644,7 +644,7 @@ static int rio_open(struct net_device *dev)
 		return i;
 		return i;
 	}
 	}
 
 
-	setup_timer(&np->timer, rio_timer, (unsigned long)dev);
+	timer_setup(&np->timer, rio_timer, 0);
 	np->timer.expires = jiffies + 1 * HZ;
 	np->timer.expires = jiffies + 1 * HZ;
 	add_timer(&np->timer);
 	add_timer(&np->timer);
 
 
@@ -655,10 +655,10 @@ static int rio_open(struct net_device *dev)
 }
 }
 
 
 static void
 static void
-rio_timer (unsigned long data)
+rio_timer (struct timer_list *t)
 {
 {
-	struct net_device *dev = (struct net_device *)data;
-	struct netdev_private *np = netdev_priv(dev);
+	struct netdev_private *np = from_timer(np, t, timer);
+	struct net_device *dev = pci_get_drvdata(np->pdev);
 	unsigned int entry;
 	unsigned int entry;
 	int next_tick = 1*HZ;
 	int next_tick = 1*HZ;
 	unsigned long flags;
 	unsigned long flags;