aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2008-11-21 20:39:02 -0500
committerDavid S. Miller <davem@davemloft.net>2008-11-21 20:39:02 -0500
commit4e4fd4e485ad63a9074ff09a9b53ffc7a5c594ec (patch)
tree4d6b86da5dfd81dcd26081bfeda723a440cad919 /drivers
parent99921b7e64f7726e7134046f8e1e8004e2711f30 (diff)
ne2k: convert to net_device_ops
Convert driver to new net_device_ops. Compile tested only. This required some additional work to export common code ei_XXX. 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/8390.h5
-rw-r--r--drivers/net/lib8390.c26
-rw-r--r--drivers/net/ne2k-pci.c21
3 files changed, 37 insertions, 15 deletions
diff --git a/drivers/net/8390.h b/drivers/net/8390.h
index 8e209f5e7c11..9470998bf634 100644
--- a/drivers/net/8390.h
+++ b/drivers/net/8390.h
@@ -33,6 +33,11 @@ extern void ei_poll(struct net_device *dev);
33extern void eip_poll(struct net_device *dev); 33extern void eip_poll(struct net_device *dev);
34#endif 34#endif
35 35
36extern void ei_tx_timeout(struct net_device *dev);
37extern int ei_start_xmit(struct sk_buff *skb, struct net_device *dev);
38extern void ei_set_multicast_list(struct net_device *dev);
39extern struct net_device_stats *ei_get_stats(struct net_device *dev);
40
36/* Without I/O delay - non ISA or later chips */ 41/* Without I/O delay - non ISA or later chips */
37extern void NS8390_init(struct net_device *dev, int startp); 42extern void NS8390_init(struct net_device *dev, int startp);
38extern int ei_open(struct net_device *dev); 43extern int ei_open(struct net_device *dev);
diff --git a/drivers/net/lib8390.c b/drivers/net/lib8390.c
index 9430167a3b13..46335af12393 100644
--- a/drivers/net/lib8390.c
+++ b/drivers/net/lib8390.c
@@ -108,14 +108,13 @@ int ei_debug = 1;
108/* Index to functions. */ 108/* Index to functions. */
109static void ei_tx_intr(struct net_device *dev); 109static void ei_tx_intr(struct net_device *dev);
110static void ei_tx_err(struct net_device *dev); 110static void ei_tx_err(struct net_device *dev);
111static void ei_tx_timeout(struct net_device *dev); 111void ei_tx_timeout(struct net_device *dev);
112static void ei_receive(struct net_device *dev); 112static void ei_receive(struct net_device *dev);
113static void ei_rx_overrun(struct net_device *dev); 113static void ei_rx_overrun(struct net_device *dev);
114 114
115/* Routines generic to NS8390-based boards. */ 115/* Routines generic to NS8390-based boards. */
116static void NS8390_trigger_send(struct net_device *dev, unsigned int length, 116static void NS8390_trigger_send(struct net_device *dev, unsigned int length,
117 int start_page); 117 int start_page);
118static void set_multicast_list(struct net_device *dev);
119static void do_set_multicast_list(struct net_device *dev); 118static void do_set_multicast_list(struct net_device *dev);
120static void __NS8390_init(struct net_device *dev, int startp); 119static void __NS8390_init(struct net_device *dev, int startp);
121 120
@@ -208,8 +207,10 @@ static int __ei_open(struct net_device *dev)
208 207
209 /* The card I/O part of the driver (e.g. 3c503) can hook a Tx timeout 208 /* The card I/O part of the driver (e.g. 3c503) can hook a Tx timeout
210 wrapper that does e.g. media check & then calls ei_tx_timeout. */ 209 wrapper that does e.g. media check & then calls ei_tx_timeout. */
210#ifdef CONFIG_COMPAT_NET_DEV_OPS
211 if (dev->tx_timeout == NULL) 211 if (dev->tx_timeout == NULL)
212 dev->tx_timeout = ei_tx_timeout; 212 dev->tx_timeout = ei_tx_timeout;
213#endif
213 if (dev->watchdog_timeo <= 0) 214 if (dev->watchdog_timeo <= 0)
214 dev->watchdog_timeo = TX_TIMEOUT; 215 dev->watchdog_timeo = TX_TIMEOUT;
215 216
@@ -258,7 +259,7 @@ static int __ei_close(struct net_device *dev)
258 * completed (or failed) - i.e. never posted a Tx related interrupt. 259 * completed (or failed) - i.e. never posted a Tx related interrupt.
259 */ 260 */
260 261
261static void ei_tx_timeout(struct net_device *dev) 262void ei_tx_timeout(struct net_device *dev)
262{ 263{
263 unsigned long e8390_base = dev->base_addr; 264 unsigned long e8390_base = dev->base_addr;
264 struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev); 265 struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev);
@@ -295,6 +296,7 @@ static void ei_tx_timeout(struct net_device *dev)
295 enable_irq_lockdep(dev->irq); 296 enable_irq_lockdep(dev->irq);
296 netif_wake_queue(dev); 297 netif_wake_queue(dev);
297} 298}
299EXPORT_SYMBOL_GPL(ei_tx_timeout);
298 300
299/** 301/**
300 * ei_start_xmit - begin packet transmission 302 * ei_start_xmit - begin packet transmission
@@ -304,7 +306,7 @@ static void ei_tx_timeout(struct net_device *dev)
304 * Sends a packet to an 8390 network device. 306 * Sends a packet to an 8390 network device.
305 */ 307 */
306 308
307static int ei_start_xmit(struct sk_buff *skb, struct net_device *dev) 309int ei_start_xmit(struct sk_buff *skb, struct net_device *dev)
308{ 310{
309 unsigned long e8390_base = dev->base_addr; 311 unsigned long e8390_base = dev->base_addr;
310 struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev); 312 struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev);
@@ -421,6 +423,7 @@ static int ei_start_xmit(struct sk_buff *skb, struct net_device *dev)
421 423
422 return 0; 424 return 0;
423} 425}
426EXPORT_SYMBOL_GPL(ei_start_xmit);
424 427
425/** 428/**
426 * ei_interrupt - handle the interrupts from an 8390 429 * ei_interrupt - handle the interrupts from an 8390
@@ -882,7 +885,7 @@ static void ei_rx_overrun(struct net_device *dev)
882 * Collect the stats. This is called unlocked and from several contexts. 885 * Collect the stats. This is called unlocked and from several contexts.
883 */ 886 */
884 887
885static struct net_device_stats *get_stats(struct net_device *dev) 888struct net_device_stats *ei_get_stats(struct net_device *dev)
886{ 889{
887 unsigned long ioaddr = dev->base_addr; 890 unsigned long ioaddr = dev->base_addr;
888 struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev); 891 struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev);
@@ -901,6 +904,7 @@ static struct net_device_stats *get_stats(struct net_device *dev)
901 904
902 return &dev->stats; 905 return &dev->stats;
903} 906}
907EXPORT_SYMBOL_GPL(ei_get_stats);
904 908
905/* 909/*
906 * Form the 64 bit 8390 multicast table from the linked list of addresses 910 * Form the 64 bit 8390 multicast table from the linked list of addresses
@@ -991,7 +995,7 @@ static void do_set_multicast_list(struct net_device *dev)
991 * not called too often. Must protect against both bh and irq users 995 * not called too often. Must protect against both bh and irq users
992 */ 996 */
993 997
994static void set_multicast_list(struct net_device *dev) 998void ei_set_multicast_list(struct net_device *dev)
995{ 999{
996 unsigned long flags; 1000 unsigned long flags;
997 struct ei_device *ei_local = (struct ei_device*)netdev_priv(dev); 1001 struct ei_device *ei_local = (struct ei_device*)netdev_priv(dev);
@@ -1000,6 +1004,7 @@ static void set_multicast_list(struct net_device *dev)
1000 do_set_multicast_list(dev); 1004 do_set_multicast_list(dev);
1001 spin_unlock_irqrestore(&ei_local->page_lock, flags); 1005 spin_unlock_irqrestore(&ei_local->page_lock, flags);
1002} 1006}
1007EXPORT_SYMBOL_GPL(ei_set_multicast_list);
1003 1008
1004/** 1009/**
1005 * ethdev_setup - init rest of 8390 device struct 1010 * ethdev_setup - init rest of 8390 device struct
@@ -1015,10 +1020,11 @@ static void ethdev_setup(struct net_device *dev)
1015 if (ei_debug > 1) 1020 if (ei_debug > 1)
1016 printk(version); 1021 printk(version);
1017 1022
1018 dev->hard_start_xmit = &ei_start_xmit; 1023#ifdef CONFIG_COMPAT_NET_DEV_OPS
1019 dev->get_stats = get_stats; 1024 dev->hard_start_xmit = ei_start_xmit;
1020 dev->set_multicast_list = &set_multicast_list; 1025 dev->get_stats = ei_get_stats;
1021 1026 dev->set_multicast_list = ei_set_multicast_list;
1027#endif
1022 ether_setup(dev); 1028 ether_setup(dev);
1023 1029
1024 spin_lock_init(&ei_local->page_lock); 1030 spin_lock_init(&ei_local->page_lock);
diff --git a/drivers/net/ne2k-pci.c b/drivers/net/ne2k-pci.c
index ea22ae268a5d..62f20ba211cb 100644
--- a/drivers/net/ne2k-pci.c
+++ b/drivers/net/ne2k-pci.c
@@ -200,6 +200,19 @@ struct ne2k_pci_card {
200 in the 'dev' and 'ei_status' structures. 200 in the 'dev' and 'ei_status' structures.
201*/ 201*/
202 202
203static const struct net_device_ops ne2k_netdev_ops = {
204 .ndo_open = ne2k_pci_open,
205 .ndo_stop = ne2k_pci_close,
206 .ndo_start_xmit = ei_start_xmit,
207 .ndo_tx_timeout = ei_tx_timeout,
208 .ndo_get_stats = ei_get_stats,
209 .ndo_set_multicast_list = ei_set_multicast_list,
210 .ndo_validate_addr = eth_validate_addr,
211 .ndo_change_mtu = eth_change_mtu,
212#ifdef CONFIG_NET_POLL_CONTROLLER
213 .ndo_poll_controller = ei_poll,
214#endif
215};
203 216
204static int __devinit ne2k_pci_init_one (struct pci_dev *pdev, 217static int __devinit ne2k_pci_init_one (struct pci_dev *pdev,
205 const struct pci_device_id *ent) 218 const struct pci_device_id *ent)
@@ -265,6 +278,8 @@ static int __devinit ne2k_pci_init_one (struct pci_dev *pdev,
265 dev_err(&pdev->dev, "cannot allocate ethernet device\n"); 278 dev_err(&pdev->dev, "cannot allocate ethernet device\n");
266 goto err_out_free_res; 279 goto err_out_free_res;
267 } 280 }
281 dev->netdev_ops = &ne2k_netdev_ops;
282
268 SET_NETDEV_DEV(dev, &pdev->dev); 283 SET_NETDEV_DEV(dev, &pdev->dev);
269 284
270 /* Reset card. Who knows what dain-bramaged state it was left in. */ 285 /* Reset card. Who knows what dain-bramaged state it was left in. */
@@ -353,12 +368,8 @@ static int __devinit ne2k_pci_init_one (struct pci_dev *pdev,
353 ei_status.block_output = &ne2k_pci_block_output; 368 ei_status.block_output = &ne2k_pci_block_output;
354 ei_status.get_8390_hdr = &ne2k_pci_get_8390_hdr; 369 ei_status.get_8390_hdr = &ne2k_pci_get_8390_hdr;
355 ei_status.priv = (unsigned long) pdev; 370 ei_status.priv = (unsigned long) pdev;
356 dev->open = &ne2k_pci_open; 371
357 dev->stop = &ne2k_pci_close;
358 dev->ethtool_ops = &ne2k_pci_ethtool_ops; 372 dev->ethtool_ops = &ne2k_pci_ethtool_ops;
359#ifdef CONFIG_NET_POLL_CONTROLLER
360 dev->poll_controller = ei_poll;
361#endif
362 NS8390_init(dev, 0); 373 NS8390_init(dev, 0);
363 374
364 i = register_netdev(dev); 375 i = register_netdev(dev);