staging: octeon-ethernet: consolidate ndo_stop functions
authorAaro Koskinen <aaro.koskinen@iki.fi>
Sat, 4 Apr 2015 19:51:03 +0000 (22:51 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Apr 2015 14:59:23 +0000 (16:59 +0200)
All ndo_stop functions are identical. Get rid of duplicated code.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/octeon/ethernet-mdio.c
drivers/staging/octeon/ethernet-rgmii.c
drivers/staging/octeon/ethernet-sgmii.c
drivers/staging/octeon/ethernet-xaui.c
drivers/staging/octeon/ethernet.c
drivers/staging/octeon/octeon-ethernet.h

index 40dab11e5333829092d32e5988ccae3d686ac5e3..ec38cb07eb7c194cbd5e5b2c58c2e87e9c13ede2 100644 (file)
@@ -40,7 +40,7 @@
 #include "ethernet-util.h"
 
 #include <asm/octeon/cvmx-helper-board.h>
-
+#include <asm/octeon/cvmx-gmxx-defs.h>
 #include <asm/octeon/cvmx-smix-defs.h>
 
 static void cvm_oct_get_drvinfo(struct net_device *dev,
@@ -150,7 +150,14 @@ void cvm_oct_adjust_link(struct net_device *dev)
 int cvm_oct_common_stop(struct net_device *dev)
 {
        struct octeon_ethernet *priv = netdev_priv(dev);
+       int interface = INTERFACE(priv->port);
        cvmx_helper_link_info_t link_info;
+       union cvmx_gmxx_prtx_cfg gmx_cfg;
+       int index = INDEX(priv->port);
+
+       gmx_cfg.u64 = cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index, interface));
+       gmx_cfg.s.en = 0;
+       cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface), gmx_cfg.u64);
 
        priv->poll = NULL;
 
index 88889d30cc0317d98d2080804a0cfa28aef46e4a..c428a452ddbe5ded0a879ed1b7768a89fda829f6 100644 (file)
@@ -301,19 +301,6 @@ int cvm_oct_rgmii_open(struct net_device *dev)
        return cvm_oct_common_open(dev, cvm_oct_rgmii_poll, false);
 }
 
-int cvm_oct_rgmii_stop(struct net_device *dev)
-{
-       union cvmx_gmxx_prtx_cfg gmx_cfg;
-       struct octeon_ethernet *priv = netdev_priv(dev);
-       int interface = INTERFACE(priv->port);
-       int index = INDEX(priv->port);
-
-       gmx_cfg.u64 = cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index, interface));
-       gmx_cfg.s.en = 0;
-       cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface), gmx_cfg.u64);
-       return cvm_oct_common_stop(dev);
-}
-
 static void cvm_oct_rgmii_immediate_poll(struct work_struct *work)
 {
        struct octeon_ethernet *priv =
index a6a831510151bbd70ab5988933745ff667547669..ece2880b991080549c27341995c8c75ad7c5ba6c 100644 (file)
@@ -82,19 +82,6 @@ int cvm_oct_sgmii_open(struct net_device *dev)
        return cvm_oct_common_open(dev, cvm_oct_sgmii_poll, true);
 }
 
-int cvm_oct_sgmii_stop(struct net_device *dev)
-{
-       union cvmx_gmxx_prtx_cfg gmx_cfg;
-       struct octeon_ethernet *priv = netdev_priv(dev);
-       int interface = INTERFACE(priv->port);
-       int index = INDEX(priv->port);
-
-       gmx_cfg.u64 = cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index, interface));
-       gmx_cfg.s.en = 0;
-       cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface), gmx_cfg.u64);
-       return cvm_oct_common_stop(dev);
-}
-
 int cvm_oct_sgmii_init(struct net_device *dev)
 {
        cvm_oct_common_init(dev);
index 365b01a4df0dc7c8211137bbfaed6d8f13ff9759..e8e51ed779d58f60b0263146d7abdbded3c1b18f 100644 (file)
@@ -82,19 +82,6 @@ int cvm_oct_xaui_open(struct net_device *dev)
        return cvm_oct_common_open(dev, cvm_oct_xaui_poll, true);
 }
 
