aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/renesas/sh_eth.c
diff options
context:
space:
mode:
authorSergei Shtylyov <sergei.shtylyov@cogentembedded.com>2013-06-12 16:55:34 -0400
committerDavid S. Miller <davem@davemloft.net>2013-06-12 17:15:44 -0400
commit8f728d7934c77f63e89abcc96b46a7a98416d5c1 (patch)
treef11bb662780beb5f9d6f1b0e1e959f07702c8314 /drivers/net/ethernet/renesas/sh_eth.c
parentc70eba74532a9b54583689fead6e2e8f3a86e1c5 (diff)
sh_eth: split 'sh_eth_netdev_ops'
Commit 9f86134155047720a3685cda21467f68695152d2 (sh_eth: remove SH_ETH_HAS_TSU) removes 'const' from 'sh_eth_netdev_ops' and modifies it in case TSU registers are present. I've originally suggested to Iwamatsu-san to split this structure in two instead and afterwards Dave M. suggested doing the same. Split 'sh_eth_netdev_ops_tsu' from 'sh_eth_netdev_ops', making both 'const', and assigning 'ndev->detdev_ops' depending on the presence of TSU registers. Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/renesas/sh_eth.c')
-rw-r--r--drivers/net/ethernet/renesas/sh_eth.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 43d8490cfe0d..67a9e962f142 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -2486,7 +2486,7 @@ static const u16 *sh_eth_get_register_offset(int register_type)
2486 return reg_offset; 2486 return reg_offset;
2487} 2487}
2488 2488
2489static struct net_device_ops sh_eth_netdev_ops = { 2489static const struct net_device_ops sh_eth_netdev_ops = {
2490 .ndo_open = sh_eth_open, 2490 .ndo_open = sh_eth_open,
2491 .ndo_stop = sh_eth_close, 2491 .ndo_stop = sh_eth_close,
2492 .ndo_start_xmit = sh_eth_start_xmit, 2492 .ndo_start_xmit = sh_eth_start_xmit,
@@ -2498,6 +2498,21 @@ static struct net_device_ops sh_eth_netdev_ops = {
2498 .ndo_change_mtu = eth_change_mtu, 2498 .ndo_change_mtu = eth_change_mtu,
2499}; 2499};
2500 2500
2501static const struct net_device_ops sh_eth_netdev_ops_tsu = {
2502 .ndo_open = sh_eth_open,
2503 .ndo_stop = sh_eth_close,
2504 .ndo_start_xmit = sh_eth_start_xmit,
2505 .ndo_get_stats = sh_eth_get_stats,
2506 .ndo_set_rx_mode = sh_eth_set_multicast_list,
2507 .ndo_vlan_rx_add_vid = sh_eth_vlan_rx_add_vid,
2508 .ndo_vlan_rx_kill_vid = sh_eth_vlan_rx_kill_vid,
2509 .ndo_tx_timeout = sh_eth_tx_timeout,
2510 .ndo_do_ioctl = sh_eth_do_ioctl,
2511 .ndo_validate_addr = eth_validate_addr,
2512 .ndo_set_mac_address = eth_mac_addr,
2513 .ndo_change_mtu = eth_change_mtu,
2514};
2515
2501static int sh_eth_drv_probe(struct platform_device *pdev) 2516static int sh_eth_drv_probe(struct platform_device *pdev)
2502{ 2517{
2503 int ret, devno = 0; 2518 int ret, devno = 0;
@@ -2568,14 +2583,10 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
2568 sh_eth_set_default_cpu_data(mdp->cd); 2583 sh_eth_set_default_cpu_data(mdp->cd);
2569 2584
2570 /* set function */ 2585 /* set function */
2571 if (mdp->cd->tsu) { 2586 if (mdp->cd->tsu)
2572 sh_eth_netdev_ops.ndo_set_rx_mode = sh_eth_set_multicast_list; 2587 ndev->netdev_ops = &sh_eth_netdev_ops_tsu;
2573 sh_eth_netdev_ops.ndo_vlan_rx_add_vid = sh_eth_vlan_rx_add_vid; 2588 else
2574 sh_eth_netdev_ops.ndo_vlan_rx_kill_vid = 2589 ndev->netdev_ops = &sh_eth_netdev_ops;
2575 sh_eth_vlan_rx_kill_vid;
2576 }
2577
2578 ndev->netdev_ops = &sh_eth_netdev_ops;
2579 SET_ETHTOOL_OPS(ndev, &sh_eth_ethtool_ops); 2590 SET_ETHTOOL_OPS(ndev, &sh_eth_ethtool_ops);
2580 ndev->watchdog_timeo = TX_TIMEOUT; 2591 ndev->watchdog_timeo = TX_TIMEOUT;
2581 2592