Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

isicom: bring into coding style

[akpm@linux-foundation.org: fix arm, cleanups]
Signed-off-by: Alan Cox <alan@redhat.com>
Cc: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Alan Cox and committed by
Linus Torvalds
251b8dd7 23d22cea

+56 -53
+56 -53
drivers/char/isicom.c
··· 126 126 #include <linux/delay.h> 127 127 #include <linux/ioport.h> 128 128 129 - #include <asm/uaccess.h> 130 - #include <asm/io.h> 129 + #include <linux/uaccess.h> 130 + #include <linux/io.h> 131 131 #include <asm/system.h> 132 132 133 133 #include <linux/pci.h> ··· 189 189 unsigned short status; 190 190 unsigned short port_status; /* each bit for each port */ 191 191 unsigned short shift_count; 192 - struct isi_port * ports; 192 + struct isi_port *ports; 193 193 signed char count; 194 194 spinlock_t card_lock; /* Card wide lock 11/5/00 -sameer */ 195 195 unsigned long flags; ··· 205 205 u16 channel; 206 206 u16 status; 207 207 u16 closing_wait; 208 - struct isi_board * card; 209 - struct tty_struct * tty; 208 + struct isi_board *card; 209 + struct tty_struct *tty; 210 210 wait_queue_head_t close_wait; 211 211 wait_queue_head_t open_wait; 212 - unsigned char * xmit_buf; 212 + unsigned char *xmit_buf; 213 213 int xmit_head; 214 214 int xmit_tail; 215 215 int xmit_cnt; ··· 405 405 406 406 /* find next active board */ 407 407 card = (prev_card + 1) & 0x0003; 408 - while(count-- > 0) { 408 + while (count-- > 0) { 409 409 if (isi_card[card].status & BOARD_ACTIVE) 410 410 break; 411 411 card = (card + 1) & 0x0003; ··· 428 428 if (retries >= 100) 429 429 goto unlock; 430 430 431 - for (;count > 0;count--, port++) { 431 + for (; count > 0; count--, port++) { 432 432 /* port not active or tx disabled to force flow control */ 433 433 if (!(port->flags & ASYNC_INITIALIZED) || 434 434 !(port->status & ISI_TXOK)) ··· 471 471 break; 472 472 } 473 473 } 474 - if (cnt <= 0) break; 474 + if (cnt <= 0) 475 + break; 475 476 word_count = cnt >> 1; 476 - outsw(base, port->xmit_buf+port->xmit_tail,word_count); 477 + outsw(base, port->xmit_buf+port->xmit_tail, word_count); 477 478 port->xmit_tail = (port->xmit_tail 478 479 + (word_count << 1)) & (SERIAL_XMIT_SIZE - 1); 479 480 txcount -= (word_count << 1); ··· 557 556 tty = port->tty; 558 557 if (tty == NULL) { 559 558 word_count = byte_count >> 1; 560 - while(byte_count > 1) { 559 + while (byte_count > 1) { 561 560 inw(base); 562 561 byte_count -= 2; 563 562 } ··· 570 569 571 570 if (header & 0x8000) { /* Status Packet */ 572 571 header = inw(base); 573 - switch(header & 0xff) { 572 + switch (header & 0xff) { 574 573 case 0: /* Change in EIA signals */ 575 574 if (port->flags & ASYNC_CHECK_CD) { 576 575 if (port->status & ISI_DCD) { ··· 657 656 if (byte_count > 0) { 658 657 pr_dbg("Intr(0x%lx:%d): Flip buffer overflow! dropping " 659 658 "bytes...\n", base, channel + 1); 660 - while(byte_count > 0) { /* drain out unread xtra data */ 659 + /* drain out unread xtra data */ 660 + while (byte_count > 0) { 661 661 inw(base); 662 662 byte_count -= 2; 663 663 } ··· 681 679 shift_count = card->shift_count; 682 680 unsigned char flow_ctrl; 683 681 684 - if (!(tty = port->tty) || !tty->termios) 682 + tty = port->tty; 683 + 684 + if (tty == NULL) 685 685 return; 686 + /* FIXME: Switch to new tty baud API */ 686 687 baud = C_BAUD(tty); 687 688 if (baud & CBAUDEX) { 688 689 baud &= ~CBAUDEX; ··· 711 706 if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) 712 707 baud++; /* 57.6 Kbps */ 713 708 if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) 714 - baud +=2; /* 115 Kbps */ 709 + baud += 2; /* 115 Kbps */ 715 710 if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) 716 711 baud += 3; /* 230 kbps*/ 717 712 if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) ··· 721 716 /* hang up */ 722 717 drop_dtr(port); 723 718 return; 724 - } 725 - else 719 + } else 726 720 raise_dtr(port); 727 721 728 722 if (WaitTillCardIsFree(base) == 0) { 729 - outw(0x8000 | (channel << shift_count) |0x03, base); 723 + outw(0x8000 | (channel << shift_count) | 0x03, base); 730 724 outw(linuxb_to_isib[baud] << 8 | 0x03, base); 731 725 channel_setup = 0; 732 - switch(C_CSIZE(tty)) { 726 + switch (C_CSIZE(tty)) { 733 727 case CS5: 734 728 channel_setup |= ISICOM_CS5; 735 729 break; ··· 771 767 flow_ctrl |= ISICOM_INITIATE_XONXOFF; 772 768 773 769 if (WaitTillCardIsFree(base) == 0) { 774 - outw(0x8000 | (channel << shift_count) |0x04, base); 770 + outw(0x8000 | (channel << shift_count) | 0x04, base); 775 771 outw(flow_ctrl << 8 | 0x05, base); 776 772 outw((STOP_CHAR(tty)) << 8 | (START_CHAR(tty)), base); 777 773 InterruptTheCard(base); ··· 809 805 struct isi_board *card = port->card; 810 806 unsigned long flags; 811 807 812 - if (port->flags & ASYNC_INITIALIZED) { 808 + if (port->flags & ASYNC_INITIALIZED) 813 809 return 0; 814 - } 815 810 if (!port->xmit_buf) { 816 - unsigned long page; 811 + /* Relies on BKL */ 812 + void *xmit_buf = (void *)get_zeroed_page(GFP_KERNEL); 817 813 818 - if (!(page = get_zeroed_page(GFP_KERNEL))) 814 + if (xmit_buf == NULL) 819 815 return -ENOMEM; 820 - 821 816 if (port->xmit_buf) { 822 - free_page(page); 817 + free_page((unsigned long)xmit_buf); 823 818 return -ERESTARTSYS; 824 819 } 825 - port->xmit_buf = (unsigned char *) page; 820 + port->xmit_buf = xmit_buf; 826 821 } 827 822 828 823 spin_lock_irqsave(&card->card_lock, flags); ··· 952 949 port->count++; 953 950 tty->driver_data = port; 954 951 port->tty = tty; 955 - if ((error = isicom_setup_port(port))!=0) 956 - return error; 957 - if ((error = block_til_ready(tty, filp, port))!=0) 958 - return error; 959 - 960 - return 0; 952 + error = isicom_setup_port(port); 953 + if (error == 0) 954 + error = block_til_ready(tty, filp, port); 955 + return error; 961 956 } 962 957 963 958 /* close et all */ 964 959 965 960 static inline void isicom_shutdown_board(struct isi_board *bp) 966 961 { 967 - if (bp->status & BOARD_ACTIVE) { 962 + if (bp->status & BOARD_ACTIVE) 968 963 bp->status &= ~BOARD_ACTIVE; 969 - } 970 964 } 971 965 972 966 /* card->lock HAS to be held */ ··· 1119 1119 1120 1120 spin_lock_irqsave(&card->card_lock, flags); 1121 1121 1122 - while(1) { 1122 + while (1) { 1123 1123 cnt = min_t(int, count, min(SERIAL_XMIT_SIZE - port->xmit_cnt 1124 1124 - 1, SERIAL_XMIT_SIZE - port->xmit_head)); 1125 1125 if (cnt <= 0) ··· 1153 1153 return; 1154 1154 1155 1155 spin_lock_irqsave(&card->card_lock, flags); 1156 - if (port->xmit_cnt >= SERIAL_XMIT_SIZE - 1) { 1157 - spin_unlock_irqrestore(&card->card_lock, flags); 1158 - return; 1159 - } 1156 + if (port->xmit_cnt >= SERIAL_XMIT_SIZE - 1) 1157 + goto out; 1160 1158 1161 1159 port->xmit_buf[port->xmit_head++] = ch; 1162 1160 port->xmit_head &= (SERIAL_XMIT_SIZE - 1); 1163 1161 port->xmit_cnt++; 1164 1162 spin_unlock_irqrestore(&card->card_lock, flags); 1163 + out: 1164 + return; 1165 1165 } 1166 1166 1167 1167 /* flush_chars et all */ ··· 1286 1286 unlock_kernel(); 1287 1287 return -EPERM; 1288 1288 } 1289 - port->flags = ((port->flags & ~ ASYNC_USR_MASK) | 1289 + port->flags = ((port->flags & ~ASYNC_USR_MASK) | 1290 1290 (newinfo.flags & ASYNC_USR_MASK)); 1291 - } 1292 - else { 1291 + } else { 1293 1292 port->close_delay = newinfo.close_delay; 1294 1293 port->closing_wait = newinfo.closing_wait; 1295 1294 port->flags = ((port->flags & ~ASYNC_FLAGS) | ··· 1335 1336 if (isicom_paranoia_check(port, tty->name, "isicom_ioctl")) 1336 1337 return -ENODEV; 1337 1338 1338 - switch(cmd) { 1339 + switch (cmd) { 1339 1340 case TCSBRK: 1340 1341 retval = tty_check_change(tty); 1341 1342 if (retval) ··· 1584 1585 default: 1585 1586 dev_err(&pdev->dev, "Unknown signature.\n"); 1586 1587 goto end; 1587 - } 1588 + } 1588 1589 1589 1590 retval = request_firmware(&fw, name, &pdev->dev); 1590 1591 if (retval) ··· 1612 1613 if (WaitTillCardIsFree(base)) 1613 1614 goto errrelfw; 1614 1615 1615 - if ((status = inw(base + 0x4)) != 0) { 1616 + status = inw(base + 0x4); 1617 + if (status != 0) { 1616 1618 dev_warn(&pdev->dev, "Card%d rejected load header:\n" 1617 1619 KERN_WARNING "Address:0x%x\n" 1618 1620 KERN_WARNING "Count:0x%x\n" ··· 1630 1630 if (WaitTillCardIsFree(base)) 1631 1631 goto errrelfw; 1632 1632 1633 - if ((status = inw(base + 0x4)) != 0) { 1633 + status = inw(base + 0x4); 1634 + if (status != 0) { 1634 1635 dev_err(&pdev->dev, "Card%d got out of sync.Card " 1635 1636 "Status:0x%x\n", index + 1, status); 1636 1637 goto errrelfw; 1637 1638 } 1638 - } 1639 + } 1639 1640 1640 1641 /* XXX: should we test it by reading it back and comparing with original like 1641 1642 * in load firmware package? */ ··· 1660 1659 if (WaitTillCardIsFree(base)) 1661 1660 goto errrelfw; 1662 1661 1663 - if ((status = inw(base + 0x4)) != 0) { 1662 + status = inw(base + 0x4); 1663 + if (status != 0) { 1664 1664 dev_warn(&pdev->dev, "Card%d rejected verify header:\n" 1665 1665 KERN_WARNING "Address:0x%x\n" 1666 1666 KERN_WARNING "Count:0x%x\n" ··· 1694 1692 if (WaitTillCardIsFree(base)) 1695 1693 goto errrelfw; 1696 1694 1697 - if ((status = inw(base + 0x4)) != 0) { 1695 + status = inw(base + 0x4); 1696 + if (status != 0) { 1698 1697 dev_err(&pdev->dev, "Card%d verify got out of sync. " 1699 1698 "Card Status:0x%x\n", index + 1, status); 1700 1699 goto errrelfw; ··· 1760 1757 index + 1); 1761 1758 retval = -EBUSY; 1762 1759 goto errdec; 1763 - } 1760 + } 1764 1761 1765 1762 retval = request_irq(board->irq, isicom_interrupt, 1766 1763 IRQF_SHARED | IRQF_DISABLED, ISICOM_NAME, board); ··· 1814 1811 int retval, idx, channel; 1815 1812 struct isi_port *port; 1816 1813 1817 - for(idx = 0; idx < BOARD_COUNT; idx++) { 1814 + for (idx = 0; idx < BOARD_COUNT; idx++) { 1818 1815 port = &isi_ports[idx * 16]; 1819 1816 isi_card[idx].ports = port; 1820 1817 spin_lock_init(&isi_card[idx].card_lock); ··· 1828 1825 init_waitqueue_head(&port->open_wait); 1829 1826 init_waitqueue_head(&port->close_wait); 1830 1827 /* . . . */ 1831 - } 1828 + } 1832 1829 isi_card[idx].base = 0; 1833 1830 isi_card[idx].irq = 0; 1834 1831 }