diff options
author | Andreas Mohr <andi@rhlx01.fht-esslingen.de> | 2006-06-30 05:25:07 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-07-05 14:08:08 -0400 |
commit | 5b552b16420d11ec59d301494477713ab5cc1f43 (patch) | |
tree | a2b7f571b840dbf1e4f63510d26926e56e036885 /drivers/net | |
parent | 3a10ccebe928691d16a001687552228d32ff7910 (diff) |
[PATCH] NI5010 netcard cleanup
- updated MAINTAINERS entry to new format
- updated Jan-Pascal's (ACKed) and my email address
- driver cleanup/modernization (runtime-, not hardware-tested)
[bunk@stusta.de: build fix]
Signed-off-by: Andreas Mohr <andi@lisas.de>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: Jan-Pascal van Best <jvbest@qv3pluto.leidenuniv.nl>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ni5010.c | 52 |
1 files changed, 24 insertions, 28 deletions
diff --git a/drivers/net/ni5010.c b/drivers/net/ni5010.c index a68bf474f6ed..d4be207d321a 100644 --- a/drivers/net/ni5010.c +++ b/drivers/net/ni5010.c | |||
@@ -1,17 +1,12 @@ | |||
1 | /* ni5010.c: A network driver for the MiCom-Interlan NI5010 ethercard. | 1 | /* ni5010.c: A network driver for the MiCom-Interlan NI5010 ethercard. |
2 | * | 2 | * |
3 | * Copyright 1996,1997 Jan-Pascal van Best and Andreas Mohr. | 3 | * Copyright 1996,1997,2006 Jan-Pascal van Best and Andreas Mohr. |
4 | * | 4 | * |
5 | * This software may be used and distributed according to the terms | 5 | * This software may be used and distributed according to the terms |
6 | * of the GNU General Public License, incorporated herein by reference. | 6 | * of the GNU General Public License, incorporated herein by reference. |
7 | * | 7 | * |
8 | * The authors may be reached as: | 8 | * The authors may be reached as: |
9 | * jvbest@wi.leidenuniv.nl a.mohr@mailto.de | 9 | * janpascal@vanbest.org andi@lisas.de |
10 | * or by snail mail as | ||
11 | * Jan-Pascal van Best Andreas Mohr | ||
12 | * Klikspaanweg 58-4 Stauferstr. 6 | ||
13 | * 2324 LZ Leiden D-71272 Renningen | ||
14 | * The Netherlands Germany | ||
15 | * | 10 | * |
16 | * Sources: | 11 | * Sources: |
17 | * Donald Becker's "skeleton.c" | 12 | * Donald Becker's "skeleton.c" |
@@ -27,8 +22,9 @@ | |||
27 | * 970503 v0.93: Fixed auto-irq failure on warm reboot (JB) | 22 | * 970503 v0.93: Fixed auto-irq failure on warm reboot (JB) |
28 | * 970623 v1.00: First kernel version (AM) | 23 | * 970623 v1.00: First kernel version (AM) |
29 | * 970814 v1.01: Added detection of onboard receive buffer size (AM) | 24 | * 970814 v1.01: Added detection of onboard receive buffer size (AM) |
25 | * 060611 v1.02: slight cleanup: email addresses, driver modernization. | ||
30 | * Bugs: | 26 | * Bugs: |
31 | * - None known... | 27 | * - not SMP-safe (no locking of I/O accesses) |
32 | * - Note that you have to patch ifconfig for the new /proc/net/dev | 28 | * - Note that you have to patch ifconfig for the new /proc/net/dev |
33 | * format. It gives incorrect stats otherwise. | 29 | * format. It gives incorrect stats otherwise. |
34 | * | 30 | * |
@@ -39,7 +35,7 @@ | |||
39 | * Complete merge with Andreas' driver | 35 | * Complete merge with Andreas' driver |
40 | * Implement ring buffers (Is this useful? You can't squeeze | 36 | * Implement ring buffers (Is this useful? You can't squeeze |
41 | * too many packet in a 2k buffer!) | 37 | * too many packet in a 2k buffer!) |
42 | * Implement DMA (Again, is this useful? Some docs says DMA is | 38 | * Implement DMA (Again, is this useful? Some docs say DMA is |
43 | * slower than programmed I/O) | 39 | * slower than programmed I/O) |
44 | * | 40 | * |
45 | * Compile with: | 41 | * Compile with: |
@@ -47,7 +43,7 @@ | |||
47 | * -DMODULE -c ni5010.c | 43 | * -DMODULE -c ni5010.c |
48 | * | 44 | * |
49 | * Insert with e.g.: | 45 | * Insert with e.g.: |
50 | * insmod ni5010.o io=0x300 irq=5 | 46 | * insmod ni5010.ko io=0x300 irq=5 |
51 | */ | 47 | */ |
52 | 48 | ||
53 | #include <linux/module.h> | 49 | #include <linux/module.h> |
@@ -69,15 +65,15 @@ | |||
69 | 65 | ||
70 | #include "ni5010.h" | 66 | #include "ni5010.h" |
71 | 67 | ||
72 | static const char *boardname = "NI5010"; | 68 | static const char boardname[] = "NI5010"; |
73 | static char *version = | 69 | static char version[] __initdata = |
74 | "ni5010.c: v1.00 06/23/97 Jan-Pascal van Best and Andreas Mohr\n"; | 70 | "ni5010.c: v1.02 20060611 Jan-Pascal van Best and Andreas Mohr\n"; |
75 | 71 | ||
76 | /* bufsize_rcv == 0 means autoprobing */ | 72 | /* bufsize_rcv == 0 means autoprobing */ |
77 | static unsigned int bufsize_rcv; | 73 | static unsigned int bufsize_rcv; |
78 | 74 | ||
79 | #define jumpered_interrupts /* IRQ line jumpered on board */ | 75 | #define JUMPERED_INTERRUPTS /* IRQ line jumpered on board */ |
80 | #undef jumpered_dma /* No DMA used */ | 76 | #undef JUMPERED_DMA /* No DMA used */ |
81 | #undef FULL_IODETECT /* Only detect in portlist */ | 77 | #undef FULL_IODETECT /* Only detect in portlist */ |
82 | 78 | ||
83 | #ifndef FULL_IODETECT | 79 | #ifndef FULL_IODETECT |
@@ -281,7 +277,7 @@ static int __init ni5010_probe1(struct net_device *dev, int ioaddr) | |||
281 | 277 | ||
282 | PRINTK2((KERN_DEBUG "%s: I/O #4 passed!\n", dev->name)); | 278 | PRINTK2((KERN_DEBUG "%s: I/O #4 passed!\n", dev->name)); |
283 | 279 | ||
284 | #ifdef jumpered_interrupts | 280 | #ifdef JUMPERED_INTERRUPTS |
285 | if (dev->irq == 0xff) | 281 | if (dev->irq == 0xff) |
286 | ; | 282 | ; |
287 | else if (dev->irq < 2) { | 283 | else if (dev->irq < 2) { |
@@ -305,7 +301,7 @@ static int __init ni5010_probe1(struct net_device *dev, int ioaddr) | |||
305 | } else if (dev->irq == 2) { | 301 | } else if (dev->irq == 2) { |
306 | dev->irq = 9; | 302 | dev->irq = 9; |
307 | } | 303 | } |
308 | #endif /* jumpered_irq */ | 304 | #endif /* JUMPERED_INTERRUPTS */ |
309 | PRINTK2((KERN_DEBUG "%s: I/O #9 passed!\n", dev->name)); | 305 | PRINTK2((KERN_DEBUG "%s: I/O #9 passed!\n", dev->name)); |
310 | 306 | ||
311 | /* DMA is not supported (yet?), so no use detecting it */ | 307 | /* DMA is not supported (yet?), so no use detecting it */ |
@@ -334,7 +330,7 @@ static int __init ni5010_probe1(struct net_device *dev, int ioaddr) | |||
334 | outw(0, IE_GP); /* Point GP at start of packet */ | 330 | outw(0, IE_GP); /* Point GP at start of packet */ |
335 | outb(0, IE_RBUF); /* set buffer byte 0 to 0 again */ | 331 | outb(0, IE_RBUF); /* set buffer byte 0 to 0 again */ |
336 | } | 332 | } |
337 | printk("// bufsize rcv/xmt=%d/%d\n", bufsize_rcv, NI5010_BUFSIZE); | 333 | printk("-> bufsize rcv/xmt=%d/%d\n", bufsize_rcv, NI5010_BUFSIZE); |
338 | memset(dev->priv, 0, sizeof(struct ni5010_local)); | 334 | memset(dev->priv, 0, sizeof(struct ni5010_local)); |
339 | 335 | ||
340 | dev->open = ni5010_open; | 336 | dev->open = ni5010_open; |
@@ -354,11 +350,9 @@ static int __init ni5010_probe1(struct net_device *dev, int ioaddr) | |||
354 | outb(0xff, EDLC_XCLR); /* Kill all pending xmt interrupts */ | 350 | outb(0xff, EDLC_XCLR); /* Kill all pending xmt interrupts */ |
355 | 351 | ||
356 | printk(KERN_INFO "%s: NI5010 found at 0x%x, using IRQ %d", dev->name, ioaddr, dev->irq); | 352 | printk(KERN_INFO "%s: NI5010 found at 0x%x, using IRQ %d", dev->name, ioaddr, dev->irq); |
357 | if (dev->dma) printk(" & DMA %d", dev->dma); | 353 | if (dev->dma) |
354 | printk(" & DMA %d", dev->dma); | ||
358 | printk(".\n"); | 355 | printk(".\n"); |
359 | |||
360 | printk(KERN_INFO "Join the NI5010 driver development team!\n"); | ||
361 | printk(KERN_INFO "Mail to a.mohr@mailto.de or jvbest@wi.leidenuniv.nl\n"); | ||
362 | return 0; | 356 | return 0; |
363 | out: | 357 | out: |
364 | release_region(dev->base_addr, NI5010_IO_EXTENT); | 358 | release_region(dev->base_addr, NI5010_IO_EXTENT); |
@@ -371,7 +365,7 @@ out: | |||
371 | * | 365 | * |
372 | * This routine should set everything up anew at each open, even | 366 | * This routine should set everything up anew at each open, even |
373 | * registers that "should" only need to be set once at boot, so that | 367 | * registers that "should" only need to be set once at boot, so that |
374 | * there is non-reboot way to recover if something goes wrong. | 368 | * there is a non-reboot way to recover if something goes wrong. |
375 | */ | 369 | */ |
376 | 370 | ||
377 | static int ni5010_open(struct net_device *dev) | 371 | static int ni5010_open(struct net_device *dev) |
@@ -390,13 +384,13 @@ static int ni5010_open(struct net_device *dev) | |||
390 | * Always allocate the DMA channel after the IRQ, | 384 | * Always allocate the DMA channel after the IRQ, |
391 | * and clean up on failure. | 385 | * and clean up on failure. |
392 | */ | 386 | */ |
393 | #ifdef jumpered_dma | 387 | #ifdef JUMPERED_DMA |
394 | if (request_dma(dev->dma, cardname)) { | 388 | if (request_dma(dev->dma, cardname)) { |
395 | printk(KERN_WARNING "%s: Cannot get dma %#2x\n", dev->name, dev->dma); | 389 | printk(KERN_WARNING "%s: Cannot get dma %#2x\n", dev->name, dev->dma); |
396 | free_irq(dev->irq, NULL); | 390 | free_irq(dev->irq, NULL); |
397 | return -EAGAIN; | 391 | return -EAGAIN; |
398 | } | 392 | } |
399 | #endif /* jumpered_dma */ | 393 | #endif /* JUMPERED_DMA */ |
400 | 394 | ||
401 | PRINTK3((KERN_DEBUG "%s: passed open() #2\n", dev->name)); | 395 | PRINTK3((KERN_DEBUG "%s: passed open() #2\n", dev->name)); |
402 | /* Reset the hardware here. Don't forget to set the station address. */ | 396 | /* Reset the hardware here. Don't forget to set the station address. */ |
@@ -633,7 +627,7 @@ static int ni5010_close(struct net_device *dev) | |||
633 | int ioaddr = dev->base_addr; | 627 | int ioaddr = dev->base_addr; |
634 | 628 | ||
635 | PRINTK2((KERN_DEBUG "%s: entering ni5010_close\n", dev->name)); | 629 | PRINTK2((KERN_DEBUG "%s: entering ni5010_close\n", dev->name)); |
636 | #ifdef jumpered_interrupts | 630 | #ifdef JUMPERED_INTERRUPTS |
637 | free_irq(dev->irq, NULL); | 631 | free_irq(dev->irq, NULL); |
638 | #endif | 632 | #endif |
639 | /* Put card in held-RESET state */ | 633 | /* Put card in held-RESET state */ |
@@ -771,7 +765,7 @@ module_param(irq, int, 0); | |||
771 | MODULE_PARM_DESC(io, "ni5010 I/O base address"); | 765 | MODULE_PARM_DESC(io, "ni5010 I/O base address"); |
772 | MODULE_PARM_DESC(irq, "ni5010 IRQ number"); | 766 | MODULE_PARM_DESC(irq, "ni5010 IRQ number"); |
773 | 767 | ||
774 | int init_module(void) | 768 | static int __init ni5010_init_module(void) |
775 | { | 769 | { |
776 | PRINTK2((KERN_DEBUG "%s: entering init_module\n", boardname)); | 770 | PRINTK2((KERN_DEBUG "%s: entering init_module\n", boardname)); |
777 | /* | 771 | /* |
@@ -792,13 +786,15 @@ int init_module(void) | |||
792 | return 0; | 786 | return 0; |
793 | } | 787 | } |
794 | 788 | ||
795 | void cleanup_module(void) | 789 | static void __exit ni5010_cleanup_module(void) |
796 | { | 790 | { |
797 | PRINTK2((KERN_DEBUG "%s: entering cleanup_module\n", boardname)); | 791 | PRINTK2((KERN_DEBUG "%s: entering cleanup_module\n", boardname)); |
798 | unregister_netdev(dev_ni5010); | 792 | unregister_netdev(dev_ni5010); |
799 | release_region(dev_ni5010->base_addr, NI5010_IO_EXTENT); | 793 | release_region(dev_ni5010->base_addr, NI5010_IO_EXTENT); |
800 | free_netdev(dev_ni5010); | 794 | free_netdev(dev_ni5010); |
801 | } | 795 | } |
796 | module_init(ni5010_init_module); | ||
797 | module_exit(ni5010_cleanup_module); | ||
802 | #endif /* MODULE */ | 798 | #endif /* MODULE */ |
803 | MODULE_LICENSE("GPL"); | 799 | MODULE_LICENSE("GPL"); |
804 | 800 | ||