summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2017-10-27 01:55:34 -0400
committerDavid S. Miller <davem@davemloft.net>2017-10-28 06:09:49 -0400
commit8089c6f4777f394407d63e217314f934b85a7947 (patch)
treee24d794a9f397c1cbf6bbd7e2ab28d266bf7e5b0
parent15735c9d8a36cadb23ac5e9e29ea083f517767e4 (diff)
drivers/net: packetengines: 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: Allen Pais <allen.lkml@gmail.com> Cc: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn> 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>
-rw-r--r--drivers/net/ethernet/packetengines/hamachi.c14
-rw-r--r--drivers/net/ethernet/packetengines/yellowfin.c10
2 files changed, 12 insertions, 12 deletions
diff --git a/drivers/net/ethernet/packetengines/hamachi.c b/drivers/net/ethernet/packetengines/hamachi.c
index 77bc7cca8980..c9529c29a0a7 100644
--- a/drivers/net/ethernet/packetengines/hamachi.c
+++ b/drivers/net/ethernet/packetengines/hamachi.c
@@ -413,13 +413,13 @@ that case.
413 413
414/* The rest of these values should never change. */ 414/* The rest of these values should never change. */
415 415
416static void hamachi_timer(unsigned long data); 416static void hamachi_timer(struct timer_list *t);
417 417
418enum capability_flags {CanHaveMII=1, }; 418enum capability_flags {CanHaveMII=1, };
419static const struct chip_info { 419static const struct chip_info {
420 u16 vendor_id, device_id, device_id_mask, pad; 420 u16 vendor_id, device_id, device_id_mask, pad;
421 const char *name; 421 const char *name;
422 void (*media_timer)(unsigned long data); 422 void (*media_timer)(struct timer_list *t);
423 int flags; 423 int flags;
424} chip_tbl[] = { 424} chip_tbl[] = {
425 {0x1318, 0x0911, 0xffff, 0, "Hamachi GNIC-II", hamachi_timer, 0}, 425 {0x1318, 0x0911, 0xffff, 0, "Hamachi GNIC-II", hamachi_timer, 0},
@@ -547,7 +547,7 @@ static int mdio_read(struct net_device *dev, int phy_id, int location);
547static void mdio_write(struct net_device *dev, int phy_id, int location, int value); 547static void mdio_write(struct net_device *dev, int phy_id, int location, int value);
548static int hamachi_open(struct net_device *dev); 548static int hamachi_open(struct net_device *dev);
549static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 549static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
550static void hamachi_timer(unsigned long data); 550static void hamachi_timer(struct timer_list *t);
551static void hamachi_tx_timeout(struct net_device *dev); 551static void hamachi_tx_timeout(struct net_device *dev);
552static void hamachi_init_ring(struct net_device *dev); 552static void hamachi_init_ring(struct net_device *dev);
553static netdev_tx_t hamachi_start_xmit(struct sk_buff *skb, 553static netdev_tx_t hamachi_start_xmit(struct sk_buff *skb,
@@ -979,7 +979,7 @@ static int hamachi_open(struct net_device *dev)
979 dev->name, readw(ioaddr + RxStatus), readw(ioaddr + TxStatus)); 979 dev->name, readw(ioaddr + RxStatus), readw(ioaddr + TxStatus));
980 } 980 }
981 /* Set the timer to check for link beat. */ 981 /* Set the timer to check for link beat. */
982 setup_timer(&hmp->timer, hamachi_timer, (unsigned long)dev); 982 timer_setup(&hmp->timer, hamachi_timer, 0);
983 hmp->timer.expires = RUN_AT((24*HZ)/10); /* 2.4 sec. */ 983 hmp->timer.expires = RUN_AT((24*HZ)/10); /* 2.4 sec. */
984 add_timer(&hmp->timer); 984 add_timer(&hmp->timer);
985 985
@@ -1017,10 +1017,10 @@ static inline int hamachi_tx(struct net_device *dev)
1017 return 0; 1017 return 0;
1018} 1018}
1019 1019
1020static void hamachi_timer(unsigned long data) 1020static void hamachi_timer(struct timer_list *t)
1021{ 1021{
1022 struct net_device *dev = (struct net_device *)data; 1022 struct hamachi_private *hmp = from_timer(hmp, t, timer);
1023 struct hamachi_private *hmp = netdev_priv(dev); 1023 struct net_device *dev = hmp->mii_if.dev;
1024 void __iomem *ioaddr = hmp->base; 1024 void __iomem *ioaddr = hmp->base;
1025 int next_tick = 10*HZ; 1025 int next_tick = 10*HZ;
1026 1026
diff --git a/drivers/net/ethernet/packetengines/yellowfin.c b/drivers/net/ethernet/packetengines/yellowfin.c
index 33c241f52a71..54224d1822e3 100644
--- a/drivers/net/ethernet/packetengines/yellowfin.c
+++ b/drivers/net/ethernet/packetengines/yellowfin.c
@@ -343,7 +343,7 @@ static int mdio_read(void __iomem *ioaddr, int phy_id, int location);
343static void mdio_write(void __iomem *ioaddr, int phy_id, int location, int value); 343static void mdio_write(void __iomem *ioaddr, int phy_id, int location, int value);
344static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 344static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
345static int yellowfin_open(struct net_device *dev); 345static int yellowfin_open(struct net_device *dev);
346static void yellowfin_timer(unsigned long data); 346static void yellowfin_timer(struct timer_list *t);
347static void yellowfin_tx_timeout(struct net_device *dev); 347static void yellowfin_tx_timeout(struct net_device *dev);
348static int yellowfin_init_ring(struct net_device *dev); 348static int yellowfin_init_ring(struct net_device *dev);
349static netdev_tx_t yellowfin_start_xmit(struct sk_buff *skb, 349static netdev_tx_t yellowfin_start_xmit(struct sk_buff *skb,
@@ -632,7 +632,7 @@ static int yellowfin_open(struct net_device *dev)
632 } 632 }
633 633
634 /* Set the timer to check for link beat. */ 634 /* Set the timer to check for link beat. */
635 setup_timer(&yp->timer, yellowfin_timer, (unsigned long)dev); 635 timer_setup(&yp->timer, yellowfin_timer, 0);
636 yp->timer.expires = jiffies + 3*HZ; 636 yp->timer.expires = jiffies + 3*HZ;
637 add_timer(&yp->timer); 637 add_timer(&yp->timer);
638out: 638out:
@@ -643,10 +643,10 @@ err_free_irq:
643 goto out; 643 goto out;
644} 644}
645 645
646static void yellowfin_timer(unsigned long data) 646static void yellowfin_timer(struct timer_list *t)
647{ 647{
648 struct net_device *dev = (struct net_device *)data; 648 struct yellowfin_private *yp = from_timer(yp, t, timer);
649 struct yellowfin_private *yp = netdev_priv(dev); 649 struct net_device *dev = pci_get_drvdata(yp->pci_dev);
650 void __iomem *ioaddr = yp->base; 650 void __iomem *ioaddr = yp->base;
651 int next_tick = 60*HZ; 651 int next_tick = 60*HZ;
652 652