drivers: replace dev->trans_start accesses with dev_trans_start
authorFlorian Westphal <fw@strlen.de>
Tue, 3 May 2016 14:30:59 +0000 (16:30 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 4 May 2016 18:16:47 +0000 (14:16 -0400)
a trans_start struct member exists twice:
- in struct net_device (legacy)
- in struct netdev_queue

Instead of open-coding dev->trans_start usage to obtain the current
trans_start value, use dev_trans_start() instead.

This is not exactly the same, as dev_trans_start also considers
the trans_start values of the netdev queues owned by the device
and provides the most recent one.

For legacy devices this doesn't matter as dev_trans_start can cope
with netdev trans_start values of 0 (they are ignored).

This is a prerequisite to eventual removal of dev->trans_start.

Cc: linux-rdma@vger.kernel.org
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/infiniband/ulp/ipoib/ipoib_main.c
drivers/net/ethernet/intel/e1000e/netdev.c
drivers/net/ethernet/intel/igb/igb_main.c
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
drivers/net/ethernet/microchip/encx24j600.c
drivers/net/ethernet/qualcomm/qca_spi.c
drivers/net/fjes/fjes_main.c
drivers/net/hamradio/mkiss.c
drivers/staging/rtl8192e/rtllib_softmac.c
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c

index 80807d6e5c4cff878f25eaf0861c9c8822843676..b940ef1c19c70e400905322a57ea0d49d2f0a3f2 100644 (file)
@@ -1036,7 +1036,7 @@ static void ipoib_timeout(struct net_device *dev)
        struct ipoib_dev_priv *priv = netdev_priv(dev);
 
        ipoib_warn(priv, "transmit timeout: latency %d msecs\n",
-                  jiffies_to_msecs(jiffies - dev->trans_start));
+                  jiffies_to_msecs(jiffies - dev_trans_start(dev)));
        ipoib_warn(priv, "queue stopped %d, tx_head %u, tx_tail %u\n",
                   netif_queue_stopped(dev),
                   priv->tx_head, priv->tx_tail);
index a7f16c35ebcd26ef1197b15513491334865cc4af..269087cb7b963ae81cb1bafec5ed98a11f6c83c4 100644 (file)
@@ -242,7 +242,7 @@ static void e1000e_dump(struct e1000_adapter *adapter)
                dev_info(&adapter->pdev->dev, "Net device Info\n");
                pr_info("Device Name     state            trans_start      last_rx\n");
                pr_info("%-15s %016lX %016lX %016lX\n", netdev->name,
-                       netdev->state, netdev->trans_start, netdev->last_rx);
+                       netdev->state, dev_trans_start(netdev), netdev->last_rx);
        }
 
        /* Print Registers */
index 8e96c35307fb8e6f8d2a66677aa82a4afe8bbd20..7460bdbe2e49f78b64c017839226b8be4c8097a2 100644 (file)
@@ -383,7 +383,7 @@ static void igb_dump(struct igb_adapter *adapter)
                dev_info(&adapter->pdev->dev, "Net device Info\n");
                pr_info("Device Name     state            trans_start      last_rx\n");
                pr_info("%-15s %016lX %016lX %016lX\n", netdev->name,
-                       netdev->state, netdev->trans_start, netdev->last_rx);
+                       netdev->state, dev_trans_start(netdev), netdev->last_rx);
        }
 
        /* Print Registers */
index 0ef4a15bb23e994e03abdf2d3cdb0bbf0cc9e0fb..18dcfc577ba9c485b69e7df3de4f6a79b607c3b5 100644 (file)
@@ -608,7 +608,7 @@ static void ixgbe_dump(struct ixgbe_adapter *adapter)
                pr_info("%-15s %016lX %016lX %016lX\n",
                        netdev->name,
                        netdev->state,
-                       netdev->trans_start,
+                       dev_trans_start(netdev),
                        netdev->last_rx);
        }
 
index 7df318346b05a513b36b7805f421f3cdbb4dd3e0..707283bb62ba7bf4884326bd3e60a32c677318cb 100644 (file)
@@ -890,7 +890,7 @@ static void encx24j600_tx_timeout(struct net_device *dev)
        struct encx24j600_priv *priv = netdev_priv(dev);
 
        netif_err(priv, tx_err, dev, "TX timeout at %ld, latency %ld\n",
-                 jiffies, jiffies - dev->trans_start);
+                 jiffies, jiffies - dev_trans_start(dev));
 
        dev->stats.tx_errors++;
        netif_wake_queue(dev);
index 1ef03939d25f478356112fbe376ff79cfd1e8eaa..82f3c8811400490ecde535c686a801c90c213fc3 100644 (file)
@@ -734,7 +734,7 @@ qcaspi_netdev_tx_timeout(struct net_device *dev)
        struct qcaspi *qca = netdev_priv(dev);
 
        netdev_info(qca->net_dev, "Transmit timeout at %ld, latency %ld\n",
-                   jiffies, jiffies - dev->trans_start);
+                   jiffies, jiffies - dev_trans_start(dev));
        qca->net_dev->stats.tx_errors++;
        /* Trigger tx queue flush and QCA7000 reset */
        qca->sync = QCASPI_SYNC_UNKNOWN;
index bb7e90368f8ffa7a428c04e1fed265dc10670e7c..7ad3d04314c55b6eaa35c93f2c72481cdf9965b1 100644 (file)
@@ -471,7 +471,7 @@ static void fjes_tx_stall_task(struct work_struct *work)
        int i;
 
        if (((long)jiffies -
-               (long)(netdev->trans_start)) > FJES_TX_TX_STALL_TIMEOUT) {
+               dev_trans_start(netdev)) > FJES_TX_TX_STALL_TIMEOUT) {
                netif_wake_queue(netdev);
                return;
        }
index 85828f1534454dbfd4020e6407e6ad2a136af93c..c685937e1de3db299b347f93234c36834b2eb2b1 100644 (file)
@@ -542,7 +542,7 @@ static netdev_tx_t ax_xmit(struct sk_buff *skb, struct net_device *dev)
                 * May be we must check transmitter timeout here ?
                 *      14 Oct 1994 Dmitry Gorodchanin.
                 */
-               if (time_before(jiffies, dev->trans_start + 20 * HZ)) {
+               if (time_before(jiffies, dev_trans_start(dev) + 20 * HZ)) {
                        /* 20 sec timeout not reached */
                        return NETDEV_TX_BUSY;
                }
index cfab715495adc13a341c099a815427bdfa438b02..62154e3f4463d906f2f48afb88cd70ce06991c17 100644 (file)
@@ -1991,7 +1991,7 @@ static short rtllib_sta_ps_sleep(struct rtllib_device *ieee, u64 *time)
                return 2;
 
        if (!time_after(jiffies,
-                       ieee->dev->trans_start + msecs_to_jiffies(timeout)))
+                       dev_trans_start(ieee->dev) + msecs_to_jiffies(timeout)))
                return 0;
        if (!time_after(jiffies,
                        ieee->last_rx_ps_time + msecs_to_jiffies(timeout)))
index ae1274cfb392e3e868620541004abcde7efc172e..de714501c996a64a152e1628201eb9425ea70918 100644 (file)
@@ -1737,7 +1737,7 @@ static short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h,
                return 2;
 
        if(!time_after(jiffies,
-                      ieee->dev->trans_start + msecs_to_jiffies(timeout)))
+                      dev_trans_start(ieee->dev) + msecs_to_jiffies(timeout)))
                return 0;
 
        if(!time_after(jiffies,