diff options
author | Mike McCormack <mikem@ring3k.org> | 2010-02-12 01:58:05 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-12 19:21:03 -0500 |
commit | f2b31cb3ae491f9e82443cf25cc5a9ebdbc63619 (patch) | |
tree | 39dfc2cbc2e083d87cffb368f1cea77c58ec24a5 /drivers/net/sky2.c | |
parent | ea0f71e59c20ea1e413cacfc971e051b3d6c6f64 (diff) |
sky2: Refactor sky2_down into two functions
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>
Diffstat (limited to 'drivers/net/sky2.c')
-rw-r--r-- | drivers/net/sky2.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 1f0180f1f0c3..61a0451957b0 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -1908,21 +1908,12 @@ static void sky2_tx_reset(struct sky2_hw *hw, unsigned port) | |||
1908 | sky2_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_RST_SET); | 1908 | sky2_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_RST_SET); |
1909 | } | 1909 | } |
1910 | 1910 | ||
1911 | /* Network shutdown */ | 1911 | static void sky2_hw_down(struct sky2_port *sky2) |
1912 | static int sky2_down(struct net_device *dev) | ||
1913 | { | 1912 | { |
1914 | struct sky2_port *sky2 = netdev_priv(dev); | ||
1915 | struct sky2_hw *hw = sky2->hw; | 1913 | struct sky2_hw *hw = sky2->hw; |
1916 | unsigned port = sky2->port; | 1914 | unsigned port = sky2->port; |
1917 | u16 ctrl; | ||
1918 | u32 imask; | 1915 | u32 imask; |
1919 | 1916 | u16 ctrl; | |
1920 | /* Never really got started! */ | ||
1921 | if (!sky2->tx_le) | ||
1922 | return 0; | ||
1923 | |||
1924 | if (netif_msg_ifdown(sky2)) | ||
1925 | printk(KERN_INFO PFX "%s: disabling interface\n", dev->name); | ||
1926 | 1917 | ||
1927 | /* Force flow control off */ | 1918 | /* Force flow control off */ |
1928 | sky2_write8(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_OFF); | 1919 | sky2_write8(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_OFF); |
@@ -1972,6 +1963,21 @@ static int sky2_down(struct net_device *dev) | |||
1972 | 1963 | ||
1973 | /* Free any pending frames stuck in HW queue */ | 1964 | /* Free any pending frames stuck in HW queue */ |
1974 | sky2_tx_complete(sky2, sky2->tx_prod); | 1965 | sky2_tx_complete(sky2, sky2->tx_prod); |
1966 | } | ||
1967 | |||
1968 | /* Network shutdown */ | ||
1969 | static int sky2_down(struct net_device *dev) | ||
1970 | { | ||
1971 | struct sky2_port *sky2 = netdev_priv(dev); | ||
1972 | |||
1973 | /* Never really got started! */ | ||
1974 | if (!sky2->tx_le) | ||
1975 | return 0; | ||
1976 | |||
1977 | if (netif_msg_ifdown(sky2)) | ||
1978 | printk(KERN_INFO PFX "%s: disabling interface\n", dev->name); | ||
1979 | |||
1980 | sky2_hw_down(sky2); | ||
1975 | 1981 | ||
1976 | sky2_free_buffers(sky2); | 1982 | sky2_free_buffers(sky2); |
1977 | 1983 | ||