staging: octeon-ethernet: consolidate ndo_stop functions

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>
This commit is contained in:
Aaro Koskinen 2015-04-04 22:51:03 +03:00 committed by Greg Kroah-Hartman
parent 9e3ae4f9ae
commit 96217ebff7
6 changed files with 11 additions and 46 deletions

View File

@ -40,7 +40,7 @@
#include "ethernet-util.h" #include "ethernet-util.h"
#include <asm/octeon/cvmx-helper-board.h> #include <asm/octeon/cvmx-helper-board.h>
#include <asm/octeon/cvmx-gmxx-defs.h>
#include <asm/octeon/cvmx-smix-defs.h> #include <asm/octeon/cvmx-smix-defs.h>
static void cvm_oct_get_drvinfo(struct net_device *dev, 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) int cvm_oct_common_stop(struct net_device *dev)
{ {
struct octeon_ethernet *priv = netdev_priv(dev); struct octeon_ethernet *priv = netdev_priv(dev);
int interface = INTERFACE(priv->port);
cvmx_helper_link_info_t link_info; 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; priv->poll = NULL;

View 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); 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) static void cvm_oct_rgmii_immediate_poll(struct work_struct *work)
{ {
struct octeon_ethernet *priv = struct octeon_ethernet *priv =

View 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); 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) int cvm_oct_sgmii_init(struct net_device *dev)
{ {
cvm_oct_common_init(dev); cvm_oct_common_init(dev);

View 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); 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) int cvm_oct_xaui_init(struct net_device *dev)
{ {
struct octeon_ethernet *priv = netdev_priv(dev); struct octeon_ethernet *priv = netdev_priv(dev);

View File

@ -555,7 +555,7 @@ static const struct net_device_ops cvm_oct_xaui_netdev_ops = {
.ndo_init = cvm_oct_xaui_init, .ndo_init = cvm_oct_xaui_init,
.ndo_uninit = cvm_oct_xaui_uninit, .ndo_uninit = cvm_oct_xaui_uninit,
.ndo_open = cvm_oct_xaui_open, .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_start_xmit = cvm_oct_xmit,
.ndo_set_rx_mode = cvm_oct_common_set_multicast_list, .ndo_set_rx_mode = cvm_oct_common_set_multicast_list,
.ndo_set_mac_address = cvm_oct_common_set_mac_address, .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_init = cvm_oct_sgmii_init,
.ndo_uninit = cvm_oct_sgmii_uninit, .ndo_uninit = cvm_oct_sgmii_uninit,
.ndo_open = cvm_oct_sgmii_open, .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_start_xmit = cvm_oct_xmit,
.ndo_set_rx_mode = cvm_oct_common_set_multicast_list, .ndo_set_rx_mode = cvm_oct_common_set_multicast_list,
.ndo_set_mac_address = cvm_oct_common_set_mac_address, .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_init = cvm_oct_rgmii_init,
.ndo_uninit = cvm_oct_rgmii_uninit, .ndo_uninit = cvm_oct_rgmii_uninit,
.ndo_open = cvm_oct_rgmii_open, .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_start_xmit = cvm_oct_xmit,
.ndo_set_rx_mode = cvm_oct_common_set_multicast_list, .ndo_set_rx_mode = cvm_oct_common_set_multicast_list,
.ndo_set_mac_address = cvm_oct_common_set_mac_address, .ndo_set_mac_address = cvm_oct_common_set_mac_address,

View 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 int cvm_oct_rgmii_init(struct net_device *dev);
extern void cvm_oct_rgmii_uninit(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_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 int cvm_oct_sgmii_init(struct net_device *dev);
extern void cvm_oct_sgmii_uninit(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_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 int cvm_oct_spi_init(struct net_device *dev);
extern void cvm_oct_spi_uninit(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 int cvm_oct_xaui_init(struct net_device *dev);
extern void cvm_oct_xaui_uninit(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_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 int cvm_oct_common_init(struct net_device *dev);
extern void cvm_oct_common_uninit(struct net_device *dev); extern void cvm_oct_common_uninit(struct net_device *dev);