sky2: Refactor sky2_down into two functions
authorMike McCormack <mikem@ring3k.org>
Fri, 12 Feb 2010 06:58:05 +0000 (06:58 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sat, 13 Feb 2010 00:21:03 +0000 (16:21 -0800)
Create a sky2_hw_down that brings the hardware down.

Signed-off-by: Mike McCormack <mikem@ring3k.org>
Acked-by: Stephen Hemminber <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/sky2.c

index 1f0180f1f0c33f8043b7658fc93f4b58a3693bdf..61a0451957b0d95f66590a6da958d6d931580cf2 100644 (file)
@@ -1908,21 +1908,12 @@ static void sky2_tx_reset(struct sky2_hw *hw, unsigned port)
        sky2_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_RST_SET);
 }
 
-/* Network shutdown */
-static int sky2_down(struct net_device *dev)
+static void sky2_hw_down(struct sky2_port *sky2)
 {
-       struct sky2_port *sky2 = netdev_priv(dev);
        struct sky2_hw *hw = sky2->hw;
        unsigned port = sky2->port;
-       u16 ctrl;
        u32 imask;
-
-       /* Never really got started! */
-       if (!sky2->tx_le)
-               return 0;
-
-       if (netif_msg_ifdown(sky2))
-               printk(KERN_INFO PFX "%s: disabling interface\n", dev->name);
+       u16 ctrl;
 
        /* Force flow control off */
        sky2_write8(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_OFF);
@@ -1972,6 +1963,21 @@ static int sky2_down(struct net_device *dev)
 
        /* Free any pending frames stuck in HW queue */
        sky2_tx_complete(sky2, sky2->tx_prod);
+}
+
+/* Network shutdown */
+static int sky2_down(struct net_device *dev)
+{
+       struct sky2_port *sky2 = netdev_priv(dev);
+
+       /* Never really got started! */
+       if (!sky2->tx_le)
+               return 0;
+
+       if (netif_msg_ifdown(sky2))
+               printk(KERN_INFO PFX "%s: disabling interface\n", dev->name);
+
+       sky2_hw_down(sky2);
 
        sky2_free_buffers(sky2);