-int cvm_oct_xaui_stop(struct net_device *dev)
-{
-       union cvmx_gmxx_prtx_cfg gmx_cfg;
-       struct octeon_ethernet *priv = netdev_priv(dev);
-       int interface = INTERFACE(priv->port);
-       int index = INDEX(priv->port);
-
-       gmx_cfg.u64 = cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index, interface));
-       gmx_cfg.s.en = 0;
-       cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface), gmx_cfg.u64);
-       return cvm_oct_common_stop(dev);
-}
-
 int cvm_oct_xaui_init(struct net_device *dev)
 {
        struct octeon_ethernet *priv = netdev_priv(dev);
index 3ca8b7a30d32737a73f6fc05110656bcd6dc4f97..2a3f9e2acbaa11f00dd4150f72ffeff42f2e14ff 100644 (file)
@@ -555,7 +555,7 @@ static const struct net_device_ops cvm_oct_xaui_netdev_ops = {
        .ndo_init               = cvm_oct_xaui_init,
        .ndo_uninit             = cvm_oct_xaui_uninit,
        .ndo_open               = cvm_oct_xaui_open,
-       .ndo_stop               = cvm_oct_xaui_stop,
+       .ndo_stop               = cvm_oct_common_stop,
        .ndo_start_xmit         = cvm_oct_xmit,
        .ndo_set_rx_mode        = cvm_oct_common_set_multicast_list,
        .ndo_set_mac_address    = cvm_oct_common_set_mac_address,
@@ -570,7 +570,7 @@ static const struct net_device_ops cvm_oct_sgmii_netdev_ops = {
        .ndo_init               = cvm_oct_sgmii_init,
        .ndo_uninit             = cvm_oct_sgmii_uninit,
        .ndo_open               = cvm_oct_sgmii_open,
-       .ndo_stop               = cvm_oct_sgmii_stop,
+       .ndo_stop               = cvm_oct_common_stop,
        .ndo_start_xmit         = cvm_oct_xmit,
        .ndo_set_rx_mode        = cvm_oct_common_set_multicast_list,
        .ndo_set_mac_address    = cvm_oct_common_set_mac_address,
@@ -598,7 +598,7 @@ static const struct net_device_ops cvm_oct_rgmii_netdev_ops = {
        .ndo_init               = cvm_oct_rgmii_init,
        .ndo_uninit             = cvm_oct_rgmii_uninit,
        .ndo_open               = cvm_oct_rgmii_open,
-       .ndo_stop               = cvm_oct_rgmii_stop,
+       .ndo_stop               = cvm_oct_common_stop,
        .ndo_start_xmit         = cvm_oct_xmit,
        .ndo_set_rx_mode        = cvm_oct_common_set_multicast_list,
        .ndo_set_mac_address    = cvm_oct_common_set_mac_address,
index 7818873536d8baae8dbd326305a29d91beb3789e..2581554de0b32cc547b89c6650f98127955f20fd 100644 (file)
@@ -71,19 +71,16 @@ int cvm_oct_free_work(void *work_queue_entry);
 extern int cvm_oct_rgmii_init(struct net_device *dev);
 extern void cvm_oct_rgmii_uninit(struct net_device *dev);
 extern int cvm_oct_rgmii_open(struct net_device *dev);
-extern int cvm_oct_rgmii_stop(struct net_device *dev);
 
 extern int cvm_oct_sgmii_init(struct net_device *dev);
 extern void cvm_oct_sgmii_uninit(struct net_device *dev);
 extern int cvm_oct_sgmii_open(struct net_device *dev);
-extern int cvm_oct_sgmii_stop(struct net_device *dev);
 
 extern int cvm_oct_spi_init(struct net_device *dev);
 extern void cvm_oct_spi_uninit(struct net_device *dev);
 extern int cvm_oct_xaui_init(struct net_device *dev);
 extern void cvm_oct_xaui_uninit(struct net_device *dev);
 extern int cvm_oct_xaui_open(struct net_device *dev);
-extern int cvm_oct_xaui_stop(struct net_device *dev);
 
 extern int cvm_oct_common_init(struct net_device *dev);
 extern void cvm_oct_common_uninit(struct net_device *dev);