diff options
author | Jeff Garzik <jeff@garzik.org> | 2006-09-13 13:24:59 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-09-13 13:24:59 -0400 |
commit | 6aa20a2235535605db6d6d2bd850298b2fe7f31e (patch) | |
tree | df0b855043407b831d57f2f2c271f8aab48444f4 /drivers/net/sun3lance.c | |
parent | 7a291083225af6e22ffaa46b3d91cfc1a1ccaab4 (diff) |
drivers/net: Trim trailing whitespace
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/sun3lance.c')
-rw-r--r-- | drivers/net/sun3lance.c | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/drivers/net/sun3lance.c b/drivers/net/sun3lance.c index 0d76e2214762..61a832ce7ccf 100644 --- a/drivers/net/sun3lance.c +++ b/drivers/net/sun3lance.c | |||
@@ -1,24 +1,24 @@ | |||
1 | /* sun3lance.c: Ethernet driver for SUN3 Lance chip */ | 1 | /* sun3lance.c: Ethernet driver for SUN3 Lance chip */ |
2 | /* | 2 | /* |
3 | 3 | ||
4 | Sun3 Lance ethernet driver, by Sam Creasey (sammy@users.qual.net). | 4 | Sun3 Lance ethernet driver, by Sam Creasey (sammy@users.qual.net). |
5 | This driver is a part of the linux kernel, and is thus distributed | 5 | This driver is a part of the linux kernel, and is thus distributed |
6 | under the GNU General Public License. | 6 | under the GNU General Public License. |
7 | 7 | ||
8 | The values used in LANCE_OBIO and LANCE_IRQ seem to be empirically | 8 | The values used in LANCE_OBIO and LANCE_IRQ seem to be empirically |
9 | true for the correct IRQ and address of the lance registers. They | 9 | true for the correct IRQ and address of the lance registers. They |
10 | have not been widely tested, however. What we probably need is a | 10 | have not been widely tested, however. What we probably need is a |
11 | "proper" way to search for a device in the sun3's prom, but, alas, | 11 | "proper" way to search for a device in the sun3's prom, but, alas, |
12 | linux has no such thing. | 12 | linux has no such thing. |
13 | 13 | ||
14 | This driver is largely based on atarilance.c, by Roman Hodek. Other | 14 | This driver is largely based on atarilance.c, by Roman Hodek. Other |
15 | sources of inspiration were the NetBSD sun3 am7990 driver, and the | 15 | sources of inspiration were the NetBSD sun3 am7990 driver, and the |
16 | linux sparc lance driver (sunlance.c). | 16 | linux sparc lance driver (sunlance.c). |
17 | 17 | ||
18 | There are more assumptions made throughout this driver, it almost | 18 | There are more assumptions made throughout this driver, it almost |
19 | certainly still needs work, but it does work at least for RARP/BOOTP and | 19 | certainly still needs work, but it does work at least for RARP/BOOTP and |
20 | mounting the root NFS filesystem. | 20 | mounting the root NFS filesystem. |
21 | 21 | ||
22 | */ | 22 | */ |
23 | 23 | ||
24 | static char *version = "sun3lance.c: v1.2 1/12/2001 Sam Creasey (sammy@sammy.net)\n"; | 24 | static char *version = "sun3lance.c: v1.2 1/12/2001 Sam Creasey (sammy@sammy.net)\n"; |
@@ -294,9 +294,9 @@ out: | |||
294 | } | 294 | } |
295 | 295 | ||
296 | static int __init lance_probe( struct net_device *dev) | 296 | static int __init lance_probe( struct net_device *dev) |
297 | { | 297 | { |
298 | unsigned long ioaddr; | 298 | unsigned long ioaddr; |
299 | 299 | ||
300 | struct lance_private *lp; | 300 | struct lance_private *lp; |
301 | int i; | 301 | int i; |
302 | static int did_version; | 302 | static int did_version; |
@@ -313,7 +313,7 @@ static int __init lance_probe( struct net_device *dev) | |||
313 | 313 | ||
314 | /* test to see if there's really a lance here */ | 314 | /* test to see if there's really a lance here */ |
315 | /* (CSRO_INIT shouldn't be readable) */ | 315 | /* (CSRO_INIT shouldn't be readable) */ |
316 | 316 | ||
317 | ioaddr_probe = (volatile unsigned short *)ioaddr; | 317 | ioaddr_probe = (volatile unsigned short *)ioaddr; |
318 | tmp1 = ioaddr_probe[0]; | 318 | tmp1 = ioaddr_probe[0]; |
319 | tmp2 = ioaddr_probe[1]; | 319 | tmp2 = ioaddr_probe[1]; |
@@ -339,7 +339,7 @@ static int __init lance_probe( struct net_device *dev) | |||
339 | lp->iobase = (volatile unsigned short *)ioaddr; | 339 | lp->iobase = (volatile unsigned short *)ioaddr; |
340 | dev->base_addr = (unsigned long)ioaddr; /* informational only */ | 340 | dev->base_addr = (unsigned long)ioaddr; /* informational only */ |
341 | 341 | ||
342 | REGA(CSR0) = CSR0_STOP; | 342 | REGA(CSR0) = CSR0_STOP; |
343 | 343 | ||
344 | request_irq(LANCE_IRQ, lance_interrupt, IRQF_DISABLED, "SUN3 Lance", dev); | 344 | request_irq(LANCE_IRQ, lance_interrupt, IRQF_DISABLED, "SUN3 Lance", dev); |
345 | dev->irq = (unsigned short)LANCE_IRQ; | 345 | dev->irq = (unsigned short)LANCE_IRQ; |
@@ -378,7 +378,7 @@ static int __init lance_probe( struct net_device *dev) | |||
378 | 378 | ||
379 | DPRINTK(2, ("initaddr: %08lx rx_ring: %08lx tx_ring: %08lx\n", | 379 | DPRINTK(2, ("initaddr: %08lx rx_ring: %08lx tx_ring: %08lx\n", |
380 | dvma_vtob(&(MEM->init)), dvma_vtob(MEM->rx_head), | 380 | dvma_vtob(&(MEM->init)), dvma_vtob(MEM->rx_head), |
381 | (dvma_vtob(MEM->tx_head)))); | 381 | (dvma_vtob(MEM->tx_head)))); |
382 | 382 | ||
383 | if (did_version++ == 0) | 383 | if (did_version++ == 0) |
384 | printk( version ); | 384 | printk( version ); |
@@ -427,7 +427,7 @@ static int lance_open( struct net_device *dev ) | |||
427 | DREG = CSR0_IDON | CSR0_STRT | CSR0_INEA; | 427 | DREG = CSR0_IDON | CSR0_STRT | CSR0_INEA; |
428 | 428 | ||
429 | netif_start_queue(dev); | 429 | netif_start_queue(dev); |
430 | 430 | ||
431 | DPRINTK( 2, ( "%s: LANCE is open, csr0 %04x\n", dev->name, DREG )); | 431 | DPRINTK( 2, ( "%s: LANCE is open, csr0 %04x\n", dev->name, DREG )); |
432 | 432 | ||
433 | return( 0 ); | 433 | return( 0 ); |
@@ -449,7 +449,7 @@ static void lance_init_ring( struct net_device *dev ) | |||
449 | for( i = 0; i < TX_RING_SIZE; i++ ) { | 449 | for( i = 0; i < TX_RING_SIZE; i++ ) { |
450 | MEM->tx_head[i].base = dvma_vtob(MEM->tx_data[i]); | 450 | MEM->tx_head[i].base = dvma_vtob(MEM->tx_data[i]); |
451 | MEM->tx_head[i].flag = 0; | 451 | MEM->tx_head[i].flag = 0; |
452 | MEM->tx_head[i].base_hi = | 452 | MEM->tx_head[i].base_hi = |
453 | (dvma_vtob(MEM->tx_data[i])) >>16; | 453 | (dvma_vtob(MEM->tx_data[i])) >>16; |
454 | MEM->tx_head[i].length = 0; | 454 | MEM->tx_head[i].length = 0; |
455 | MEM->tx_head[i].misc = 0; | 455 | MEM->tx_head[i].misc = 0; |
@@ -458,7 +458,7 @@ static void lance_init_ring( struct net_device *dev ) | |||
458 | for( i = 0; i < RX_RING_SIZE; i++ ) { | 458 | for( i = 0; i < RX_RING_SIZE; i++ ) { |
459 | MEM->rx_head[i].base = dvma_vtob(MEM->rx_data[i]); | 459 | MEM->rx_head[i].base = dvma_vtob(MEM->rx_data[i]); |
460 | MEM->rx_head[i].flag = RMD1_OWN_CHIP; | 460 | MEM->rx_head[i].flag = RMD1_OWN_CHIP; |
461 | MEM->rx_head[i].base_hi = | 461 | MEM->rx_head[i].base_hi = |
462 | (dvma_vtob(MEM->rx_data[i])) >> 16; | 462 | (dvma_vtob(MEM->rx_data[i])) >> 16; |
463 | MEM->rx_head[i].buf_length = -PKT_BUF_SZ | 0xf000; | 463 | MEM->rx_head[i].buf_length = -PKT_BUF_SZ | 0xf000; |
464 | MEM->rx_head[i].msg_length = 0; | 464 | MEM->rx_head[i].msg_length = 0; |
@@ -542,22 +542,22 @@ static int lance_start_xmit( struct sk_buff *skb, struct net_device *dev ) | |||
542 | 542 | ||
543 | lance_init_ring(dev); | 543 | lance_init_ring(dev); |
544 | REGA( CSR0 ) = CSR0_INEA | CSR0_INIT | CSR0_STRT; | 544 | REGA( CSR0 ) = CSR0_INEA | CSR0_INIT | CSR0_STRT; |
545 | 545 | ||
546 | netif_start_queue(dev); | 546 | netif_start_queue(dev); |
547 | dev->trans_start = jiffies; | 547 | dev->trans_start = jiffies; |
548 | 548 | ||
549 | return 0; | 549 | return 0; |
550 | } | 550 | } |
551 | 551 | ||
552 | 552 | ||
553 | /* Block a timer-based transmit from overlapping. This could better be | 553 | /* Block a timer-based transmit from overlapping. This could better be |
554 | done with atomic_swap(1, dev->tbusy), but set_bit() works as well. */ | 554 | done with atomic_swap(1, dev->tbusy), but set_bit() works as well. */ |
555 | 555 | ||
556 | /* Block a timer-based transmit from overlapping with us by | 556 | /* Block a timer-based transmit from overlapping with us by |
557 | stopping the queue for a bit... */ | 557 | stopping the queue for a bit... */ |
558 | 558 | ||
559 | netif_stop_queue(dev); | 559 | netif_stop_queue(dev); |
560 | 560 | ||
561 | if (test_and_set_bit( 0, (void*)&lp->lock ) != 0) { | 561 | if (test_and_set_bit( 0, (void*)&lp->lock ) != 0) { |
562 | printk( "%s: tx queue lock!.\n", dev->name); | 562 | printk( "%s: tx queue lock!.\n", dev->name); |
563 | /* don't clear dev->tbusy flag. */ | 563 | /* don't clear dev->tbusy flag. */ |
@@ -593,7 +593,7 @@ static int lance_start_xmit( struct sk_buff *skb, struct net_device *dev ) | |||
593 | printk(" data at 0x%08x len %d\n", (int)skb->data, | 593 | printk(" data at 0x%08x len %d\n", (int)skb->data, |
594 | (int)skb->len ); | 594 | (int)skb->len ); |
595 | } | 595 | } |
596 | #endif | 596 | #endif |
597 | /* We're not prepared for the int until the last flags are set/reset. | 597 | /* We're not prepared for the int until the last flags are set/reset. |
598 | * And the int may happen already after setting the OWN_CHIP... */ | 598 | * And the int may happen already after setting the OWN_CHIP... */ |
599 | local_irq_save(flags); | 599 | local_irq_save(flags); |
@@ -632,7 +632,7 @@ static int lance_start_xmit( struct sk_buff *skb, struct net_device *dev ) | |||
632 | 632 | ||
633 | lp->lock = 0; | 633 | lp->lock = 0; |
634 | if ((MEM->tx_head[(entry+1) & TX_RING_MOD_MASK].flag & TMD1_OWN) == | 634 | if ((MEM->tx_head[(entry+1) & TX_RING_MOD_MASK].flag & TMD1_OWN) == |
635 | TMD1_OWN_HOST) | 635 | TMD1_OWN_HOST) |
636 | netif_start_queue(dev); | 636 | netif_start_queue(dev); |
637 | 637 | ||
638 | local_irq_restore(flags); | 638 | local_irq_restore(flags); |
@@ -657,10 +657,10 @@ static irqreturn_t lance_interrupt( int irq, void *dev_id, struct pt_regs *fp) | |||
657 | if (in_interrupt) | 657 | if (in_interrupt) |
658 | DPRINTK( 2, ( "%s: Re-entering the interrupt handler.\n", dev->name )); | 658 | DPRINTK( 2, ( "%s: Re-entering the interrupt handler.\n", dev->name )); |
659 | in_interrupt = 1; | 659 | in_interrupt = 1; |
660 | 660 | ||
661 | still_more: | 661 | still_more: |
662 | flush_cache_all(); | 662 | flush_cache_all(); |
663 | 663 | ||
664 | AREG = CSR0; | 664 | AREG = CSR0; |
665 | csr0 = DREG; | 665 | csr0 = DREG; |
666 | 666 | ||
@@ -680,22 +680,22 @@ static irqreturn_t lance_interrupt( int irq, void *dev_id, struct pt_regs *fp) | |||
680 | 680 | ||
681 | // if(lance_debug >= 3) { | 681 | // if(lance_debug >= 3) { |
682 | // int i; | 682 | // int i; |
683 | // | 683 | // |
684 | // printk("%s: tx int\n", dev->name); | 684 | // printk("%s: tx int\n", dev->name); |
685 | // | 685 | // |
686 | // for(i = 0; i < TX_RING_SIZE; i++) | 686 | // for(i = 0; i < TX_RING_SIZE; i++) |
687 | // printk("ring %d flag=%04x\n", i, | 687 | // printk("ring %d flag=%04x\n", i, |
688 | // MEM->tx_head[i].flag); | 688 | // MEM->tx_head[i].flag); |
689 | // } | 689 | // } |
690 | 690 | ||
691 | while( old_tx != lp->new_tx) { | 691 | while( old_tx != lp->new_tx) { |
692 | struct lance_tx_head *head = &(MEM->tx_head[old_tx]); | 692 | struct lance_tx_head *head = &(MEM->tx_head[old_tx]); |
693 | 693 | ||
694 | DPRINTK(3, ("on tx_ring %d\n", old_tx)); | 694 | DPRINTK(3, ("on tx_ring %d\n", old_tx)); |
695 | 695 | ||
696 | if (head->flag & TMD1_OWN_CHIP) | 696 | if (head->flag & TMD1_OWN_CHIP) |
697 | break; /* It still hasn't been Txed */ | 697 | break; /* It still hasn't been Txed */ |
698 | 698 | ||
699 | if (head->flag & TMD1_ERR) { | 699 | if (head->flag & TMD1_ERR) { |
700 | int status = head->misc; | 700 | int status = head->misc; |
701 | lp->stats.tx_errors++; | 701 | lp->stats.tx_errors++; |
@@ -705,7 +705,7 @@ static irqreturn_t lance_interrupt( int irq, void *dev_id, struct pt_regs *fp) | |||
705 | if (status & (TMD3_UFLO | TMD3_BUFF)) { | 705 | if (status & (TMD3_UFLO | TMD3_BUFF)) { |
706 | lp->stats.tx_fifo_errors++; | 706 | lp->stats.tx_fifo_errors++; |
707 | printk("%s: Tx FIFO error\n", | 707 | printk("%s: Tx FIFO error\n", |
708 | dev->name); | 708 | dev->name); |
709 | REGA(CSR0) = CSR0_STOP; | 709 | REGA(CSR0) = CSR0_STOP; |
710 | REGA(CSR3) = CSR3_BSWP; | 710 | REGA(CSR3) = CSR3_BSWP; |
711 | lance_init_ring(dev); | 711 | lance_init_ring(dev); |
@@ -713,11 +713,11 @@ static irqreturn_t lance_interrupt( int irq, void *dev_id, struct pt_regs *fp) | |||
713 | return IRQ_HANDLED; | 713 | return IRQ_HANDLED; |
714 | } | 714 | } |
715 | } else if(head->flag & (TMD1_ENP | TMD1_STP)) { | 715 | } else if(head->flag & (TMD1_ENP | TMD1_STP)) { |
716 | 716 | ||
717 | head->flag &= ~(TMD1_ENP | TMD1_STP); | 717 | head->flag &= ~(TMD1_ENP | TMD1_STP); |
718 | if(head->flag & (TMD1_ONE | TMD1_MORE)) | 718 | if(head->flag & (TMD1_ONE | TMD1_MORE)) |
719 | lp->stats.collisions++; | 719 | lp->stats.collisions++; |
720 | 720 | ||
721 | lp->stats.tx_packets++; | 721 | lp->stats.tx_packets++; |
722 | DPRINTK(3, ("cleared tx ring %d\n", old_tx)); | 722 | DPRINTK(3, ("cleared tx ring %d\n", old_tx)); |
723 | } | 723 | } |
@@ -736,7 +736,7 @@ static irqreturn_t lance_interrupt( int irq, void *dev_id, struct pt_regs *fp) | |||
736 | 736 | ||
737 | if (csr0 & CSR0_RINT) /* Rx interrupt */ | 737 | if (csr0 & CSR0_RINT) /* Rx interrupt */ |
738 | lance_rx( dev ); | 738 | lance_rx( dev ); |
739 | 739 | ||
740 | /* Log misc errors. */ | 740 | /* Log misc errors. */ |
741 | if (csr0 & CSR0_BABL) lp->stats.tx_errors++; /* Tx babble. */ | 741 | if (csr0 & CSR0_BABL) lp->stats.tx_errors++; /* Tx babble. */ |
742 | if (csr0 & CSR0_MISS) lp->stats.rx_errors++; /* Missed a Rx frame. */ | 742 | if (csr0 & CSR0_MISS) lp->stats.rx_errors++; /* Missed a Rx frame. */ |
@@ -778,10 +778,10 @@ static int lance_rx( struct net_device *dev ) | |||
778 | while( (MEM->rx_head[entry].flag & RMD1_OWN) == RMD1_OWN_HOST ) { | 778 | while( (MEM->rx_head[entry].flag & RMD1_OWN) == RMD1_OWN_HOST ) { |
779 | struct lance_rx_head *head = &(MEM->rx_head[entry]); | 779 | struct lance_rx_head *head = &(MEM->rx_head[entry]); |
780 | int status = head->flag; | 780 | int status = head->flag; |
781 | 781 | ||
782 | if (status != (RMD1_ENP|RMD1_STP)) { /* There was an error. */ | 782 | if (status != (RMD1_ENP|RMD1_STP)) { /* There was an error. */ |
783 | /* There is a tricky error noted by John Murphy, | 783 | /* There is a tricky error noted by John Murphy, |
784 | <murf@perftech.com> to Russ Nelson: Even with | 784 | <murf@perftech.com> to Russ Nelson: Even with |
785 | full-sized buffers it's possible for a jabber packet to use two | 785 | full-sized buffers it's possible for a jabber packet to use two |
786 | buffers, with only the last correctly noting the error. */ | 786 | buffers, with only the last correctly noting the error. */ |
787 | if (status & RMD1_ENP) /* Only count a general error at the */ | 787 | if (status & RMD1_ENP) /* Only count a general error at the */ |
@@ -806,7 +806,7 @@ static int lance_rx( struct net_device *dev ) | |||
806 | if (skb == NULL) { | 806 | if (skb == NULL) { |
807 | DPRINTK( 1, ( "%s: Memory squeeze, deferring packet.\n", | 807 | DPRINTK( 1, ( "%s: Memory squeeze, deferring packet.\n", |
808 | dev->name )); | 808 | dev->name )); |
809 | 809 | ||
810 | lp->stats.rx_dropped++; | 810 | lp->stats.rx_dropped++; |
811 | head->msg_length = 0; | 811 | head->msg_length = 0; |
812 | head->flag |= RMD1_OWN_CHIP; | 812 | head->flag |= RMD1_OWN_CHIP; |
@@ -833,7 +833,7 @@ static int lance_rx( struct net_device *dev ) | |||
833 | if (lance_debug >= 3) { | 833 | if (lance_debug >= 3) { |
834 | u_char *data = PKTBUF_ADDR(head); | 834 | u_char *data = PKTBUF_ADDR(head); |
835 | printk( "%s: RX pkt %d type 0x%04x len %d\n ", dev->name, entry, ((u_short *)data)[6], pkt_len); | 835 | printk( "%s: RX pkt %d type 0x%04x len %d\n ", dev->name, entry, ((u_short *)data)[6], pkt_len); |
836 | } | 836 | } |
837 | 837 | ||
838 | 838 | ||
839 | skb->dev = dev; | 839 | skb->dev = dev; |