diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2009-03-20 19:36:06 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-03-21 19:55:39 -0700 |
commit | 23169a402d6a2d55992e6b7f6157ae04b636545a (patch) | |
tree | e0b2f62e649ecdb701c2cff3213985e14ab28781 /drivers | |
parent | 28b1801d5a367adaf3d02605c762a59781d99664 (diff) | |
download | blackbird-op-linux-23169a402d6a2d55992e6b7f6157ae04b636545a.tar.gz blackbird-op-linux-23169a402d6a2d55992e6b7f6157ae04b636545a.zip |
pcnet: convert driver to net_device_ops
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/pcmcia/pcnet_cs.c | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index a6999403f37b..2fbf9f9ddd37 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c @@ -39,6 +39,7 @@ #include <linux/ethtool.h> #include <linux/netdevice.h> #include <linux/log2.h> +#include <linux/etherdevice.h> #include "../8390.h" #include <pcmcia/cs_types.h> @@ -233,6 +234,23 @@ static inline pcnet_dev_t *PRIV(struct net_device *dev) return (pcnet_dev_t *)(p + sizeof(struct ei_device)); } +static const struct net_device_ops pcnet_netdev_ops = { + .ndo_open = pcnet_open, + .ndo_stop = pcnet_close, + .ndo_set_config = set_config, + .ndo_start_xmit = ei_start_xmit, + .ndo_get_stats = ei_get_stats, + .ndo_do_ioctl = ei_ioctl, + .ndo_set_multicast_list = ei_set_multicast_list, + .ndo_tx_timeout = ei_tx_timeout, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +#ifdef CONFIG_NET_POLL_CONTROLLER + .ndo_poll_controller = ei_poll, +#endif +}; + /*====================================================================== pcnet_attach() creates an "instance" of the driver, allocating @@ -260,9 +278,7 @@ static int pcnet_probe(struct pcmcia_device *link) link->conf.Attributes = CONF_ENABLE_IRQ; link->conf.IntType = INT_MEMORY_AND_IO; - dev->open = &pcnet_open; - dev->stop = &pcnet_close; - dev->set_config = &set_config; + dev->netdev_ops = &pcnet_netdev_ops; return pcnet_config(link); } /* pcnet_attach */ @@ -640,18 +656,12 @@ static int pcnet_config(struct pcmcia_device *link) SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); - if (info->flags & (IS_DL10019|IS_DL10022)) { - dev->do_ioctl = &ei_ioctl; + if (info->flags & (IS_DL10019|IS_DL10022)) mii_phy_probe(dev); - } link->dev_node = &info->node; SET_NETDEV_DEV(dev, &handle_to_dev(link)); -#ifdef CONFIG_NET_POLL_CONTROLLER - dev->poll_controller = ei_poll; -#endif - if (register_netdev(dev) != 0) { printk(KERN_NOTICE "pcnet_cs: register_netdev() failed\n"); link->dev_node = NULL; @@ -1183,6 +1193,10 @@ static int ei_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) pcnet_dev_t *info = PRIV(dev); u16 *data = (u16 *)&rq->ifr_ifru; unsigned int mii_addr = dev->base_addr + DLINK_GPIO; + + if (!(info->flags & (IS_DL10019|IS_DL10022))) + return -EINVAL; + switch (cmd) { case SIOCGMIIPHY: data[0] = info->phy_id; |