Commit a547dfe9 authored by Jiri Slaby's avatar Jiri Slaby Committed by Linus Torvalds

[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: default avatarJiri Slaby <xslaby@fi.muni.cz>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent e65c1db1
...@@ -189,7 +189,7 @@ struct isi_board { ...@@ -189,7 +189,7 @@ struct isi_board {
unsigned char irq; unsigned char irq;
unsigned char port_count; unsigned char port_count;
unsigned short status; unsigned short status;
unsigned short port_status; /* each bit represents a single port */ unsigned short port_status; /* each bit for each port */
unsigned short shift_count; unsigned short shift_count;
struct isi_port * ports; struct isi_port * ports;
signed char count; signed char count;
...@@ -242,7 +242,9 @@ static int lock_card(struct isi_board *card) ...@@ -242,7 +242,9 @@ static int lock_card(struct isi_board *card)
udelay(1000); /* 1ms */ udelay(1000); /* 1ms */
} }
} }
printk(KERN_WARNING "ISICOM: Failed to lock Card (0x%lx)\n", card->base); printk(KERN_WARNING "ISICOM: Failed to lock Card (0x%lx)\n",
card->base);
return 0; /* Failed to aquire the card! */ return 0; /* Failed to aquire the card! */
} }
...@@ -466,33 +468,36 @@ static void isicom_tx(unsigned long _data) ...@@ -466,33 +468,36 @@ static void isicom_tx(unsigned long _data)
residue = NO; residue = NO;
wrd = 0; wrd = 0;
while (1) { while (1) {
cnt = min_t(int, txcount, (SERIAL_XMIT_SIZE - port->xmit_tail)); cnt = min_t(int, txcount, (SERIAL_XMIT_SIZE
- port->xmit_tail));
if (residue == YES) { if (residue == YES) {
residue = NO; residue = NO;
if (cnt > 0) { if (cnt > 0) {
wrd |= (port->xmit_buf[port->xmit_tail] << 8); wrd |= (port->xmit_buf[port->xmit_tail]
port->xmit_tail = (port->xmit_tail + 1) & (SERIAL_XMIT_SIZE - 1); << 8);
port->xmit_tail = (port->xmit_tail + 1)
& (SERIAL_XMIT_SIZE - 1);
port->xmit_cnt--; port->xmit_cnt--;
txcount--; txcount--;
cnt--; cnt--;
outw(wrd, base); outw(wrd, base);
} } else {
else {
outw(wrd, base); outw(wrd, base);
break; break;
} }
} }
if (cnt <= 0) break; if (cnt <= 0) break;
word_count = cnt >> 1; word_count = cnt >> 1;
outsw(base, port->xmit_buf+port->xmit_tail, word_count); outsw(base, port->xmit_buf+port->xmit_tail,word_count);
port->xmit_tail = (port->xmit_tail + (word_count << 1)) & port->xmit_tail = (port->xmit_tail
(SERIAL_XMIT_SIZE - 1); + (word_count << 1)) & (SERIAL_XMIT_SIZE - 1);
txcount -= (word_count << 1); txcount -= (word_count << 1);
port->xmit_cnt -= (word_count << 1); port->xmit_cnt -= (word_count << 1);
if (cnt & 0x0001) { if (cnt & 0x0001) {
residue = YES; residue = YES;
wrd = port->xmit_buf[port->xmit_tail]; wrd = port->xmit_buf[port->xmit_tail];
port->xmit_tail = (port->xmit_tail + 1) & (SERIAL_XMIT_SIZE - 1); port->xmit_tail = (port->xmit_tail + 1)
& (SERIAL_XMIT_SIZE - 1);
port->xmit_cnt--; port->xmit_cnt--;
txcount--; txcount--;
} }
...@@ -572,8 +577,8 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -572,8 +577,8 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id, struct pt_regs *regs)
byte_count = header & 0xff; byte_count = header & 0xff;
if (channel + 1 > card->port_count) { if (channel + 1 > card->port_count) {
printk(KERN_WARNING "ISICOM: isicom_interrupt(0x%lx): %d(channel) > port_count.\n", printk(KERN_WARNING "ISICOM: isicom_interrupt(0x%lx): "
base, channel+1); "%d(channel) > port_count.\n", base, channel+1);
if (card->isa) if (card->isa)
ClearInterrupt(base); ClearInterrupt(base);
else else
...@@ -611,26 +616,22 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -611,26 +616,22 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id, struct pt_regs *regs)
header = inw(base); header = inw(base);
switch(header & 0xff) { switch(header & 0xff) {
case 0: /* Change in EIA signals */ case 0: /* Change in EIA signals */
if (port->flags & ASYNC_CHECK_CD) { if (port->flags & ASYNC_CHECK_CD) {
if (port->status & ISI_DCD) { if (port->status & ISI_DCD) {
if (!(header & ISI_DCD)) { if (!(header & ISI_DCD)) {
/* Carrier has been lost */ /* Carrier has been lost */
pr_dbg("interrupt: DCD->low.\n"); pr_dbg("interrupt: DCD->low.\n"
);
port->status &= ~ISI_DCD; port->status &= ~ISI_DCD;
schedule_work(&port->hangup_tq); schedule_work(&port->hangup_tq);
} }
} else if (header & ISI_DCD) {
/* Carrier has been detected */
pr_dbg("interrupt: DCD->high.\n");
port->status |= ISI_DCD;
wake_up_interruptible(&port->open_wait);
} }
else { } else {
if (header & ISI_DCD) {
/* Carrier has been detected */
pr_dbg("interrupt: DCD->high.\n");
port->status |= ISI_DCD;
wake_up_interruptible(&port->open_wait);
}
}
}
else {
if (header & ISI_DCD) if (header & ISI_DCD)
port->status |= ISI_DCD; port->status |= ISI_DCD;
else else
...@@ -642,19 +643,16 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -642,19 +643,16 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id, struct pt_regs *regs)
if (header & ISI_CTS) { if (header & ISI_CTS) {
port->tty->hw_stopped = 0; port->tty->hw_stopped = 0;
/* start tx ing */ /* start tx ing */
port->status |= (ISI_TXOK | ISI_CTS); port->status |= (ISI_TXOK
| ISI_CTS);
schedule_work(&port->bh_tqueue); schedule_work(&port->bh_tqueue);
} }
} else if (!(header & ISI_CTS)) {
port->tty->hw_stopped = 1;
/* stop tx ing */
port->status &= ~(ISI_TXOK | ISI_CTS);
} }
else { } else {
if (!(header & ISI_CTS)) {
port->tty->hw_stopped = 1;
/* stop tx ing */
port->status &= ~(ISI_TXOK | ISI_CTS);
}
}
}
else {
if (header & ISI_CTS) if (header & ISI_CTS)
port->status |= ISI_CTS; port->status |= ISI_CTS;
else else
...@@ -673,7 +671,7 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -673,7 +671,7 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id, struct pt_regs *regs)
break; break;
case 1: /* Received Break !!! */ case 1: /* Received Break !!! */
tty_insert_flip_char(tty, 0, TTY_BREAK); tty_insert_flip_char(tty, 0, TTY_BREAK);
if (port->flags & ASYNC_SAK) if (port->flags & ASYNC_SAK)
do_SAK(tty); do_SAK(tty);
...@@ -688,8 +686,7 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -688,8 +686,7 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id, struct pt_regs *regs)
pr_dbg("Intr: Unknown code in status packet.\n"); pr_dbg("Intr: Unknown code in status packet.\n");
break; break;
} }
} } else { /* Data Packet */
else { /* Data Packet */
count = tty_prepare_flip_string(tty, &rp, byte_count & ~1); count = tty_prepare_flip_string(tty, &rp, byte_count & ~1);
pr_dbg("Intr: Can rx %d of %d bytes.\n", count, byte_count); pr_dbg("Intr: Can rx %d of %d bytes.\n", count, byte_count);
...@@ -697,7 +694,8 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -697,7 +694,8 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id, struct pt_regs *regs)
insw(base, rp, word_count); insw(base, rp, word_count);
byte_count -= (word_count << 1); byte_count -= (word_count << 1);
if (count & 0x0001) { if (count & 0x0001) {
tty_insert_flip_char(tty, inw(base) & 0xff, TTY_NORMAL); tty_insert_flip_char(tty, inw(base) & 0xff,
TTY_NORMAL);
byte_count -= 2; byte_count -= 2;
} }
if (byte_count > 0) { if (byte_count > 0) {
...@@ -714,6 +712,7 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -714,6 +712,7 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id, struct pt_regs *regs)
ClearInterrupt(base); ClearInterrupt(base);
else else
outw(0x0000, base+0x04); /* enable interrupts */ outw(0x0000, base+0x04); /* enable interrupts */
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -885,7 +884,8 @@ static int isicom_setup_port(struct isi_port *port) ...@@ -885,7 +884,8 @@ static int isicom_setup_port(struct isi_port *port)
return 0; return 0;
} }
static int block_til_ready(struct tty_struct *tty, struct file *filp, struct isi_port *port) static int block_til_ready(struct tty_struct *tty, struct file *filp,
struct isi_port *port)
{ {
struct isi_board *card = port->card; struct isi_board *card = port->card;
int do_clocal = 0, retval; int do_clocal = 0, retval;
...@@ -905,7 +905,8 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, struct isi ...@@ -905,7 +905,8 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, struct isi
/* if non-blocking mode is set ... */ /* if non-blocking mode is set ... */
if ((filp->f_flags & O_NONBLOCK) || (tty->flags & (1 << TTY_IO_ERROR))) { if ((filp->f_flags & O_NONBLOCK) ||
(tty->flags & (1 << TTY_IO_ERROR))) {
pr_dbg("block_til_ready: non-block mode.\n"); pr_dbg("block_til_ready: non-block mode.\n");
port->flags |= ASYNC_NORMAL_ACTIVE; port->flags |= ASYNC_NORMAL_ACTIVE;
return 0; return 0;
...@@ -1051,7 +1052,7 @@ static void isicom_shutdown_port(struct isi_port *port) ...@@ -1051,7 +1052,7 @@ static void isicom_shutdown_port(struct isi_port *port)
card->count = 0; card->count = 0;
} }
/* last port was closed , shutdown that boad too */ /* last port was closed, shutdown that boad too */
if (C_HUPCL(tty)) { if (C_HUPCL(tty)) {
if (!card->count) if (!card->count)
isicom_shutdown_board(card); isicom_shutdown_board(card);
...@@ -1078,14 +1079,14 @@ static void isicom_close(struct tty_struct *tty, struct file *filp) ...@@ -1078,14 +1079,14 @@ static void isicom_close(struct tty_struct *tty, struct file *filp)
} }
if (tty->count == 1 && port->count != 1) { if (tty->count == 1 && port->count != 1) {
printk(KERN_WARNING "ISICOM:(0x%lx) isicom_close: bad port count" printk(KERN_WARNING "ISICOM:(0x%lx) isicom_close: bad port "
"tty->count = 1 port count = %d.\n", "count tty->count = 1 port count = %d.\n",
card->base, port->count); card->base, port->count);
port->count = 1; port->count = 1;
} }
if (--port->count < 0) { if (--port->count < 0) {
printk(KERN_WARNING "ISICOM:(0x%lx) isicom_close: bad port count for" printk(KERN_WARNING "ISICOM:(0x%lx) isicom_close: bad port "
"channel%d = %d", card->base, port->channel, "count for channel%d = %d", card->base, port->channel,
port->count); port->count);
port->count = 0; port->count = 0;
} }
...@@ -1121,7 +1122,8 @@ static void isicom_close(struct tty_struct *tty, struct file *filp) ...@@ -1121,7 +1122,8 @@ static void isicom_close(struct tty_struct *tty, struct file *filp)
spin_unlock_irqrestore(&card->card_lock, flags); spin_unlock_irqrestore(&card->card_lock, flags);
if (port->close_delay) { if (port->close_delay) {
pr_dbg("scheduling until time out.\n"); pr_dbg("scheduling until time out.\n");
msleep_interruptible(jiffies_to_msecs(port->close_delay)); msleep_interruptible(
jiffies_to_msecs(port->close_delay));
} }
spin_lock_irqsave(&card->card_lock, flags); spin_lock_irqsave(&card->card_lock, flags);
wake_up_interruptible(&port->open_wait); wake_up_interruptible(&port->open_wait);
...@@ -1149,13 +1151,14 @@ static int isicom_write(struct tty_struct *tty, const unsigned char *buf, ...@@ -1149,13 +1151,14 @@ static int isicom_write(struct tty_struct *tty, const unsigned char *buf,
spin_lock_irqsave(&card->card_lock, flags); spin_lock_irqsave(&card->card_lock, flags);
while(1) { while(1) {
cnt = min_t(int, count, min(SERIAL_XMIT_SIZE - port->xmit_cnt - 1, cnt = min_t(int, count, min(SERIAL_XMIT_SIZE - port->xmit_cnt
SERIAL_XMIT_SIZE - port->xmit_head)); - 1, SERIAL_XMIT_SIZE - port->xmit_head));
if (cnt <= 0) if (cnt <= 0)
break; break;
memcpy(port->xmit_buf + port->xmit_head, buf, cnt); memcpy(port->xmit_buf + port->xmit_head, buf, cnt);
port->xmit_head = (port->xmit_head + cnt) & (SERIAL_XMIT_SIZE - 1); port->xmit_head = (port->xmit_head + cnt) & (SERIAL_XMIT_SIZE
- 1);
port->xmit_cnt += cnt; port->xmit_cnt += cnt;
buf += cnt; buf += cnt;
count -= cnt; count -= cnt;
...@@ -1200,7 +1203,8 @@ static void isicom_flush_chars(struct tty_struct *tty) ...@@ -1200,7 +1203,8 @@ static void isicom_flush_chars(struct tty_struct *tty)
if (isicom_paranoia_check(port, tty->name, "isicom_flush_chars")) if (isicom_paranoia_check(port, tty->name, "isicom_flush_chars"))
return; return;
if (port->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped || !port->xmit_buf) if (port->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped ||
!port->xmit_buf)
return; return;
/* this tells the transmitter to consider this port for /* this tells the transmitter to consider this port for
...@@ -1233,7 +1237,8 @@ static int isicom_chars_in_buffer(struct tty_struct *tty) ...@@ -1233,7 +1237,8 @@ static int isicom_chars_in_buffer(struct tty_struct *tty)
} }
/* ioctl et all */ /* ioctl et all */
static inline void isicom_send_break(struct isi_port *port, unsigned long length) static inline void isicom_send_break(struct isi_port *port,
unsigned long length)
{ {
struct isi_board *card = port->card; struct isi_board *card = port->card;
unsigned long base = card->base; unsigned long base = card->base;
...@@ -1368,7 +1373,8 @@ static int isicom_ioctl(struct tty_struct *tty, struct file *filp, ...@@ -1368,7 +1373,8 @@ static int isicom_ioctl(struct tty_struct *tty, struct file *filp,
return 0; return 0;
case TIOCGSOFTCAR: case TIOCGSOFTCAR:
return put_user(C_CLOCAL(tty) ? 1 : 0, (unsigned long __user *)argp); return put_user(C_CLOCAL(tty) ? 1 : 0,
(unsigned long __user *)argp);
case TIOCSSOFTCAR: case TIOCSSOFTCAR:
if (get_user(arg, (unsigned long __user *) argp)) if (get_user(arg, (unsigned long __user *) argp))
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#define YES 1 #define YES 1
#define NO 0 #define NO 0
/* /*
* ISICOM Driver definitions ... * ISICOM Driver definitions ...
* *
*/ */
...@@ -20,8 +20,8 @@ ...@@ -20,8 +20,8 @@
* PCI definitions * PCI definitions
*/ */
#define DEVID_COUNT 9 #define DEVID_COUNT 9
#define VENDOR_ID 0x10b5 #define VENDOR_ID 0x10b5
/* /*
* These are now officially allocated numbers * These are now officially allocated numbers
...@@ -31,9 +31,9 @@ ...@@ -31,9 +31,9 @@
#define ISICOM_CMAJOR 113 /* callout */ #define ISICOM_CMAJOR 113 /* callout */
#define ISICOM_MAGIC (('M' << 8) | 'T') #define ISICOM_MAGIC (('M' << 8) | 'T')
#define WAKEUP_CHARS 256 /* hard coded for now */ #define WAKEUP_CHARS 256 /* hard coded for now */
#define TX_SIZE 254 #define TX_SIZE 254
#define BOARD_COUNT 4 #define BOARD_COUNT 4
#define PORT_COUNT (BOARD_COUNT*16) #define PORT_COUNT (BOARD_COUNT*16)
...@@ -66,12 +66,12 @@ ...@@ -66,12 +66,12 @@
#define BOARD(line) (((line) >> 4) & 0x3) #define BOARD(line) (((line) >> 4) & 0x3)
/* isi kill queue bitmap */ /* isi kill queue bitmap */
#define ISICOM_KILLTX 0x01 #define ISICOM_KILLTX 0x01
#define ISICOM_KILLRX 0x02 #define ISICOM_KILLRX 0x02
/* isi_board status bitmap */ /* isi_board status bitmap */
#define FIRMWARE_LOADED 0x0001 #define FIRMWARE_LOADED 0x0001
#define BOARD_ACTIVE 0x0002 #define BOARD_ACTIVE 0x0002
...@@ -85,9 +85,8 @@ ...@@ -85,9 +85,8 @@
#define ISI_RTS 0x0200 #define ISI_RTS 0x0200
#define ISI_TXOK 0x0001 #define ISI_TXOK 0x0001
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* ISICOM_H */ #endif /* ISICOM_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment