diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2008-11-20 01:01:26 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-20 01:42:44 -0500 |
commit | f80d032b5fe95e3ce89f79210859b7ec799e1ccc (patch) | |
tree | 56438c664a63b91acccacda38c8ab6d5480dbd38 /drivers/net/skge.c | |
parent | 1436b301ec2b184fc01dc29fa22d1fbac619b491 (diff) |
skge: convert to net_device_ops
Convert to new network device ops interface.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/skge.c')
-rw-r--r-- | drivers/net/skge.c | 51 |
1 files changed, 33 insertions, 18 deletions
diff --git a/drivers/net/skge.c b/drivers/net/skge.c index 05f9d50d956a..93c1b1d92962 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c | |||
@@ -104,6 +104,7 @@ static void yukon_get_stats(struct skge_port *skge, u64 *data); | |||
104 | static void yukon_init(struct skge_hw *hw, int port); | 104 | static void yukon_init(struct skge_hw *hw, int port); |
105 | static void genesis_mac_init(struct skge_hw *hw, int port); | 105 | static void genesis_mac_init(struct skge_hw *hw, int port); |
106 | static void genesis_link_up(struct skge_port *skge); | 106 | static void genesis_link_up(struct skge_port *skge); |
107 | static void skge_set_multicast(struct net_device *dev); | ||
107 | 108 | ||
108 | /* Avoid conditionals by using array */ | 109 | /* Avoid conditionals by using array */ |
109 | static const int txqaddr[] = { Q_XA1, Q_XA2 }; | 110 | static const int txqaddr[] = { Q_XA1, Q_XA2 }; |
@@ -2463,7 +2464,7 @@ static void skge_phy_reset(struct skge_port *skge) | |||
2463 | } | 2464 | } |
2464 | spin_unlock_bh(&hw->phy_lock); | 2465 | spin_unlock_bh(&hw->phy_lock); |
2465 | 2466 | ||
2466 | dev->set_multicast_list(dev); | 2467 | skge_set_multicast(dev); |
2467 | } | 2468 | } |
2468 | 2469 | ||
2469 | /* Basic MII support */ | 2470 | /* Basic MII support */ |
@@ -3031,6 +3032,18 @@ static inline int bad_phy_status(const struct skge_hw *hw, u32 status) | |||
3031 | (status & GMR_FS_RX_OK) == 0; | 3032 | (status & GMR_FS_RX_OK) == 0; |
3032 | } | 3033 | } |
3033 | 3034 | ||
3035 | static void skge_set_multicast(struct net_device *dev) | ||
3036 | { | ||
3037 | struct skge_port *skge = netdev_priv(dev); | ||
3038 | struct skge_hw *hw = skge->hw; | ||
3039 | |||
3040 | if (hw->chip_id == CHIP_ID_GENESIS) | ||
3041 | genesis_set_multicast(dev); | ||
3042 | else | ||
3043 | yukon_set_multicast(dev); | ||
3044 | |||
3045 | } | ||
3046 | |||
3034 | 3047 | ||
3035 | /* Get receive buffer from descriptor. | 3048 | /* Get receive buffer from descriptor. |
3036 | * Handles copy of small buffers and reallocation failures | 3049 | * Handles copy of small buffers and reallocation failures |
@@ -3715,7 +3728,7 @@ static int skge_device_event(struct notifier_block *unused, | |||
3715 | struct skge_port *skge; | 3728 | struct skge_port *skge; |
3716 | struct dentry *d; | 3729 | struct dentry *d; |
3717 | 3730 | ||
3718 | if (dev->open != &skge_up || !skge_debug) | 3731 | if (dev->netdev_ops->ndo_open != &skge_up || !skge_debug) |
3719 | goto done; | 3732 | goto done; |
3720 | 3733 | ||
3721 | skge = netdev_priv(dev); | 3734 | skge = netdev_priv(dev); |
@@ -3789,6 +3802,22 @@ static __exit void skge_debug_cleanup(void) | |||
3789 | #define skge_debug_cleanup() | 3802 | #define skge_debug_cleanup() |
3790 | #endif | 3803 | #endif |
3791 | 3804 | ||
3805 | static const struct net_device_ops skge_netdev_ops = { | ||
3806 | .ndo_open = skge_up, | ||
3807 | .ndo_stop = skge_down, | ||
3808 | .ndo_do_ioctl = skge_ioctl, | ||
3809 | .ndo_get_stats = skge_get_stats, | ||
3810 | .ndo_tx_timeout = skge_tx_timeout, | ||
3811 | .ndo_change_mtu = skge_change_mtu, | ||
3812 | .ndo_validate_addr = eth_validate_addr, | ||
3813 | .ndo_set_multicast_list = skge_set_multicast, | ||
3814 | .ndo_set_mac_address = skge_set_mac_address, | ||
3815 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
3816 | .ndo_poll_controller = skge_netpoll, | ||
3817 | #endif | ||
3818 | }; | ||
3819 | |||
3820 | |||
3792 | /* Initialize network device */ | 3821 | /* Initialize network device */ |
3793 | static struct net_device *skge_devinit(struct skge_hw *hw, int port, | 3822 | static struct net_device *skge_devinit(struct skge_hw *hw, int port, |
3794 | int highmem) | 3823 | int highmem) |
@@ -3802,24 +3831,10 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port, | |||
3802 | } | 3831 | } |
3803 | 3832 | ||
3804 | SET_NETDEV_DEV(dev, &hw->pdev->dev); | 3833 | SET_NETDEV_DEV(dev, &hw->pdev->dev); |
3805 | dev->open = skge_up; | ||
3806 | dev->stop = skge_down; | ||
3807 | dev->do_ioctl = skge_ioctl; | ||
3808 | dev->hard_start_xmit = skge_xmit_frame; | 3834 | dev->hard_start_xmit = skge_xmit_frame; |
3809 | dev->get_stats = skge_get_stats; | 3835 | dev->netdev_ops = &skge_netdev_ops; |
3810 | if (hw->chip_id == CHIP_ID_GENESIS) | 3836 | dev->ethtool_ops = &skge_ethtool_ops; |
3811 | dev->set_multicast_list = genesis_set_multicast; | ||
3812 | else | ||
3813 | dev->set_multicast_list = yukon_set_multicast; | ||
3814 | |||
3815 | dev->set_mac_address = skge_set_mac_address; | ||
3816 | dev->change_mtu = skge_change_mtu; | ||
3817 | SET_ETHTOOL_OPS(dev, &skge_ethtool_ops); | ||
3818 | dev->tx_timeout = skge_tx_timeout; | ||
3819 | dev->watchdog_timeo = TX_WATCHDOG; | 3837 | dev->watchdog_timeo = TX_WATCHDOG; |
3820 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
3821 | dev->poll_controller = skge_netpoll; | ||
3822 | #endif | ||
3823 | dev->irq = hw->pdev->irq; | 3838 | dev->irq = hw->pdev->irq; |
3824 | 3839 | ||
3825 | if (highmem) | 3840 | if (highmem) |