aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2011-06-22 16:38:56 -0400
committerDavid S. Miller <davem@davemloft.net>2011-06-24 20:31:36 -0400
commit7340c4db810f3b129fc4dd648991ed5ca5346592 (patch)
treeabb86868002fdb0013a05c59d3ad55e13918b1f2 /drivers
parent840f63933983a1d873c5b2f85d2e169bb94e3c19 (diff)
lib8390: Indent braces appropriately
Move the braces around to conform to kernel standard style. Signed-off-by: Joe Perches <joe@perches.com> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/lib8390.c119
1 files changed, 38 insertions, 81 deletions
diff --git a/drivers/net/lib8390.c b/drivers/net/lib8390.c
index 59d5414eb45f..9ace5a746f71 100644
--- a/drivers/net/lib8390.c
+++ b/drivers/net/lib8390.c
@@ -272,8 +272,7 @@ static void __ei_tx_timeout(struct net_device *dev)
272 (isr) ? "lost interrupt?" : "cable problem?", 272 (isr) ? "lost interrupt?" : "cable problem?",
273 txsr, isr, tickssofar); 273 txsr, isr, tickssofar);
274 274
275 if (!isr && !dev->stats.tx_packets) 275 if (!isr && !dev->stats.tx_packets) {
276 {
277 /* The 8390 probably hasn't gotten on the cable yet. */ 276 /* The 8390 probably hasn't gotten on the cable yet. */
278 ei_local->interface_num ^= 1; /* Try a different xcvr. */ 277 ei_local->interface_num ^= 1; /* Try a different xcvr. */
279 } 278 }
@@ -345,24 +344,19 @@ static netdev_tx_t __ei_start_xmit(struct sk_buff *skb,
345 * card, leaving a substantial gap between each transmitted packet. 344 * card, leaving a substantial gap between each transmitted packet.
346 */ 345 */
347 346
348 if (ei_local->tx1 == 0) 347 if (ei_local->tx1 == 0) {
349 {
350 output_page = ei_local->tx_start_page; 348 output_page = ei_local->tx_start_page;
351 ei_local->tx1 = send_length; 349 ei_local->tx1 = send_length;
352 if (ei_debug && ei_local->tx2 > 0) 350 if (ei_debug && ei_local->tx2 > 0)
353 netdev_dbg(dev, "idle transmitter tx2=%d, lasttx=%d, txing=%d\n", 351 netdev_dbg(dev, "idle transmitter tx2=%d, lasttx=%d, txing=%d\n",
354 ei_local->tx2, ei_local->lasttx, ei_local->txing); 352 ei_local->tx2, ei_local->lasttx, ei_local->txing);
355 } 353 } else if (ei_local->tx2 == 0) {
356 else if (ei_local->tx2 == 0)
357 {
358 output_page = ei_local->tx_start_page + TX_PAGES/2; 354 output_page = ei_local->tx_start_page + TX_PAGES/2;
359 ei_local->tx2 = send_length; 355 ei_local->tx2 = send_length;
360 if (ei_debug && ei_local->tx1 > 0) 356 if (ei_debug && ei_local->tx1 > 0)
361 netdev_dbg(dev, "idle transmitter, tx1=%d, lasttx=%d, txing=%d\n", 357 netdev_dbg(dev, "idle transmitter, tx1=%d, lasttx=%d, txing=%d\n",
362 ei_local->tx1, ei_local->lasttx, ei_local->txing); 358 ei_local->tx1, ei_local->lasttx, ei_local->txing);
363 } 359 } else { /* We should never get here. */
364 else
365 { /* We should never get here. */
366 if (ei_debug) 360 if (ei_debug)
367 netdev_dbg(dev, "No Tx buffers free! tx1=%d tx2=%d last=%d\n", 361 netdev_dbg(dev, "No Tx buffers free! tx1=%d tx2=%d last=%d\n",
368 ei_local->tx1, ei_local->tx2, ei_local->lasttx); 362 ei_local->tx1, ei_local->tx2, ei_local->lasttx);
@@ -383,22 +377,18 @@ static netdev_tx_t __ei_start_xmit(struct sk_buff *skb,
383 377
384 ei_block_output(dev, send_length, data, output_page); 378 ei_block_output(dev, send_length, data, output_page);
385 379
386 if (! ei_local->txing) 380 if (! ei_local->txing) {
387 {
388 ei_local->txing = 1; 381 ei_local->txing = 1;
389 NS8390_trigger_send(dev, send_length, output_page); 382 NS8390_trigger_send(dev, send_length, output_page);
390 if (output_page == ei_local->tx_start_page) 383 if (output_page == ei_local->tx_start_page) {
391 {
392 ei_local->tx1 = -1; 384 ei_local->tx1 = -1;
393 ei_local->lasttx = -1; 385 ei_local->lasttx = -1;
394 } 386 } else {
395 else
396 {
397 ei_local->tx2 = -1; 387 ei_local->tx2 = -1;
398 ei_local->lasttx = -2; 388 ei_local->lasttx = -2;
399 } 389 }
400 } 390 } else
401 else ei_local->txqueue++; 391 ei_local->txqueue++;
402 392
403 if (ei_local->tx1 && ei_local->tx2) 393 if (ei_local->tx1 && ei_local->tx2)
404 netif_stop_queue(dev); 394 netif_stop_queue(dev);
@@ -443,8 +433,7 @@ static irqreturn_t __ei_interrupt(int irq, void *dev_id)
443 433
444 spin_lock(&ei_local->page_lock); 434 spin_lock(&ei_local->page_lock);
445 435
446 if (ei_local->irqlock) 436 if (ei_local->irqlock) {
447 {
448 /* 437 /*
449 * This might just be an interrupt for a PCI device sharing 438 * This might just be an interrupt for a PCI device sharing
450 * this line 439 * this line
@@ -464,8 +453,7 @@ static irqreturn_t __ei_interrupt(int irq, void *dev_id)
464 453
465 /* !!Assumption!! -- we stay in page 0. Don't break this. */ 454 /* !!Assumption!! -- we stay in page 0. Don't break this. */
466 while ((interrupts = ei_inb_p(e8390_base + EN0_ISR)) != 0 && 455 while ((interrupts = ei_inb_p(e8390_base + EN0_ISR)) != 0 &&
467 ++nr_serviced < MAX_SERVICE) 456 ++nr_serviced < MAX_SERVICE) {
468 {
469 if (!netif_running(dev)) { 457 if (!netif_running(dev)) {
470 netdev_warn(dev, "interrupt from stopped card\n"); 458 netdev_warn(dev, "interrupt from stopped card\n");
471 /* rmk - acknowledge the interrupts */ 459 /* rmk - acknowledge the interrupts */
@@ -475,8 +463,7 @@ static irqreturn_t __ei_interrupt(int irq, void *dev_id)
475 } 463 }
476 if (interrupts & ENISR_OVER) 464 if (interrupts & ENISR_OVER)
477 ei_rx_overrun(dev); 465 ei_rx_overrun(dev);
478 else if (interrupts & (ENISR_RX+ENISR_RX_ERR)) 466 else if (interrupts & (ENISR_RX+ENISR_RX_ERR)) {
479 {
480 /* Got a good (?) packet. */ 467 /* Got a good (?) packet. */
481 ei_receive(dev); 468 ei_receive(dev);
482 } 469 }
@@ -486,8 +473,7 @@ static irqreturn_t __ei_interrupt(int irq, void *dev_id)
486 else if (interrupts & ENISR_TX_ERR) 473 else if (interrupts & ENISR_TX_ERR)
487 ei_tx_err(dev); 474 ei_tx_err(dev);
488 475
489 if (interrupts & ENISR_COUNTERS) 476 if (interrupts & ENISR_COUNTERS) {
490 {
491 dev->stats.rx_frame_errors += ei_inb_p(e8390_base + EN0_COUNTER0); 477 dev->stats.rx_frame_errors += ei_inb_p(e8390_base + EN0_COUNTER0);
492 dev->stats.rx_crc_errors += ei_inb_p(e8390_base + EN0_COUNTER1); 478 dev->stats.rx_crc_errors += ei_inb_p(e8390_base + EN0_COUNTER1);
493 dev->stats.rx_missed_errors+= ei_inb_p(e8390_base + EN0_COUNTER2); 479 dev->stats.rx_missed_errors+= ei_inb_p(e8390_base + EN0_COUNTER2);
@@ -496,18 +482,14 @@ static irqreturn_t __ei_interrupt(int irq, void *dev_id)
496 482
497 /* Ignore any RDC interrupts that make it back to here. */ 483 /* Ignore any RDC interrupts that make it back to here. */
498 if (interrupts & ENISR_RDC) 484 if (interrupts & ENISR_RDC)
499 {
500 ei_outb_p(ENISR_RDC, e8390_base + EN0_ISR); 485 ei_outb_p(ENISR_RDC, e8390_base + EN0_ISR);
501 }
502 486
503 ei_outb_p(E8390_NODMA+E8390_PAGE0+E8390_START, e8390_base + E8390_CMD); 487 ei_outb_p(E8390_NODMA+E8390_PAGE0+E8390_START, e8390_base + E8390_CMD);
504 } 488 }
505 489
506 if (interrupts && ei_debug) 490 if (interrupts && ei_debug) {
507 {
508 ei_outb_p(E8390_NODMA+E8390_PAGE0+E8390_START, e8390_base + E8390_CMD); 491 ei_outb_p(E8390_NODMA+E8390_PAGE0+E8390_START, e8390_base + E8390_CMD);
509 if (nr_serviced >= MAX_SERVICE) 492 if (nr_serviced >= MAX_SERVICE) {
510 {
511 /* 0xFF is valid for a card removal */ 493 /* 0xFF is valid for a card removal */
512 if(interrupts!=0xFF) 494 if(interrupts!=0xFF)
513 netdev_warn(dev, "Too much work at interrupt, status %#2.2x\n", 495 netdev_warn(dev, "Too much work at interrupt, status %#2.2x\n",
@@ -572,8 +554,7 @@ static void ei_tx_err(struct net_device *dev)
572 554
573 if (tx_was_aborted) 555 if (tx_was_aborted)
574 ei_tx_intr(dev); 556 ei_tx_intr(dev);
575 else 557 else {
576 {
577 dev->stats.tx_errors++; 558 dev->stats.tx_errors++;
578 if (txsr & ENTSR_CRS) dev->stats.tx_carrier_errors++; 559 if (txsr & ENTSR_CRS) dev->stats.tx_carrier_errors++;
579 if (txsr & ENTSR_CDH) dev->stats.tx_heartbeat_errors++; 560 if (txsr & ENTSR_CDH) dev->stats.tx_heartbeat_errors++;
@@ -603,37 +584,31 @@ static void ei_tx_intr(struct net_device *dev)
603 */ 584 */
604 ei_local->txqueue--; 585 ei_local->txqueue--;
605 586
606 if (ei_local->tx1 < 0) 587 if (ei_local->tx1 < 0) {
607 {
608 if (ei_local->lasttx != 1 && ei_local->lasttx != -1) 588 if (ei_local->lasttx != 1 && ei_local->lasttx != -1)
609 pr_err("%s: bogus last_tx_buffer %d, tx1=%d\n", 589 pr_err("%s: bogus last_tx_buffer %d, tx1=%d\n",
610 ei_local->name, ei_local->lasttx, ei_local->tx1); 590 ei_local->name, ei_local->lasttx, ei_local->tx1);
611 ei_local->tx1 = 0; 591 ei_local->tx1 = 0;
612 if (ei_local->tx2 > 0) 592 if (ei_local->tx2 > 0) {
613 {
614 ei_local->txing = 1; 593 ei_local->txing = 1;
615 NS8390_trigger_send(dev, ei_local->tx2, ei_local->tx_start_page + 6); 594 NS8390_trigger_send(dev, ei_local->tx2, ei_local->tx_start_page + 6);
616 dev->trans_start = jiffies; 595 dev->trans_start = jiffies;
617 ei_local->tx2 = -1, 596 ei_local->tx2 = -1,
618 ei_local->lasttx = 2; 597 ei_local->lasttx = 2;
619 } 598 } else
620 else ei_local->lasttx = 20, ei_local->txing = 0; 599 ei_local->lasttx = 20, ei_local->txing = 0;
621 } 600 } else if (ei_local->tx2 < 0) {
622 else if (ei_local->tx2 < 0)
623 {
624 if (ei_local->lasttx != 2 && ei_local->lasttx != -2) 601 if (ei_local->lasttx != 2 && ei_local->lasttx != -2)
625 pr_err("%s: bogus last_tx_buffer %d, tx2=%d\n", 602 pr_err("%s: bogus last_tx_buffer %d, tx2=%d\n",
626 ei_local->name, ei_local->lasttx, ei_local->tx2); 603 ei_local->name, ei_local->lasttx, ei_local->tx2);
627 ei_local->tx2 = 0; 604 ei_local->tx2 = 0;
628 if (ei_local->tx1 > 0) 605 if (ei_local->tx1 > 0) {
629 {
630 ei_local->txing = 1; 606 ei_local->txing = 1;
631 NS8390_trigger_send(dev, ei_local->tx1, ei_local->tx_start_page); 607 NS8390_trigger_send(dev, ei_local->tx1, ei_local->tx_start_page);
632 dev->trans_start = jiffies; 608 dev->trans_start = jiffies;
633 ei_local->tx1 = -1; 609 ei_local->tx1 = -1;
634 ei_local->lasttx = 1; 610 ei_local->lasttx = 1;
635 } 611 } else
636 else
637 ei_local->lasttx = 10, ei_local->txing = 0; 612 ei_local->lasttx = 10, ei_local->txing = 0;
638 } 613 }
639// else printk(KERN_WARNING "%s: unexpected TX-done interrupt, lasttx=%d.\n", 614// else printk(KERN_WARNING "%s: unexpected TX-done interrupt, lasttx=%d.\n",
@@ -644,11 +619,9 @@ static void ei_tx_intr(struct net_device *dev)
644 dev->stats.collisions++; 619 dev->stats.collisions++;
645 if (status & ENTSR_PTX) 620 if (status & ENTSR_PTX)
646 dev->stats.tx_packets++; 621 dev->stats.tx_packets++;
647 else 622 else {
648 {
649 dev->stats.tx_errors++; 623 dev->stats.tx_errors++;
650 if (status & ENTSR_ABT) 624 if (status & ENTSR_ABT) {
651 {
652 dev->stats.tx_aborted_errors++; 625 dev->stats.tx_aborted_errors++;
653 dev->stats.collisions += 16; 626 dev->stats.collisions += 16;
654 } 627 }
@@ -682,8 +655,7 @@ static void ei_receive(struct net_device *dev)
682 struct e8390_pkt_hdr rx_frame; 655 struct e8390_pkt_hdr rx_frame;
683 int num_rx_pages = ei_local->stop_page-ei_local->rx_start_page; 656 int num_rx_pages = ei_local->stop_page-ei_local->rx_start_page;
684 657
685 while (++rx_pkt_count < 10) 658 while (++rx_pkt_count < 10) {
686 {
687 int pkt_len, pkt_stat; 659 int pkt_len, pkt_stat;
688 660
689 /* Get the rx page (incoming packet pointer). */ 661 /* Get the rx page (incoming packet pointer). */
@@ -730,30 +702,24 @@ static void ei_receive(struct net_device *dev)
730 continue; 702 continue;
731 } 703 }
732 704
733 if (pkt_len < 60 || pkt_len > 1518) 705 if (pkt_len < 60 || pkt_len > 1518) {
734 {
735 if (ei_debug) 706 if (ei_debug)
736 netdev_dbg(dev, "bogus packet size: %d, status=%#2x nxpg=%#2x\n", 707 netdev_dbg(dev, "bogus packet size: %d, status=%#2x nxpg=%#2x\n",
737 rx_frame.count, rx_frame.status, 708 rx_frame.count, rx_frame.status,
738 rx_frame.next); 709 rx_frame.next);
739 dev->stats.rx_errors++; 710 dev->stats.rx_errors++;
740 dev->stats.rx_length_errors++; 711 dev->stats.rx_length_errors++;
741 } 712 } else if ((pkt_stat & 0x0F) == ENRSR_RXOK) {
742 else if ((pkt_stat & 0x0F) == ENRSR_RXOK)
743 {
744 struct sk_buff *skb; 713 struct sk_buff *skb;
745 714
746 skb = dev_alloc_skb(pkt_len+2); 715 skb = dev_alloc_skb(pkt_len+2);
747 if (skb == NULL) 716 if (skb == NULL) {
748 {
749 if (ei_debug > 1) 717 if (ei_debug > 1)
750 netdev_dbg(dev, "Couldn't allocate a sk_buff of size %d\n", 718 netdev_dbg(dev, "Couldn't allocate a sk_buff of size %d\n",
751 pkt_len); 719 pkt_len);
752 dev->stats.rx_dropped++; 720 dev->stats.rx_dropped++;
753 break; 721 break;
754 } 722 } else {
755 else
756 {
757 skb_reserve(skb,2); /* IP headers on 16 byte boundaries */ 723 skb_reserve(skb,2); /* IP headers on 16 byte boundaries */
758 skb_put(skb, pkt_len); /* Make room */ 724 skb_put(skb, pkt_len); /* Make room */
759 ei_block_input(dev, pkt_len, skb, current_offset + sizeof(rx_frame)); 725 ei_block_input(dev, pkt_len, skb, current_offset + sizeof(rx_frame));
@@ -765,9 +731,7 @@ static void ei_receive(struct net_device *dev)
765 if (pkt_stat & ENRSR_PHY) 731 if (pkt_stat & ENRSR_PHY)
766 dev->stats.multicast++; 732 dev->stats.multicast++;
767 } 733 }
768 } 734 } else {
769 else
770 {
771 if (ei_debug) 735 if (ei_debug)
772 netdev_dbg(dev, "bogus packet: status=%#2x nxpg=%#2x size=%d\n", 736 netdev_dbg(dev, "bogus packet: status=%#2x nxpg=%#2x size=%d\n",
773 rx_frame.status, rx_frame.next, 737 rx_frame.status, rx_frame.next,
@@ -845,8 +809,7 @@ static void ei_rx_overrun(struct net_device *dev)
845 * step is vital, and skipping it will cause no end of havoc. 809 * step is vital, and skipping it will cause no end of havoc.
846 */ 810 */
847 811
848 if (was_txing) 812 if (was_txing) {
849 {
850 unsigned char tx_completed = ei_inb_p(e8390_base+EN0_ISR) & (ENISR_TX+ENISR_TX_ERR); 813 unsigned char tx_completed = ei_inb_p(e8390_base+EN0_ISR) & (ENISR_TX+ENISR_TX_ERR);
851 if (!tx_completed) 814 if (!tx_completed)
852 must_resend = 1; 815 must_resend = 1;
@@ -930,13 +893,11 @@ static void do_set_multicast_list(struct net_device *dev)
930 int i; 893 int i;
931 struct ei_device *ei_local = netdev_priv(dev); 894 struct ei_device *ei_local = netdev_priv(dev);
932 895
933 if (!(dev->flags&(IFF_PROMISC|IFF_ALLMULTI))) 896 if (!(dev->flags&(IFF_PROMISC|IFF_ALLMULTI))) {
934 {
935 memset(ei_local->mcfilter, 0, 8); 897 memset(ei_local->mcfilter, 0, 8);
936 if (!netdev_mc_empty(dev)) 898 if (!netdev_mc_empty(dev))
937 make_mc_bits(ei_local->mcfilter, dev); 899 make_mc_bits(ei_local->mcfilter, dev);
938 } 900 } else
939 else
940 memset(ei_local->mcfilter, 0xFF, 8); /* mcast set to accept-all */ 901 memset(ei_local->mcfilter, 0xFF, 8); /* mcast set to accept-all */
941 902
942 /* 903 /*
@@ -955,8 +916,7 @@ static void do_set_multicast_list(struct net_device *dev)
955 if (netif_running(dev)) 916 if (netif_running(dev))
956 ei_outb_p(E8390_RXCONFIG, e8390_base + EN0_RXCR); 917 ei_outb_p(E8390_RXCONFIG, e8390_base + EN0_RXCR);
957 ei_outb_p(E8390_NODMA + E8390_PAGE1, e8390_base + E8390_CMD); 918 ei_outb_p(E8390_NODMA + E8390_PAGE1, e8390_base + E8390_CMD);
958 for(i = 0; i < 8; i++) 919 for(i = 0; i < 8; i++) {
959 {
960 ei_outb_p(ei_local->mcfilter[i], e8390_base + EN1_MULT_SHIFT(i)); 920 ei_outb_p(ei_local->mcfilter[i], e8390_base + EN1_MULT_SHIFT(i));
961#ifndef BUG_83C690 921#ifndef BUG_83C690
962 if(ei_inb_p(e8390_base + EN1_MULT_SHIFT(i))!=ei_local->mcfilter[i]) 922 if(ei_inb_p(e8390_base + EN1_MULT_SHIFT(i))!=ei_local->mcfilter[i])
@@ -1069,8 +1029,7 @@ static void __NS8390_init(struct net_device *dev, int startp)
1069 /* Copy the station address into the DS8390 registers. */ 1029 /* Copy the station address into the DS8390 registers. */
1070 1030
1071 ei_outb_p(E8390_NODMA + E8390_PAGE1 + E8390_STOP, e8390_base+E8390_CMD); /* 0x61 */ 1031 ei_outb_p(E8390_NODMA + E8390_PAGE1 + E8390_STOP, e8390_base+E8390_CMD); /* 0x61 */
1072 for(i = 0; i < 6; i++) 1032 for(i = 0; i < 6; i++) {
1073 {
1074 ei_outb_p(dev->dev_addr[i], e8390_base + EN1_PHYS_SHIFT(i)); 1033 ei_outb_p(dev->dev_addr[i], e8390_base + EN1_PHYS_SHIFT(i));
1075 if (ei_debug > 1 && ei_inb_p(e8390_base + EN1_PHYS_SHIFT(i))!=dev->dev_addr[i]) 1034 if (ei_debug > 1 && ei_inb_p(e8390_base + EN1_PHYS_SHIFT(i))!=dev->dev_addr[i])
1076 netdev_err(dev, "Hw. address read/write mismap %d\n", i); 1035 netdev_err(dev, "Hw. address read/write mismap %d\n", i);
@@ -1082,8 +1041,7 @@ static void __NS8390_init(struct net_device *dev, int startp)
1082 ei_local->tx1 = ei_local->tx2 = 0; 1041 ei_local->tx1 = ei_local->tx2 = 0;
1083 ei_local->txing = 0; 1042 ei_local->txing = 0;
1084 1043
1085 if (startp) 1044 if (startp) {
1086 {
1087 ei_outb_p(0xff, e8390_base + EN0_ISR); 1045 ei_outb_p(0xff, e8390_base + EN0_ISR);
1088 ei_outb_p(ENISR_ALL, e8390_base + EN0_IMR); 1046 ei_outb_p(ENISR_ALL, e8390_base + EN0_IMR);
1089 ei_outb_p(E8390_NODMA+E8390_PAGE0+E8390_START, e8390_base+E8390_CMD); 1047 ei_outb_p(E8390_NODMA+E8390_PAGE0+E8390_START, e8390_base+E8390_CMD);
@@ -1105,8 +1063,7 @@ static void NS8390_trigger_send(struct net_device *dev, unsigned int length,
1105 1063
1106 ei_outb_p(E8390_NODMA+E8390_PAGE0, e8390_base+E8390_CMD); 1064 ei_outb_p(E8390_NODMA+E8390_PAGE0, e8390_base+E8390_CMD);
1107 1065
1108 if (ei_inb_p(e8390_base + E8390_CMD) & E8390_TRANS) 1066 if (ei_inb_p(e8390_base + E8390_CMD) & E8390_TRANS) {
1109 {
1110 netdev_warn(dev, "trigger_send() called with the transmitter busy\n"); 1067 netdev_warn(dev, "trigger_send() called with the transmitter busy\n");
1111 return; 1068 return;
1112 } 1069 }