aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ni5010.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-09-13 13:24:59 -0400
committerJeff Garzik <jeff@garzik.org>2006-09-13 13:24:59 -0400
commit6aa20a2235535605db6d6d2bd850298b2fe7f31e (patch)
treedf0b855043407b831d57f2f2c271f8aab48444f4 /drivers/net/ni5010.c
parent7a291083225af6e22ffaa46b3d91cfc1a1ccaab4 (diff)
drivers/net: Trim trailing whitespace
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/ni5010.c')
-rw-r--r--drivers/net/ni5010.c118
1 files changed, 59 insertions, 59 deletions
diff --git a/drivers/net/ni5010.c b/drivers/net/ni5010.c
index d4be207d321a..383c690eefec 100644
--- a/drivers/net/ni5010.c
+++ b/drivers/net/ni5010.c
@@ -40,7 +40,7 @@
40 * 40 *
41 * Compile with: 41 * Compile with:
42 * gcc -O2 -fomit-frame-pointer -m486 -D__KERNEL__ \ 42 * gcc -O2 -fomit-frame-pointer -m486 -D__KERNEL__ \
43 * -DMODULE -c ni5010.c 43 * -DMODULE -c ni5010.c
44 * 44 *
45 * Insert with e.g.: 45 * Insert with e.g.:
46 * insmod ni5010.ko io=0x300 irq=5 46 * insmod ni5010.ko io=0x300 irq=5
@@ -68,7 +68,7 @@
68static const char boardname[] = "NI5010"; 68static const char boardname[] = "NI5010";
69static char version[] __initdata = 69static char version[] __initdata =
70 "ni5010.c: v1.02 20060611 Jan-Pascal van Best and Andreas Mohr\n"; 70 "ni5010.c: v1.02 20060611 Jan-Pascal van Best and Andreas Mohr\n";
71 71
72/* bufsize_rcv == 0 means autoprobing */ 72/* bufsize_rcv == 0 means autoprobing */
73static unsigned int bufsize_rcv; 73static unsigned int bufsize_rcv;
74 74
@@ -228,7 +228,7 @@ static int __init ni5010_probe1(struct net_device *dev, int ioaddr)
228 * - Andreas 228 * - Andreas
229 */ 229 */
230 230
231 PRINTK2((KERN_DEBUG "%s: entering ni5010_probe1(%#3x)\n", 231 PRINTK2((KERN_DEBUG "%s: entering ni5010_probe1(%#3x)\n",
232 dev->name, ioaddr)); 232 dev->name, ioaddr));
233 233
234 if (inb(ioaddr+0) == 0xff) 234 if (inb(ioaddr+0) == 0xff)
@@ -332,7 +332,7 @@ static int __init ni5010_probe1(struct net_device *dev, int ioaddr)
332 } 332 }
333 printk("-> bufsize rcv/xmt=%d/%d\n", bufsize_rcv, NI5010_BUFSIZE); 333 printk("-> bufsize rcv/xmt=%d/%d\n", bufsize_rcv, NI5010_BUFSIZE);
334 memset(dev->priv, 0, sizeof(struct ni5010_local)); 334 memset(dev->priv, 0, sizeof(struct ni5010_local));
335 335
336 dev->open = ni5010_open; 336 dev->open = ni5010_open;
337 dev->stop = ni5010_close; 337 dev->stop = ni5010_close;
338 dev->hard_start_xmit = ni5010_send_packet; 338 dev->hard_start_xmit = ni5010_send_packet;
@@ -359,7 +359,7 @@ out:
359 return err; 359 return err;
360} 360}
361 361
362/* 362/*
363 * Open/initialize the board. This is called (in the current kernel) 363 * Open/initialize the board. This is called (in the current kernel)
364 * sometime after booting when the 'ifconfig' program is run. 364 * sometime after booting when the 'ifconfig' program is run.
365 * 365 *
@@ -367,14 +367,14 @@ out:
367 * 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
368 * there is a non-reboot way to recover if something goes wrong. 368 * there is a non-reboot way to recover if something goes wrong.
369 */ 369 */
370 370
371static int ni5010_open(struct net_device *dev) 371static int ni5010_open(struct net_device *dev)
372{ 372{
373 int ioaddr = dev->base_addr; 373 int ioaddr = dev->base_addr;
374 int i; 374 int i;
375 375
376 PRINTK2((KERN_DEBUG "%s: entering ni5010_open()\n", dev->name)); 376 PRINTK2((KERN_DEBUG "%s: entering ni5010_open()\n", dev->name));
377 377
378 if (request_irq(dev->irq, &ni5010_interrupt, 0, boardname, dev)) { 378 if (request_irq(dev->irq, &ni5010_interrupt, 0, boardname, dev)) {
379 printk(KERN_WARNING "%s: Cannot get irq %#2x\n", dev->name, dev->irq); 379 printk(KERN_WARNING "%s: Cannot get irq %#2x\n", dev->name, dev->irq);
380 return -EAGAIN; 380 return -EAGAIN;
@@ -404,21 +404,21 @@ static int ni5010_open(struct net_device *dev)
404 for(i = 0;i < 6; i++) { 404 for(i = 0;i < 6; i++) {
405 outb(dev->dev_addr[i], EDLC_ADDR + i); 405 outb(dev->dev_addr[i], EDLC_ADDR + i);
406 } 406 }
407 407
408 PRINTK3((KERN_DEBUG "%s: Initialising ni5010\n", dev->name)); 408 PRINTK3((KERN_DEBUG "%s: Initialising ni5010\n", dev->name));
409 outb(0, EDLC_XMASK); /* No xmit interrupts for now */ 409 outb(0, EDLC_XMASK); /* No xmit interrupts for now */
410 outb(XMD_IG_PAR | XMD_T_MODE | XMD_LBC, EDLC_XMODE); 410 outb(XMD_IG_PAR | XMD_T_MODE | XMD_LBC, EDLC_XMODE);
411 /* Normal packet xmit mode */ 411 /* Normal packet xmit mode */
412 outb(0xff, EDLC_XCLR); /* Clear all pending xmit interrupts */ 412 outb(0xff, EDLC_XCLR); /* Clear all pending xmit interrupts */
413 outb(RMD_BROADCAST, EDLC_RMODE); 413 outb(RMD_BROADCAST, EDLC_RMODE);
414 /* Receive broadcast and normal packets */ 414 /* Receive broadcast and normal packets */
415 reset_receiver(dev); /* Ready ni5010 for receiving packets */ 415 reset_receiver(dev); /* Ready ni5010 for receiving packets */
416 416
417 outb(0, EDLC_RESET); /* Un-reset the ni5010 */ 417 outb(0, EDLC_RESET); /* Un-reset the ni5010 */
418 418
419 netif_start_queue(dev); 419 netif_start_queue(dev);
420 420
421 if (NI5010_DEBUG) ni5010_show_registers(dev); 421 if (NI5010_DEBUG) ni5010_show_registers(dev);
422 422
423 PRINTK((KERN_DEBUG "%s: open successful\n", dev->name)); 423 PRINTK((KERN_DEBUG "%s: open successful\n", dev->name));
424 return 0; 424 return 0;
@@ -427,7 +427,7 @@ static int ni5010_open(struct net_device *dev)
427static void reset_receiver(struct net_device *dev) 427static void reset_receiver(struct net_device *dev)
428{ 428{
429 int ioaddr = dev->base_addr; 429 int ioaddr = dev->base_addr;
430 430
431 PRINTK3((KERN_DEBUG "%s: resetting receiver\n", dev->name)); 431 PRINTK3((KERN_DEBUG "%s: resetting receiver\n", dev->name));
432 outw(0, IE_GP); /* Receive packet at start of buffer */ 432 outw(0, IE_GP); /* Receive packet at start of buffer */
433 outb(0xff, EDLC_RCLR); /* Clear all pending rcv interrupts */ 433 outb(0xff, EDLC_RCLR); /* Clear all pending rcv interrupts */
@@ -453,10 +453,10 @@ static int ni5010_send_packet(struct sk_buff *skb, struct net_device *dev)
453 453
454 PRINTK2((KERN_DEBUG "%s: entering ni5010_send_packet\n", dev->name)); 454 PRINTK2((KERN_DEBUG "%s: entering ni5010_send_packet\n", dev->name));
455 455
456 /* 456 /*
457 * Block sending 457 * Block sending
458 */ 458 */
459 459
460 netif_stop_queue(dev); 460 netif_stop_queue(dev);
461 hardware_send_packet(dev, (unsigned char *)skb->data, skb->len, length-skb->len); 461 hardware_send_packet(dev, (unsigned char *)skb->data, skb->len, length-skb->len);
462 dev->trans_start = jiffies; 462 dev->trans_start = jiffies;
@@ -464,9 +464,9 @@ static int ni5010_send_packet(struct sk_buff *skb, struct net_device *dev)
464 return 0; 464 return 0;
465} 465}
466 466
467/* 467/*
468 * The typical workload of the driver: 468 * The typical workload of the driver:
469 * Handle the network interface interrupts. 469 * Handle the network interface interrupts.
470 */ 470 */
471static irqreturn_t ni5010_interrupt(int irq, void *dev_id, struct pt_regs *regs) 471static irqreturn_t ni5010_interrupt(int irq, void *dev_id, struct pt_regs *regs)
472{ 472{
@@ -479,11 +479,11 @@ static irqreturn_t ni5010_interrupt(int irq, void *dev_id, struct pt_regs *regs)
479 479
480 ioaddr = dev->base_addr; 480 ioaddr = dev->base_addr;
481 lp = netdev_priv(dev); 481 lp = netdev_priv(dev);
482 482
483 spin_lock(&lp->lock); 483 spin_lock(&lp->lock);
484 status = inb(IE_ISTAT); 484 status = inb(IE_ISTAT);
485 PRINTK3((KERN_DEBUG "%s: IE_ISTAT = %#02x\n", dev->name, status)); 485 PRINTK3((KERN_DEBUG "%s: IE_ISTAT = %#02x\n", dev->name, status));
486 486
487 if ((status & IS_R_INT) == 0) ni5010_rx(dev); 487 if ((status & IS_R_INT) == 0) ni5010_rx(dev);
488 488
489 if ((status & IS_X_INT) == 0) { 489 if ((status & IS_X_INT) == 0) {
@@ -495,8 +495,8 @@ static irqreturn_t ni5010_interrupt(int irq, void *dev_id, struct pt_regs *regs)
495 outb(0, IE_DMA_RST); /* Reset DMA int */ 495 outb(0, IE_DMA_RST); /* Reset DMA int */
496 } 496 }
497 497
498 if (!xmit_was_error) 498 if (!xmit_was_error)
499 reset_receiver(dev); 499 reset_receiver(dev);
500 spin_unlock(&lp->lock); 500 spin_unlock(&lp->lock);
501 return IRQ_HANDLED; 501 return IRQ_HANDLED;
502} 502}
@@ -505,7 +505,7 @@ static irqreturn_t ni5010_interrupt(int irq, void *dev_id, struct pt_regs *regs)
505static void dump_packet(void *buf, int len) 505static void dump_packet(void *buf, int len)
506{ 506{
507 int i; 507 int i;
508 508
509 printk(KERN_DEBUG "Packet length = %#4x\n", len); 509 printk(KERN_DEBUG "Packet length = %#4x\n", len);
510 for (i = 0; i < len; i++){ 510 for (i = 0; i < len; i++){
511 if (i % 16 == 0) printk(KERN_DEBUG "%#4.4x", i); 511 if (i % 16 == 0) printk(KERN_DEBUG "%#4.4x", i);
@@ -514,7 +514,7 @@ static void dump_packet(void *buf, int len)
514 if (i % 16 == 15) printk("\n"); 514 if (i % 16 == 15) printk("\n");
515 } 515 }
516 printk("\n"); 516 printk("\n");
517 517
518 return; 518 return;
519} 519}
520 520
@@ -526,12 +526,12 @@ static void ni5010_rx(struct net_device *dev)
526 unsigned char rcv_stat; 526 unsigned char rcv_stat;
527 struct sk_buff *skb; 527 struct sk_buff *skb;
528 int i_pkt_size; 528 int i_pkt_size;
529 529
530 PRINTK2((KERN_DEBUG "%s: entering ni5010_rx()\n", dev->name)); 530 PRINTK2((KERN_DEBUG "%s: entering ni5010_rx()\n", dev->name));
531 531
532 rcv_stat = inb(EDLC_RSTAT); 532 rcv_stat = inb(EDLC_RSTAT);
533 PRINTK3((KERN_DEBUG "%s: EDLC_RSTAT = %#2x\n", dev->name, rcv_stat)); 533 PRINTK3((KERN_DEBUG "%s: EDLC_RSTAT = %#2x\n", dev->name, rcv_stat));
534 534
535 if ( (rcv_stat & RS_VALID_BITS) != RS_PKT_OK) { 535 if ( (rcv_stat & RS_VALID_BITS) != RS_PKT_OK) {
536 PRINTK((KERN_INFO "%s: receive error.\n", dev->name)); 536 PRINTK((KERN_INFO "%s: receive error.\n", dev->name));
537 lp->stats.rx_errors++; 537 lp->stats.rx_errors++;
@@ -542,12 +542,12 @@ static void ni5010_rx(struct net_device *dev)
542 outb(0xff, EDLC_RCLR); /* Clear the interrupt */ 542 outb(0xff, EDLC_RCLR); /* Clear the interrupt */
543 return; 543 return;
544 } 544 }
545 545
546 outb(0xff, EDLC_RCLR); /* Clear the interrupt */ 546 outb(0xff, EDLC_RCLR); /* Clear the interrupt */
547 547
548 i_pkt_size = inw(IE_RCNT); 548 i_pkt_size = inw(IE_RCNT);
549 if (i_pkt_size > ETH_FRAME_LEN || i_pkt_size < 10 ) { 549 if (i_pkt_size > ETH_FRAME_LEN || i_pkt_size < 10 ) {
550 PRINTK((KERN_DEBUG "%s: Packet size error, packet size = %#4.4x\n", 550 PRINTK((KERN_DEBUG "%s: Packet size error, packet size = %#4.4x\n",
551 dev->name, i_pkt_size)); 551 dev->name, i_pkt_size));
552 lp->stats.rx_errors++; 552 lp->stats.rx_errors++;
553 lp->stats.rx_length_errors++; 553 lp->stats.rx_length_errors++;
@@ -561,27 +561,27 @@ static void ni5010_rx(struct net_device *dev)
561 lp->stats.rx_dropped++; 561 lp->stats.rx_dropped++;
562 return; 562 return;
563 } 563 }
564 564
565 skb->dev = dev; 565 skb->dev = dev;
566 skb_reserve(skb, 2); 566 skb_reserve(skb, 2);
567 567
568 /* Read packet into buffer */ 568 /* Read packet into buffer */
569 outb(MM_MUX, IE_MMODE); /* Rcv buffer to system bus */ 569 outb(MM_MUX, IE_MMODE); /* Rcv buffer to system bus */
570 outw(0, IE_GP); /* Seek to beginning of packet */ 570 outw(0, IE_GP); /* Seek to beginning of packet */
571 insb(IE_RBUF, skb_put(skb, i_pkt_size), i_pkt_size); 571 insb(IE_RBUF, skb_put(skb, i_pkt_size), i_pkt_size);
572 572
573 if (NI5010_DEBUG >= 4) 573 if (NI5010_DEBUG >= 4)
574 dump_packet(skb->data, skb->len); 574 dump_packet(skb->data, skb->len);
575 575
576 skb->protocol = eth_type_trans(skb,dev); 576 skb->protocol = eth_type_trans(skb,dev);
577 netif_rx(skb); 577 netif_rx(skb);
578 dev->last_rx = jiffies; 578 dev->last_rx = jiffies;
579 lp->stats.rx_packets++; 579 lp->stats.rx_packets++;
580 lp->stats.rx_bytes += i_pkt_size; 580 lp->stats.rx_bytes += i_pkt_size;
581 581
582 PRINTK2((KERN_DEBUG "%s: Received packet, size=%#4.4x\n", 582 PRINTK2((KERN_DEBUG "%s: Received packet, size=%#4.4x\n",
583 dev->name, i_pkt_size)); 583 dev->name, i_pkt_size));
584 584
585} 585}
586 586
587static int process_xmt_interrupt(struct net_device *dev) 587static int process_xmt_interrupt(struct net_device *dev)
@@ -594,12 +594,12 @@ static int process_xmt_interrupt(struct net_device *dev)
594 594
595 xmit_stat = inb(EDLC_XSTAT); 595 xmit_stat = inb(EDLC_XSTAT);
596 PRINTK3((KERN_DEBUG "%s: EDLC_XSTAT = %2.2x\n", dev->name, xmit_stat)); 596 PRINTK3((KERN_DEBUG "%s: EDLC_XSTAT = %2.2x\n", dev->name, xmit_stat));
597 597
598 outb(0, EDLC_XMASK); /* Disable xmit IRQ's */ 598 outb(0, EDLC_XMASK); /* Disable xmit IRQ's */
599 outb(0xff, EDLC_XCLR); /* Clear all pending xmit IRQ's */ 599 outb(0xff, EDLC_XCLR); /* Clear all pending xmit IRQ's */
600 600
601 if (xmit_stat & XS_COLL){ 601 if (xmit_stat & XS_COLL){
602 PRINTK((KERN_DEBUG "%s: collision detected, retransmitting\n", 602 PRINTK((KERN_DEBUG "%s: collision detected, retransmitting\n",
603 dev->name)); 603 dev->name));
604 outw(NI5010_BUFSIZE - lp->o_pkt_size, IE_GP); 604 outw(NI5010_BUFSIZE - lp->o_pkt_size, IE_GP);
605 /* outb(0, IE_MMODE); */ /* xmt buf on sysbus FIXME: needed ? */ 605 /* outb(0, IE_MMODE); */ /* xmt buf on sysbus FIXME: needed ? */
@@ -614,8 +614,8 @@ static int process_xmt_interrupt(struct net_device *dev)
614 lp->stats.tx_packets++; 614 lp->stats.tx_packets++;
615 lp->stats.tx_bytes += lp->o_pkt_size; 615 lp->stats.tx_bytes += lp->o_pkt_size;
616 netif_wake_queue(dev); 616 netif_wake_queue(dev);
617 617
618 PRINTK2((KERN_DEBUG "%s: sent packet, size=%#4.4x\n", 618 PRINTK2((KERN_DEBUG "%s: sent packet, size=%#4.4x\n",
619 dev->name, lp->o_pkt_size)); 619 dev->name, lp->o_pkt_size));
620 620
621 return 0; 621 return 0;
@@ -635,7 +635,7 @@ static int ni5010_close(struct net_device *dev)
635 outb(RS_RESET, EDLC_RESET); 635 outb(RS_RESET, EDLC_RESET);
636 636
637 netif_stop_queue(dev); 637 netif_stop_queue(dev);
638 638
639 PRINTK((KERN_DEBUG "%s: %s closed down\n", dev->name, boardname)); 639 PRINTK((KERN_DEBUG "%s: %s closed down\n", dev->name, boardname));
640 return 0; 640 return 0;
641 641
@@ -648,9 +648,9 @@ static struct net_device_stats *ni5010_get_stats(struct net_device *dev)
648 struct ni5010_local *lp = netdev_priv(dev); 648 struct ni5010_local *lp = netdev_priv(dev);
649 649
650 PRINTK2((KERN_DEBUG "%s: entering ni5010_get_stats\n", dev->name)); 650 PRINTK2((KERN_DEBUG "%s: entering ni5010_get_stats\n", dev->name));
651 651
652 if (NI5010_DEBUG) ni5010_show_registers(dev); 652 if (NI5010_DEBUG) ni5010_show_registers(dev);
653 653
654 /* cli(); */ 654 /* cli(); */
655 /* Update the statistics from the device registers. */ 655 /* Update the statistics from the device registers. */
656 /* We do this in the interrupt handler */ 656 /* We do this in the interrupt handler */
@@ -667,7 +667,7 @@ static struct net_device_stats *ni5010_get_stats(struct net_device *dev)
667*/ 667*/
668static void ni5010_set_multicast_list(struct net_device *dev) 668static void ni5010_set_multicast_list(struct net_device *dev)
669{ 669{
670 short ioaddr = dev->base_addr; 670 short ioaddr = dev->base_addr;
671 671
672 PRINTK2((KERN_DEBUG "%s: entering set_multicast_list\n", dev->name)); 672 PRINTK2((KERN_DEBUG "%s: entering set_multicast_list\n", dev->name));
673 673
@@ -693,7 +693,7 @@ static void hardware_send_packet(struct net_device *dev, char *buf, int length,
693 unsigned int buf_offs; 693 unsigned int buf_offs;
694 694
695 PRINTK2((KERN_DEBUG "%s: entering hardware_send_packet\n", dev->name)); 695 PRINTK2((KERN_DEBUG "%s: entering hardware_send_packet\n", dev->name));
696 696
697 if (length > ETH_FRAME_LEN) { 697 if (length > ETH_FRAME_LEN) {
698 PRINTK((KERN_WARNING "%s: packet too large, not possible\n", 698 PRINTK((KERN_WARNING "%s: packet too large, not possible\n",
699 dev->name)); 699 dev->name));
@@ -703,11 +703,11 @@ static void hardware_send_packet(struct net_device *dev, char *buf, int length,
703 if (NI5010_DEBUG) ni5010_show_registers(dev); 703 if (NI5010_DEBUG) ni5010_show_registers(dev);
704 704
705 if (inb(IE_ISTAT) & IS_EN_XMT) { 705 if (inb(IE_ISTAT) & IS_EN_XMT) {
706 PRINTK((KERN_WARNING "%s: sending packet while already transmitting, not possible\n", 706 PRINTK((KERN_WARNING "%s: sending packet while already transmitting, not possible\n",
707 dev->name)); 707 dev->name));
708 return; 708 return;
709 } 709 }
710 710
711 if (NI5010_DEBUG > 3) dump_packet(buf, length); 711 if (NI5010_DEBUG > 3) dump_packet(buf, length);
712 712
713 buf_offs = NI5010_BUFSIZE - length - pad; 713 buf_offs = NI5010_BUFSIZE - length - pad;
@@ -723,7 +723,7 @@ static void hardware_send_packet(struct net_device *dev, char *buf, int length,
723 outsb(IE_XBUF, buf, length); /* Put data in buffer */ 723 outsb(IE_XBUF, buf, length); /* Put data in buffer */
724 while(pad--) 724 while(pad--)
725 outb(0, IE_XBUF); 725 outb(0, IE_XBUF);
726 726
727 outw(buf_offs, IE_GP); /* Rewrite where packet starts */ 727 outw(buf_offs, IE_GP); /* Rewrite where packet starts */
728 728
729 /* should work without that outb() (Crynwr used it) */ 729 /* should work without that outb() (Crynwr used it) */
@@ -734,8 +734,8 @@ static void hardware_send_packet(struct net_device *dev, char *buf, int length,
734 spin_unlock_irqrestore(&lp->lock, flags); 734 spin_unlock_irqrestore(&lp->lock, flags);
735 735
736 netif_wake_queue(dev); 736 netif_wake_queue(dev);
737 737
738 if (NI5010_DEBUG) ni5010_show_registers(dev); 738 if (NI5010_DEBUG) ni5010_show_registers(dev);
739} 739}
740 740
741static void chipset_init(struct net_device *dev, int startp) 741static void chipset_init(struct net_device *dev, int startp)
@@ -747,7 +747,7 @@ static void chipset_init(struct net_device *dev, int startp)
747static void ni5010_show_registers(struct net_device *dev) 747static void ni5010_show_registers(struct net_device *dev)
748{ 748{
749 int ioaddr = dev->base_addr; 749 int ioaddr = dev->base_addr;
750 750
751 PRINTK3((KERN_DEBUG "%s: XSTAT %#2.2x\n", dev->name, inb(EDLC_XSTAT))); 751 PRINTK3((KERN_DEBUG "%s: XSTAT %#2.2x\n", dev->name, inb(EDLC_XSTAT)));
752 PRINTK3((KERN_DEBUG "%s: XMASK %#2.2x\n", dev->name, inb(EDLC_XMASK))); 752 PRINTK3((KERN_DEBUG "%s: XMASK %#2.2x\n", dev->name, inb(EDLC_XMASK)));
753 PRINTK3((KERN_DEBUG "%s: RSTAT %#2.2x\n", dev->name, inb(EDLC_RSTAT))); 753 PRINTK3((KERN_DEBUG "%s: RSTAT %#2.2x\n", dev->name, inb(EDLC_RSTAT)));