drivers/net: ntb_netdev: Convert timers to use timer_setup()
authorKees Cook <keescook@chromium.org>
Mon, 30 Oct 2017 21:05:12 +0000 (14:05 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 1 Nov 2017 03:38:45 +0000 (12:38 +0900)
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: Jon Mason <jdmason@kudzu.us>
Cc: Dave Jiang <dave.jiang@intel.com>
Cc: Allen Hubbe <Allen.Hubbe@emc.com>
Cc: linux-ntb@googlegroups.com
Cc: netdev@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ntb_netdev.c

index 0250aa9ae2cbc9b0878c89b856f3b591dea3b0a5..9f6f7ccd44f775686dd4807d52b409be407026b9 100644 (file)
@@ -230,10 +230,10 @@ err:
        return NETDEV_TX_BUSY;
 }
 
-static void ntb_netdev_tx_timer(unsigned long data)
+static void ntb_netdev_tx_timer(struct timer_list *t)
 {
-       struct net_device *ndev = (struct net_device *)data;
-       struct ntb_netdev *dev = netdev_priv(ndev);
+       struct ntb_netdev *dev = from_timer(dev, t, tx_timer);
+       struct net_device *ndev = dev->ndev;
 
        if (ntb_transport_tx_free_entry(dev->qp) < tx_stop) {
                mod_timer(&dev->tx_timer, jiffies + msecs_to_jiffies(tx_time));
@@ -269,7 +269,7 @@ static int ntb_netdev_open(struct net_device *ndev)
                }
        }
 
-       setup_timer(&dev->tx_timer, ntb_netdev_tx_timer, (unsigned long)ndev);
+       timer_setup(&dev->tx_timer, ntb_netdev_tx_timer, 0);
 
        netif_carrier_off(ndev);
        ntb_transport_link_up(dev->qp);