[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180627000612.27263-6-paul.burton@mips.com>
Date: Tue, 26 Jun 2018 17:06:06 -0700
From: Paul Burton <paul.burton@...s.com>
To: netdev@...r.kernel.org
Cc: "David S . Miller" <davem@...emloft.net>,
Andrew Lunn <andrew@...n.ch>, paul.burton@...s.com
Subject: [PATCH v7 05/11] net: pch_gbe: Move pch_gbe_watchdog lower in pch_gbe_main.c
This patch moves the pch_gbe_watchdog() function lower in pch_gbe_main.c
in order to allow use of other functions in the next patch, without
requiring lots of forward declarations. Doing this as a separate patch
makes it clearer what actually changed in the next patch.
The function is unmodified except for whitespace changes to satisfy
checkpatch.
Signed-off-by: Paul Burton <paul.burton@...s.com>
Cc: Andrew Lunn <andrew@...n.ch>
Cc: David S. Miller <davem@...emloft.net>
Cc: netdev@...r.kernel.org
---
Changes in v7: New patch
.../ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 103 +++++++++---------
1 file changed, 52 insertions(+), 51 deletions(-)
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
index ee38bba8b9ce..eb290c1edce0 100644
--- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
+++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
@@ -1046,57 +1046,6 @@ static void pch_gbe_set_mode(struct pch_gbe_adapter *adapter, u16 speed,
iowrite32(mode, &hw->reg->MODE);
}
-/**
- * pch_gbe_watchdog - Watchdog process
- * @data: Board private structure
- */
-static void pch_gbe_watchdog(struct timer_list *t)
-{
- struct pch_gbe_adapter *adapter = from_timer(adapter, t,
- watchdog_timer);
- struct net_device *netdev = adapter->netdev;
- struct pch_gbe_hw *hw = &adapter->hw;
-
- netdev_dbg(netdev, "right now = %ld\n", jiffies);
-
- pch_gbe_update_stats(adapter);
- if ((mii_link_ok(&adapter->mii)) && (!netif_carrier_ok(netdev))) {
- struct ethtool_cmd cmd = { .cmd = ETHTOOL_GSET };
- netdev->tx_queue_len = adapter->tx_queue_len;
- /* mii library handles link maintenance tasks */
- if (mii_ethtool_gset(&adapter->mii, &cmd)) {
- netdev_err(netdev, "ethtool get setting Error\n");
- mod_timer(&adapter->watchdog_timer,
- round_jiffies(jiffies +
- PCH_GBE_WATCHDOG_PERIOD));
- return;
- }
- hw->mac.link_speed = ethtool_cmd_speed(&cmd);
- hw->mac.link_duplex = cmd.duplex;
- /* Set the RGMII control. */
- pch_gbe_set_rgmii_ctrl(adapter, hw->mac.link_speed,
- hw->mac.link_duplex);
- /* Set the communication mode */
- pch_gbe_set_mode(adapter, hw->mac.link_speed,
- hw->mac.link_duplex);
- netdev_dbg(netdev,
- "Link is Up %d Mbps %s-Duplex\n",
- hw->mac.link_speed,
- cmd.duplex == DUPLEX_FULL ? "Full" : "Half");
- netif_carrier_on(netdev);
- netif_wake_queue(netdev);
- } else if ((!mii_link_ok(&adapter->mii)) &&
- (netif_carrier_ok(netdev))) {
- netdev_dbg(netdev, "NIC Link is Down\n");
- hw->mac.link_speed = SPEED_10;
- hw->mac.link_duplex = DUPLEX_HALF;
- netif_carrier_off(netdev);
- netif_stop_queue(netdev);
- }
- mod_timer(&adapter->watchdog_timer,
- round_jiffies(jiffies + PCH_GBE_WATCHDOG_PERIOD));
-}
-
/**
* pch_gbe_tx_queue - Carry out queuing of the transmission data
* @adapter: Board private structure
@@ -1973,6 +1922,58 @@ void pch_gbe_down(struct pch_gbe_adapter *adapter)
rx_ring->rx_buff_pool = NULL;
}
+/**
+ * pch_gbe_watchdog - Watchdog process
+ * @data: Board private structure
+ */
+static void pch_gbe_watchdog(struct timer_list *t)
+{
+ struct pch_gbe_adapter *adapter = from_timer(adapter, t,
+ watchdog_timer);
+ struct net_device *netdev = adapter->netdev;
+ struct pch_gbe_hw *hw = &adapter->hw;
+
+ netdev_dbg(netdev, "right now = %ld\n", jiffies);
+
+ pch_gbe_update_stats(adapter);
+ if ((mii_link_ok(&adapter->mii)) && (!netif_carrier_ok(netdev))) {
+ struct ethtool_cmd cmd = { .cmd = ETHTOOL_GSET };
+
+ netdev->tx_queue_len = adapter->tx_queue_len;
+ /* mii library handles link maintenance tasks */
+ if (mii_ethtool_gset(&adapter->mii, &cmd)) {
+ netdev_err(netdev, "ethtool get setting Error\n");
+ mod_timer(&adapter->watchdog_timer,
+ round_jiffies(jiffies +
+ PCH_GBE_WATCHDOG_PERIOD));
+ return;
+ }
+ hw->mac.link_speed = ethtool_cmd_speed(&cmd);
+ hw->mac.link_duplex = cmd.duplex;
+ /* Set the RGMII control. */
+ pch_gbe_set_rgmii_ctrl(adapter, hw->mac.link_speed,
+ hw->mac.link_duplex);
+ /* Set the communication mode */
+ pch_gbe_set_mode(adapter, hw->mac.link_speed,
+ hw->mac.link_duplex);
+ netdev_dbg(netdev,
+ "Link is Up %d Mbps %s-Duplex\n",
+ hw->mac.link_speed,
+ cmd.duplex == DUPLEX_FULL ? "Full" : "Half");
+ netif_carrier_on(netdev);
+ netif_wake_queue(netdev);
+ } else if ((!mii_link_ok(&adapter->mii)) &&
+ (netif_carrier_ok(netdev))) {
+ netdev_dbg(netdev, "NIC Link is Down\n");
+ hw->mac.link_speed = SPEED_10;
+ hw->mac.link_duplex = DUPLEX_HALF;
+ netif_carrier_off(netdev);
+ netif_stop_queue(netdev);
+ }
+ mod_timer(&adapter->watchdog_timer,
+ round_jiffies(jiffies + PCH_GBE_WATCHDOG_PERIOD));
+}
+
/**
* pch_gbe_sw_init - Initialize general software structures (struct pch_gbe_adapter)
* @adapter: Board private structure to initialize
--
2.18.0
Powered by blists - more mailing lists