diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2008-11-20 00:59:54 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-20 01:42:44 -0500 |
commit | 1436b301ec2b184fc01dc29fa22d1fbac619b491 (patch) | |
tree | 3f99df66c5d1e273231368e9c55ceac269a6eeac /drivers/net/sky2.c | |
parent | 651c24669316b955c3c7797bd535cdaa4533cb16 (diff) |
sky2: convert to net_device_ops
Convert to new network device ops interface. Slight additional complexity
here because the second port does not allow netpoll and therefore has
different virtual function table.
Signed-off-by: Stephen Hemminger <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 | 48 |
1 files changed, 35 insertions, 13 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 4dcd1a62fb49..251505125cb8 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -3979,7 +3979,7 @@ static int sky2_device_event(struct notifier_block *unused, | |||
3979 | struct net_device *dev = ptr; | 3979 | struct net_device *dev = ptr; |
3980 | struct sky2_port *sky2 = netdev_priv(dev); | 3980 | struct sky2_port *sky2 = netdev_priv(dev); |
3981 | 3981 | ||
3982 | if (dev->open != sky2_up || !sky2_debug) | 3982 | if (dev->netdev_ops->ndo_open != sky2_up || !sky2_debug) |
3983 | return NOTIFY_DONE; | 3983 | return NOTIFY_DONE; |
3984 | 3984 | ||
3985 | switch(event) { | 3985 | switch(event) { |
@@ -4041,6 +4041,39 @@ static __exit void sky2_debug_cleanup(void) | |||
4041 | #define sky2_debug_cleanup() | 4041 | #define sky2_debug_cleanup() |
4042 | #endif | 4042 | #endif |
4043 | 4043 | ||
4044 | /* Two copies of network device operations to handle special case of | ||
4045 | not allowing netpoll on second port */ | ||
4046 | static const struct net_device_ops sky2_netdev_ops[2] = { | ||
4047 | { | ||
4048 | .ndo_open = sky2_up, | ||
4049 | .ndo_stop = sky2_down, | ||
4050 | .ndo_do_ioctl = sky2_ioctl, | ||
4051 | .ndo_validate_addr = eth_validate_addr, | ||
4052 | .ndo_set_mac_address = sky2_set_mac_address, | ||
4053 | .ndo_set_multicast_list = sky2_set_multicast, | ||
4054 | .ndo_change_mtu = sky2_change_mtu, | ||
4055 | .ndo_tx_timeout = sky2_tx_timeout, | ||
4056 | #ifdef SKY2_VLAN_TAG_USED | ||
4057 | .ndo_vlan_rx_register = sky2_vlan_rx_register, | ||
4058 | #endif | ||
4059 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
4060 | .ndo_poll_controller = sky2_netpoll, | ||
4061 | #endif | ||
4062 | }, | ||
4063 | { | ||
4064 | .ndo_open = sky2_up, | ||
4065 | .ndo_stop = sky2_down, | ||
4066 | .ndo_do_ioctl = sky2_ioctl, | ||
4067 | .ndo_validate_addr = eth_validate_addr, | ||
4068 | .ndo_set_mac_address = sky2_set_mac_address, | ||
4069 | .ndo_set_multicast_list = sky2_set_multicast, | ||
4070 | .ndo_change_mtu = sky2_change_mtu, | ||
4071 | .ndo_tx_timeout = sky2_tx_timeout, | ||
4072 | #ifdef SKY2_VLAN_TAG_USED | ||
4073 | .ndo_vlan_rx_register = sky2_vlan_rx_register, | ||
4074 | #endif | ||
4075 | }, | ||
4076 | }; | ||
4044 | 4077 | ||
4045 | /* Initialize network device */ | 4078 | /* Initialize network device */ |
4046 | static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw, | 4079 | static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw, |
@@ -4057,20 +4090,10 @@ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw, | |||
4057 | 4090 | ||
4058 | SET_NETDEV_DEV(dev, &hw->pdev->dev); | 4091 | SET_NETDEV_DEV(dev, &hw->pdev->dev); |
4059 | dev->irq = hw->pdev->irq; | 4092 | dev->irq = hw->pdev->irq; |
4060 | dev->open = sky2_up; | ||
4061 | dev->stop = sky2_down; | ||
4062 | dev->do_ioctl = sky2_ioctl; | ||
4063 | dev->hard_start_xmit = sky2_xmit_frame; | 4093 | dev->hard_start_xmit = sky2_xmit_frame; |
4064 | dev->set_multicast_list = sky2_set_multicast; | ||
4065 | dev->set_mac_address = sky2_set_mac_address; | ||
4066 | dev->change_mtu = sky2_change_mtu; | ||
4067 | SET_ETHTOOL_OPS(dev, &sky2_ethtool_ops); | 4094 | SET_ETHTOOL_OPS(dev, &sky2_ethtool_ops); |
4068 | dev->tx_timeout = sky2_tx_timeout; | ||
4069 | dev->watchdog_timeo = TX_WATCHDOG; | 4095 | dev->watchdog_timeo = TX_WATCHDOG; |
4070 | #ifdef CONFIG_NET_POLL_CONTROLLER | 4096 | dev->netdev_ops = &sky2_netdev_ops[port]; |
4071 | if (port == 0) | ||
4072 | dev->poll_controller = sky2_netpoll; | ||
4073 | #endif | ||
4074 | 4097 | ||
4075 | sky2 = netdev_priv(dev); | 4098 | sky2 = netdev_priv(dev); |
4076 | sky2->netdev = dev; | 4099 | sky2->netdev = dev; |
@@ -4104,7 +4127,6 @@ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw, | |||
4104 | if (!(sky2->hw->chip_id == CHIP_ID_YUKON_FE_P && | 4127 | if (!(sky2->hw->chip_id == CHIP_ID_YUKON_FE_P && |
4105 | sky2->hw->chip_rev == CHIP_REV_YU_FE2_A0)) { | 4128 | sky2->hw->chip_rev == CHIP_REV_YU_FE2_A0)) { |
4106 | dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; | 4129 | dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; |
4107 | dev->vlan_rx_register = sky2_vlan_rx_register; | ||
4108 | } | 4130 | } |
4109 | #endif | 4131 | #endif |
4110 | 4132 | ||