From: Aaro Koskinen Date: Sat, 4 Apr 2015 19:51:03 +0000 (+0300) Subject: staging: octeon-ethernet: consolidate ndo_stop functions X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=96217ebff7f2fda012f755cdb28f34400fd5f99c;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git staging: octeon-ethernet: consolidate ndo_stop functions All ndo_stop functions are identical. Get rid of duplicated code. Signed-off-by: Aaro Koskinen Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/octeon/ethernet-mdio.c b/drivers/staging/octeon/ethernet-mdio.c index 40dab11e5333..ec38cb07eb7c 100644 --- a/drivers/staging/octeon/ethernet-mdio.c +++ b/drivers/staging/octeon/ethernet-mdio.c @@ -40,7 +40,7 @@ #include "ethernet-util.h" #include - +#include #include 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; diff --git a/drivers/staging/octeon/ethernet-rgmii.c b/drivers/staging/octeon/ethernet-rgmii.c index 88889d30cc03..c428a452ddbe 100644 --- a/drivers/staging/octeon/ethernet-rgmii.c +++ b/drivers/staging/octeon/ethernet-rgmii.c @@ -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 = diff --git a/drivers/staging/octeon/ethernet-sgmii.c b/drivers/staging/octeon/ethernet-sgmii.c index a6a831510151..ece2880b9910 100644 --- a/drivers/staging/octeon/ethernet-sgmii.c +++ b/drivers/staging/octeon/ethernet-sgmii.c @@ -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); diff --git a/drivers/staging/octeon/ethernet-xaui.c b/drivers/staging/octeon/ethernet-xaui.c index 365b01a4df0d..e8e51ed779d5 100644 --- a/drivers/staging/octeon/ethernet-xaui.c +++ b/drivers/staging/octeon/ethernet-xaui.c @@ -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); diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c index 3ca8b7a30d32..2a3f9e2acbaa 100644 --- a/drivers/staging/octeon/ethernet.c +++ b/drivers/staging/octeon/ethernet.c @@ -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, diff --git a/drivers/staging/octeon/octeon-ethernet.h b/drivers/staging/octeon/octeon-ethernet.h index 7818873536d8..2581554de0b3 100644 --- a/drivers/staging/octeon/octeon-ethernet.h +++ b/drivers/staging/octeon/octeon-ethernet.h @@ -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);