diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2009-03-20 15:36:06 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-03-21 22:55:39 -0400 |
commit | 23169a402d6a2d55992e6b7f6157ae04b636545a (patch) | |
tree | e0b2f62e649ecdb701c2cff3213985e14ab28781 /drivers/net/pcmcia | |
parent | 28b1801d5a367adaf3d02605c762a59781d99664 (diff) |
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/net/pcmcia')
-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 @@ | |||
39 | #include <linux/ethtool.h> | 39 | #include <linux/ethtool.h> |
40 | #include <linux/netdevice.h> | 40 | #include <linux/netdevice.h> |
41 | #include <linux/log2.h> | 41 | #include <linux/log2.h> |
42 | #include <linux/etherdevice.h> | ||
42 | #include "../8390.h" | 43 | #include "../8390.h" |
43 | 44 | ||
44 | #include <pcmcia/cs_types.h> | 45 | #include <pcmcia/cs_types.h> |
@@ -233,6 +234,23 @@ static inline pcnet_dev_t *PRIV(struct net_device *dev) | |||
233 | return (pcnet_dev_t *)(p + sizeof(struct ei_device)); | 234 | return (pcnet_dev_t *)(p + sizeof(struct ei_device)); |
234 | } | 235 | } |
235 | 236 | ||
237 | static const struct net_device_ops pcnet_netdev_ops = { | ||
238 | .ndo_open = pcnet_open, | ||
239 | .ndo_stop = pcnet_close, | ||
240 | .ndo_set_config = set_config, | ||
241 | .ndo_start_xmit = ei_start_xmit, | ||
242 | .ndo_get_stats = ei_get_stats, | ||
243 | .ndo_do_ioctl = ei_ioctl, | ||
244 | .ndo_set_multicast_list = ei_set_multicast_list, | ||
245 | .ndo_tx_timeout = ei_tx_timeout, | ||
246 | .ndo_change_mtu = eth_change_mtu, | ||
247 | .ndo_set_mac_address = eth_mac_addr, | ||
248 | .ndo_validate_addr = eth_validate_addr, | ||
249 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
250 | .ndo_poll_controller = ei_poll, | ||
251 | #endif | ||
252 | }; | ||
253 | |||
236 | /*====================================================================== | 254 | /*====================================================================== |
237 | 255 | ||
238 | pcnet_attach() creates an "instance" of the driver, allocating | 256 | pcnet_attach() creates an "instance" of the driver, allocating |
@@ -260,9 +278,7 @@ static int pcnet_probe(struct pcmcia_device *link) | |||
260 | link->conf.Attributes = CONF_ENABLE_IRQ; | 278 | link->conf.Attributes = CONF_ENABLE_IRQ; |
261 | link->conf.IntType = INT_MEMORY_AND_IO; | 279 | link->conf.IntType = INT_MEMORY_AND_IO; |
262 | 280 | ||
263 | dev->open = &pcnet_open; | 281 | dev->netdev_ops = &pcnet_netdev_ops; |
264 | dev->stop = &pcnet_close; | ||
265 | dev->set_config = &set_config; | ||
266 | 282 | ||
267 | return pcnet_config(link); | 283 | return pcnet_config(link); |
268 | } /* pcnet_attach */ | 284 | } /* pcnet_attach */ |
@@ -640,18 +656,12 @@ static int pcnet_config(struct pcmcia_device *link) | |||
640 | 656 | ||
641 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); | 657 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); |
642 | 658 | ||
643 | if (info->flags & (IS_DL10019|IS_DL10022)) { | 659 | if (info->flags & (IS_DL10019|IS_DL10022)) |
644 | dev->do_ioctl = &ei_ioctl; | ||
645 | mii_phy_probe(dev); | 660 | mii_phy_probe(dev); |
646 | } | ||
647 | 661 | ||
648 | link->dev_node = &info->node; | 662 | link->dev_node = &info->node; |
649 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 663 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); |
650 | 664 | ||
651 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
652 | dev->poll_controller = ei_poll; | ||
653 | #endif | ||
654 | |||
655 | if (register_netdev(dev) != 0) { | 665 | if (register_netdev(dev) != 0) { |
656 | printk(KERN_NOTICE "pcnet_cs: register_netdev() failed\n"); | 666 | printk(KERN_NOTICE "pcnet_cs: register_netdev() failed\n"); |
657 | link->dev_node = NULL; | 667 | link->dev_node = NULL; |
@@ -1183,6 +1193,10 @@ static int ei_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
1183 | pcnet_dev_t *info = PRIV(dev); | 1193 | pcnet_dev_t *info = PRIV(dev); |
1184 | u16 *data = (u16 *)&rq->ifr_ifru; | 1194 | u16 *data = (u16 *)&rq->ifr_ifru; |
1185 | unsigned int mii_addr = dev->base_addr + DLINK_GPIO; | 1195 | unsigned int mii_addr = dev->base_addr + DLINK_GPIO; |
1196 | |||
1197 | if (!(info->flags & (IS_DL10019|IS_DL10022))) | ||
1198 | return -EINVAL; | ||
1199 | |||
1186 | switch (cmd) { | 1200 | switch (cmd) { |
1187 | case SIOCGMIIPHY: | 1201 | case SIOCGMIIPHY: |
1188 | data[0] = info->phy_id; | 1202 | data[0] = info->phy_id; |