[PATCH] char/isicom: More whitespaces and coding style

Wrap all the code to 80 chars on a line.
`}\nelse' changed to `} else'.
Clean whitespaces in header file.

Signed-off-by: Jiri Slaby <xslaby@fi.muni.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Jiri Slaby and committed by
Linus Torvalds
a547dfe9 e65c1db1

+69 -64
+59 -53
drivers/char/isicom.c
··· 189 unsigned char irq; 190 unsigned char port_count; 191 unsigned short status; 192 - unsigned short port_status; /* each bit represents a single port */ 193 unsigned short shift_count; 194 struct isi_port * ports; 195 signed char count; ··· 242 udelay(1000); /* 1ms */ 243 } 244 } 245 - printk(KERN_WARNING "ISICOM: Failed to lock Card (0x%lx)\n", card->base); 246 return 0; /* Failed to aquire the card! */ 247 } 248 ··· 468 residue = NO; 469 wrd = 0; 470 while (1) { 471 - cnt = min_t(int, txcount, (SERIAL_XMIT_SIZE - port->xmit_tail)); 472 if (residue == YES) { 473 residue = NO; 474 if (cnt > 0) { 475 - wrd |= (port->xmit_buf[port->xmit_tail] << 8); 476 - port->xmit_tail = (port->xmit_tail + 1) & (SERIAL_XMIT_SIZE - 1); 477 port->xmit_cnt--; 478 txcount--; 479 cnt--; 480 outw(wrd, base); 481 - } 482 - else { 483 outw(wrd, base); 484 break; 485 } 486 } 487 if (cnt <= 0) break; 488 word_count = cnt >> 1; 489 - outsw(base, port->xmit_buf+port->xmit_tail, word_count); 490 - port->xmit_tail = (port->xmit_tail + (word_count << 1)) & 491 - (SERIAL_XMIT_SIZE - 1); 492 txcount -= (word_count << 1); 493 port->xmit_cnt -= (word_count << 1); 494 if (cnt & 0x0001) { 495 residue = YES; 496 wrd = port->xmit_buf[port->xmit_tail]; 497 - port->xmit_tail = (port->xmit_tail + 1) & (SERIAL_XMIT_SIZE - 1); 498 port->xmit_cnt--; 499 txcount--; 500 } ··· 577 byte_count = header & 0xff; 578 579 if (channel + 1 > card->port_count) { 580 - printk(KERN_WARNING "ISICOM: isicom_interrupt(0x%lx): %d(channel) > port_count.\n", 581 - base, channel+1); 582 if (card->isa) 583 ClearInterrupt(base); 584 else ··· 616 header = inw(base); 617 switch(header & 0xff) { 618 case 0: /* Change in EIA signals */ 619 - 620 if (port->flags & ASYNC_CHECK_CD) { 621 if (port->status & ISI_DCD) { 622 if (!(header & ISI_DCD)) { 623 /* Carrier has been lost */ 624 - pr_dbg("interrupt: DCD->low.\n"); 625 port->status &= ~ISI_DCD; 626 schedule_work(&port->hangup_tq); 627 } 628 } 629 - else { 630 - if (header & ISI_DCD) { 631 - /* Carrier has been detected */ 632 - pr_dbg("interrupt: DCD->high.\n"); 633 - port->status |= ISI_DCD; 634 - wake_up_interruptible(&port->open_wait); 635 - } 636 - } 637 - } 638 - else { 639 if (header & ISI_DCD) 640 port->status |= ISI_DCD; 641 else ··· 643 if (header & ISI_CTS) { 644 port->tty->hw_stopped = 0; 645 /* start tx ing */ 646 - port->status |= (ISI_TXOK | ISI_CTS); 647 schedule_work(&port->bh_tqueue); 648 } 649 } 650 - else { 651 - if (!(header & ISI_CTS)) { 652 - port->tty->hw_stopped = 1; 653 - /* stop tx ing */ 654 - port->status &= ~(ISI_TXOK | ISI_CTS); 655 - } 656 - } 657 - } 658 - else { 659 if (header & ISI_CTS) 660 port->status |= ISI_CTS; 661 else ··· 671 672 break; 673 674 - case 1: /* Received Break !!! */ 675 tty_insert_flip_char(tty, 0, TTY_BREAK); 676 if (port->flags & ASYNC_SAK) 677 do_SAK(tty); ··· 686 pr_dbg("Intr: Unknown code in status packet.\n"); 687 break; 688 } 689 - } 690 - else { /* Data Packet */ 691 692 count = tty_prepare_flip_string(tty, &rp, byte_count & ~1); 693 pr_dbg("Intr: Can rx %d of %d bytes.\n", count, byte_count); ··· 694 insw(base, rp, word_count); 695 byte_count -= (word_count << 1); 696 if (count & 0x0001) { 697 - tty_insert_flip_char(tty, inw(base) & 0xff, TTY_NORMAL); 698 byte_count -= 2; 699 } 700 if (byte_count > 0) { ··· 712 ClearInterrupt(base); 713 else 714 outw(0x0000, base+0x04); /* enable interrupts */ 715 return IRQ_HANDLED; 716 } 717 ··· 884 return 0; 885 } 886 887 - static int block_til_ready(struct tty_struct *tty, struct file *filp, struct isi_port *port) 888 { 889 struct isi_board *card = port->card; 890 int do_clocal = 0, retval; ··· 905 906 /* if non-blocking mode is set ... */ 907 908 - if ((filp->f_flags & O_NONBLOCK) || (tty->flags & (1 << TTY_IO_ERROR))) { 909 pr_dbg("block_til_ready: non-block mode.\n"); 910 port->flags |= ASYNC_NORMAL_ACTIVE; 911 return 0; ··· 1052 card->count = 0; 1053 } 1054 1055 - /* last port was closed , shutdown that boad too */ 1056 if (C_HUPCL(tty)) { 1057 if (!card->count) 1058 isicom_shutdown_board(card); ··· 1079 } 1080 1081 if (tty->count == 1 && port->count != 1) { 1082 - printk(KERN_WARNING "ISICOM:(0x%lx) isicom_close: bad port count" 1083 - "tty->count = 1 port count = %d.\n", 1084 card->base, port->count); 1085 port->count = 1; 1086 } 1087 if (--port->count < 0) { 1088 - printk(KERN_WARNING "ISICOM:(0x%lx) isicom_close: bad port count for" 1089 - "channel%d = %d", card->base, port->channel, 1090 port->count); 1091 port->count = 0; 1092 } ··· 1122 spin_unlock_irqrestore(&card->card_lock, flags); 1123 if (port->close_delay) { 1124 pr_dbg("scheduling until time out.\n"); 1125 - msleep_interruptible(jiffies_to_msecs(port->close_delay)); 1126 } 1127 spin_lock_irqsave(&card->card_lock, flags); 1128 wake_up_interruptible(&port->open_wait); ··· 1151 spin_lock_irqsave(&card->card_lock, flags); 1152 1153 while(1) { 1154 - cnt = min_t(int, count, min(SERIAL_XMIT_SIZE - port->xmit_cnt - 1, 1155 - SERIAL_XMIT_SIZE - port->xmit_head)); 1156 if (cnt <= 0) 1157 break; 1158 1159 memcpy(port->xmit_buf + port->xmit_head, buf, cnt); 1160 - port->xmit_head = (port->xmit_head + cnt) & (SERIAL_XMIT_SIZE - 1); 1161 port->xmit_cnt += cnt; 1162 buf += cnt; 1163 count -= cnt; ··· 1203 if (isicom_paranoia_check(port, tty->name, "isicom_flush_chars")) 1204 return; 1205 1206 - if (port->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped || !port->xmit_buf) 1207 return; 1208 1209 /* this tells the transmitter to consider this port for ··· 1237 } 1238 1239 /* ioctl et all */ 1240 - static inline void isicom_send_break(struct isi_port *port, unsigned long length) 1241 { 1242 struct isi_board *card = port->card; 1243 unsigned long base = card->base; ··· 1373 return 0; 1374 1375 case TIOCGSOFTCAR: 1376 - return put_user(C_CLOCAL(tty) ? 1 : 0, (unsigned long __user *)argp); 1377 1378 case TIOCSSOFTCAR: 1379 if (get_user(arg, (unsigned long __user *) argp))
··· 189 unsigned char irq; 190 unsigned char port_count; 191 unsigned short status; 192 + unsigned short port_status; /* each bit for each port */ 193 unsigned short shift_count; 194 struct isi_port * ports; 195 signed char count; ··· 242 udelay(1000); /* 1ms */ 243 } 244 } 245 + printk(KERN_WARNING "ISICOM: Failed to lock Card (0x%lx)\n", 246 + card->base); 247 + 248 return 0; /* Failed to aquire the card! */ 249 } 250 ··· 466 residue = NO; 467 wrd = 0; 468 while (1) { 469 + cnt = min_t(int, txcount, (SERIAL_XMIT_SIZE 470 + - port->xmit_tail)); 471 if (residue == YES) { 472 residue = NO; 473 if (cnt > 0) { 474 + wrd |= (port->xmit_buf[port->xmit_tail] 475 + << 8); 476 + port->xmit_tail = (port->xmit_tail + 1) 477 + & (SERIAL_XMIT_SIZE - 1); 478 port->xmit_cnt--; 479 txcount--; 480 cnt--; 481 outw(wrd, base); 482 + } else { 483 outw(wrd, base); 484 break; 485 } 486 } 487 if (cnt <= 0) break; 488 word_count = cnt >> 1; 489 + outsw(base, port->xmit_buf+port->xmit_tail,word_count); 490 + port->xmit_tail = (port->xmit_tail 491 + + (word_count << 1)) & (SERIAL_XMIT_SIZE - 1); 492 txcount -= (word_count << 1); 493 port->xmit_cnt -= (word_count << 1); 494 if (cnt & 0x0001) { 495 residue = YES; 496 wrd = port->xmit_buf[port->xmit_tail]; 497 + port->xmit_tail = (port->xmit_tail + 1) 498 + & (SERIAL_XMIT_SIZE - 1); 499 port->xmit_cnt--; 500 txcount--; 501 } ··· 572 byte_count = header & 0xff; 573 574 if (channel + 1 > card->port_count) { 575 + printk(KERN_WARNING "ISICOM: isicom_interrupt(0x%lx): " 576 + "%d(channel) > port_count.\n", base, channel+1); 577 if (card->isa) 578 ClearInterrupt(base); 579 else ··· 611 header = inw(base); 612 switch(header & 0xff) { 613 case 0: /* Change in EIA signals */ 614 if (port->flags & ASYNC_CHECK_CD) { 615 if (port->status & ISI_DCD) { 616 if (!(header & ISI_DCD)) { 617 /* Carrier has been lost */ 618 + pr_dbg("interrupt: DCD->low.\n" 619 + ); 620 port->status &= ~ISI_DCD; 621 schedule_work(&port->hangup_tq); 622 } 623 + } else if (header & ISI_DCD) { 624 + /* Carrier has been detected */ 625 + pr_dbg("interrupt: DCD->high.\n"); 626 + port->status |= ISI_DCD; 627 + wake_up_interruptible(&port->open_wait); 628 } 629 + } else { 630 if (header & ISI_DCD) 631 port->status |= ISI_DCD; 632 else ··· 642 if (header & ISI_CTS) { 643 port->tty->hw_stopped = 0; 644 /* start tx ing */ 645 + port->status |= (ISI_TXOK 646 + | ISI_CTS); 647 schedule_work(&port->bh_tqueue); 648 } 649 + } else if (!(header & ISI_CTS)) { 650 + port->tty->hw_stopped = 1; 651 + /* stop tx ing */ 652 + port->status &= ~(ISI_TXOK | ISI_CTS); 653 } 654 + } else { 655 if (header & ISI_CTS) 656 port->status |= ISI_CTS; 657 else ··· 673 674 break; 675 676 + case 1: /* Received Break !!! */ 677 tty_insert_flip_char(tty, 0, TTY_BREAK); 678 if (port->flags & ASYNC_SAK) 679 do_SAK(tty); ··· 688 pr_dbg("Intr: Unknown code in status packet.\n"); 689 break; 690 } 691 + } else { /* Data Packet */ 692 693 count = tty_prepare_flip_string(tty, &rp, byte_count & ~1); 694 pr_dbg("Intr: Can rx %d of %d bytes.\n", count, byte_count); ··· 697 insw(base, rp, word_count); 698 byte_count -= (word_count << 1); 699 if (count & 0x0001) { 700 + tty_insert_flip_char(tty, inw(base) & 0xff, 701 + TTY_NORMAL); 702 byte_count -= 2; 703 } 704 if (byte_count > 0) { ··· 714 ClearInterrupt(base); 715 else 716 outw(0x0000, base+0x04); /* enable interrupts */ 717 + 718 return IRQ_HANDLED; 719 } 720 ··· 885 return 0; 886 } 887 888 + static int block_til_ready(struct tty_struct *tty, struct file *filp, 889 + struct isi_port *port) 890 { 891 struct isi_board *card = port->card; 892 int do_clocal = 0, retval; ··· 905 906 /* if non-blocking mode is set ... */ 907 908 + if ((filp->f_flags & O_NONBLOCK) || 909 + (tty->flags & (1 << TTY_IO_ERROR))) { 910 pr_dbg("block_til_ready: non-block mode.\n"); 911 port->flags |= ASYNC_NORMAL_ACTIVE; 912 return 0; ··· 1051 card->count = 0; 1052 } 1053 1054 + /* last port was closed, shutdown that boad too */ 1055 if (C_HUPCL(tty)) { 1056 if (!card->count) 1057 isicom_shutdown_board(card); ··· 1078 } 1079 1080 if (tty->count == 1 && port->count != 1) { 1081 + printk(KERN_WARNING "ISICOM:(0x%lx) isicom_close: bad port " 1082 + "count tty->count = 1 port count = %d.\n", 1083 card->base, port->count); 1084 port->count = 1; 1085 } 1086 if (--port->count < 0) { 1087 + printk(KERN_WARNING "ISICOM:(0x%lx) isicom_close: bad port " 1088 + "count for channel%d = %d", card->base, port->channel, 1089 port->count); 1090 port->count = 0; 1091 } ··· 1121 spin_unlock_irqrestore(&card->card_lock, flags); 1122 if (port->close_delay) { 1123 pr_dbg("scheduling until time out.\n"); 1124 + msleep_interruptible( 1125 + jiffies_to_msecs(port->close_delay)); 1126 } 1127 spin_lock_irqsave(&card->card_lock, flags); 1128 wake_up_interruptible(&port->open_wait); ··· 1149 spin_lock_irqsave(&card->card_lock, flags); 1150 1151 while(1) { 1152 + cnt = min_t(int, count, min(SERIAL_XMIT_SIZE - port->xmit_cnt 1153 + - 1, SERIAL_XMIT_SIZE - port->xmit_head)); 1154 if (cnt <= 0) 1155 break; 1156 1157 memcpy(port->xmit_buf + port->xmit_head, buf, cnt); 1158 + port->xmit_head = (port->xmit_head + cnt) & (SERIAL_XMIT_SIZE 1159 + - 1); 1160 port->xmit_cnt += cnt; 1161 buf += cnt; 1162 count -= cnt; ··· 1200 if (isicom_paranoia_check(port, tty->name, "isicom_flush_chars")) 1201 return; 1202 1203 + if (port->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped || 1204 + !port->xmit_buf) 1205 return; 1206 1207 /* this tells the transmitter to consider this port for ··· 1233 } 1234 1235 /* ioctl et all */ 1236 + static inline void isicom_send_break(struct isi_port *port, 1237 + unsigned long length) 1238 { 1239 struct isi_board *card = port->card; 1240 unsigned long base = card->base; ··· 1368 return 0; 1369 1370 case TIOCGSOFTCAR: 1371 + return put_user(C_CLOCAL(tty) ? 1 : 0, 1372 + (unsigned long __user *)argp); 1373 1374 case TIOCSSOFTCAR: 1375 if (get_user(arg, (unsigned long __user *) argp))
+10 -11
include/linux/isicom.h
··· 9 #define YES 1 10 #define NO 0 11 12 - /* 13 * ISICOM Driver definitions ... 14 * 15 */ ··· 20 * PCI definitions 21 */ 22 23 - #define DEVID_COUNT 9 24 - #define VENDOR_ID 0x10b5 25 26 /* 27 * These are now officially allocated numbers ··· 31 #define ISICOM_CMAJOR 113 /* callout */ 32 #define ISICOM_MAGIC (('M' << 8) | 'T') 33 34 - #define WAKEUP_CHARS 256 /* hard coded for now */ 35 - #define TX_SIZE 254 36 - 37 #define BOARD_COUNT 4 38 #define PORT_COUNT (BOARD_COUNT*16) 39 ··· 66 #define BOARD(line) (((line) >> 4) & 0x3) 67 68 /* isi kill queue bitmap */ 69 - 70 #define ISICOM_KILLTX 0x01 71 #define ISICOM_KILLRX 0x02 72 73 /* isi_board status bitmap */ 74 - 75 #define FIRMWARE_LOADED 0x0001 76 #define BOARD_ACTIVE 0x0002 77 ··· 85 #define ISI_RTS 0x0200 86 87 88 - #define ISI_TXOK 0x0001 89 - 90 #endif /* __KERNEL__ */ 91 92 #endif /* ISICOM_H */ 93 -
··· 9 #define YES 1 10 #define NO 0 11 12 + /* 13 * ISICOM Driver definitions ... 14 * 15 */ ··· 20 * PCI definitions 21 */ 22 23 + #define DEVID_COUNT 9 24 + #define VENDOR_ID 0x10b5 25 26 /* 27 * These are now officially allocated numbers ··· 31 #define ISICOM_CMAJOR 113 /* callout */ 32 #define ISICOM_MAGIC (('M' << 8) | 'T') 33 34 + #define WAKEUP_CHARS 256 /* hard coded for now */ 35 + #define TX_SIZE 254 36 + 37 #define BOARD_COUNT 4 38 #define PORT_COUNT (BOARD_COUNT*16) 39 ··· 66 #define BOARD(line) (((line) >> 4) & 0x3) 67 68 /* isi kill queue bitmap */ 69 + 70 #define ISICOM_KILLTX 0x01 71 #define ISICOM_KILLRX 0x02 72 73 /* isi_board status bitmap */ 74 + 75 #define FIRMWARE_LOADED 0x0001 76 #define BOARD_ACTIVE 0x0002 77 ··· 85 #define ISI_RTS 0x0200 86 87 88 + #define ISI_TXOK 0x0001 89 + 90 #endif /* __KERNEL__ */ 91 92 #endif /* ISICOM_H */