[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>

authored by Andreas Mohr and committed by Jeff Garzik 5b552b16 3a10cceb

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