aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2008-02-08 07:18:53 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-08 12:22:25 -0500
commita46c9994242978ab001299cc9c906b9a3eedadcc (patch)
treee559a09485dd7a5bef311a96d8e4d9542c064952 /drivers/serial
parentb4c502a709e53e02ae5249a5f2f2b8292abc0386 (diff)
serial_core: bring mostly into line with coding style
Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/serial_core.c55
1 files changed, 28 insertions, 27 deletions
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index 276da148c57e..efef494d945a 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -58,7 +58,8 @@ static struct lock_class_key port_lock_key;
58#define uart_console(port) (0) 58#define uart_console(port) (0)
59#endif 59#endif
60 60
61static void uart_change_speed(struct uart_state *state, struct ktermios *old_termios); 61static void uart_change_speed(struct uart_state *state,
62 struct ktermios *old_termios);
62static void uart_wait_until_sent(struct tty_struct *tty, int timeout); 63static void uart_wait_until_sent(struct tty_struct *tty, int timeout);
63static void uart_change_pm(struct uart_state *state, int pm_state); 64static void uart_change_pm(struct uart_state *state, int pm_state);
64 65
@@ -129,8 +130,8 @@ uart_update_mctrl(struct uart_port *port, unsigned int set, unsigned int clear)
129 spin_unlock_irqrestore(&port->lock, flags); 130 spin_unlock_irqrestore(&port->lock, flags);
130} 131}
131 132
132#define uart_set_mctrl(port,set) uart_update_mctrl(port,set,0) 133#define uart_set_mctrl(port, set) uart_update_mctrl(port, set, 0)
133#define uart_clear_mctrl(port,clear) uart_update_mctrl(port,0,clear) 134#define uart_clear_mctrl(port, clear) uart_update_mctrl(port, 0, clear)
134 135
135/* 136/*
136 * Startup the port. This will be called once per open. All calls 137 * Startup the port. This will be called once per open. All calls
@@ -290,7 +291,7 @@ uart_update_timeout(struct uart_port *port, unsigned int cflag,
290 break; 291 break;
291 default: 292 default:
292 bits = 10; 293 bits = 10;
293 break; // CS8 294 break; /* CS8 */
294 } 295 }
295 296
296 if (cflag & CSTOPB) 297 if (cflag & CSTOPB)
@@ -622,7 +623,7 @@ static int uart_get_info(struct uart_state *state,
622 tmp.close_delay = state->close_delay / 10; 623 tmp.close_delay = state->close_delay / 10;
623 tmp.closing_wait = state->closing_wait == USF_CLOSING_WAIT_NONE ? 624 tmp.closing_wait = state->closing_wait == USF_CLOSING_WAIT_NONE ?
624 ASYNC_CLOSING_WAIT_NONE : 625 ASYNC_CLOSING_WAIT_NONE :
625 state->closing_wait / 10; 626 state->closing_wait / 10;
626 tmp.custom_divisor = port->custom_divisor; 627 tmp.custom_divisor = port->custom_divisor;
627 tmp.hub6 = port->hub6; 628 tmp.hub6 = port->hub6;
628 tmp.io_type = port->iotype; 629 tmp.io_type = port->iotype;
@@ -788,7 +789,8 @@ static int uart_set_info(struct uart_state *state,
788 * We failed anyway. 789 * We failed anyway.
789 */ 790 */
790 retval = -EBUSY; 791 retval = -EBUSY;
791 goto exit; // Added to return the correct error -Ram Gupta 792 /* Added to return the correct error -Ram Gupta */
793 goto exit;
792 } 794 }
793 } 795 }
794 796
@@ -858,7 +860,7 @@ static int uart_get_lsr_info(struct uart_state *state,
858 ((uart_circ_chars_pending(&state->info->xmit) > 0) && 860 ((uart_circ_chars_pending(&state->info->xmit) > 0) &&
859 !state->info->tty->stopped && !state->info->tty->hw_stopped)) 861 !state->info->tty->stopped && !state->info->tty->hw_stopped))
860 result &= ~TIOCSER_TEMT; 862 result &= ~TIOCSER_TEMT;
861 863
862 return put_user(result, value); 864 return put_user(result, value);
863} 865}
864 866
@@ -996,8 +998,8 @@ uart_wait_modem_status(struct uart_state *state, unsigned long arg)
996 ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) || 998 ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) ||
997 ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) || 999 ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) ||
998 ((arg & TIOCM_CTS) && (cnow.cts != cprev.cts))) { 1000 ((arg & TIOCM_CTS) && (cnow.cts != cprev.cts))) {
999 ret = 0; 1001 ret = 0;
1000 break; 1002 break;
1001 } 1003 }
1002 1004
1003 schedule(); 1005 schedule();
@@ -1137,7 +1139,8 @@ uart_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd,
1137 return ret; 1139 return ret;
1138} 1140}
1139 1141
1140static void uart_set_termios(struct tty_struct *tty, struct ktermios *old_termios) 1142static void uart_set_termios(struct tty_struct *tty,
1143 struct ktermios *old_termios)
1141{ 1144{
1142 struct uart_state *state = tty->driver_data; 1145 struct uart_state *state = tty->driver_data;
1143 unsigned long flags; 1146 unsigned long flags;
@@ -1213,7 +1216,7 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
1213{ 1216{
1214 struct uart_state *state = tty->driver_data; 1217 struct uart_state *state = tty->driver_data;
1215 struct uart_port *port; 1218 struct uart_port *port;
1216 1219
1217 BUG_ON(!kernel_locked()); 1220 BUG_ON(!kernel_locked());
1218 1221
1219 if (!state || !state->port) 1222 if (!state || !state->port)
@@ -1278,8 +1281,8 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
1278 uart_shutdown(state); 1281 uart_shutdown(state);
1279 uart_flush_buffer(tty); 1282 uart_flush_buffer(tty);
1280 1283
1281 tty_ldisc_flush(tty); 1284 tty_ldisc_flush(tty);
1282 1285
1283 tty->closing = 0; 1286 tty->closing = 0;
1284 state->info->tty = NULL; 1287 state->info->tty = NULL;
1285 1288
@@ -1341,7 +1344,7 @@ static void uart_wait_until_sent(struct tty_struct *tty, int timeout)
1341 expire = jiffies + timeout; 1344 expire = jiffies + timeout;
1342 1345
1343 pr_debug("uart_wait_until_sent(%d), jiffies=%lu, expire=%lu...\n", 1346 pr_debug("uart_wait_until_sent(%d), jiffies=%lu, expire=%lu...\n",
1344 port->line, jiffies, expire); 1347 port->line, jiffies, expire);
1345 1348
1346 /* 1349 /*
1347 * Check whether the transmitter is empty every 'char_time'. 1350 * Check whether the transmitter is empty every 'char_time'.
@@ -1460,10 +1463,9 @@ uart_block_til_ready(struct file *filp, struct uart_state *state)
1460 * have set TTY_IO_ERROR for a non-existant port. 1463 * have set TTY_IO_ERROR for a non-existant port.
1461 */ 1464 */
1462 if ((filp->f_flags & O_NONBLOCK) || 1465 if ((filp->f_flags & O_NONBLOCK) ||
1463 (info->tty->termios->c_cflag & CLOCAL) || 1466 (info->tty->termios->c_cflag & CLOCAL) ||
1464 (info->tty->flags & (1 << TTY_IO_ERROR))) { 1467 (info->tty->flags & (1 << TTY_IO_ERROR)))
1465 break; 1468 break;
1466 }
1467 1469
1468 /* 1470 /*
1469 * Set DTR to allow modem to know we're waiting. Do 1471 * Set DTR to allow modem to know we're waiting. Do
@@ -1674,7 +1676,7 @@ static int uart_line_info(char *buf, struct uart_driver *drv, int i)
1674 port->line, uart_type(port), 1676 port->line, uart_type(port),
1675 mmio ? "mmio:0x" : "port:", 1677 mmio ? "mmio:0x" : "port:",
1676 mmio ? (unsigned long long)port->mapbase 1678 mmio ? (unsigned long long)port->mapbase
1677 : (unsigned long long) port->iobase, 1679 : (unsigned long long) port->iobase,
1678 port->irq); 1680 port->irq);
1679 1681
1680 if (port->type == PORT_UNKNOWN) { 1682 if (port->type == PORT_UNKNOWN) {
@@ -1682,8 +1684,7 @@ static int uart_line_info(char *buf, struct uart_driver *drv, int i)
1682 return ret + 1; 1684 return ret + 1;
1683 } 1685 }
1684 1686
1685 if(capable(CAP_SYS_ADMIN)) 1687 if (capable(CAP_SYS_ADMIN)) {
1686 {
1687 mutex_lock(&state->mutex); 1688 mutex_lock(&state->mutex);
1688 pm_state = state->pm_state; 1689 pm_state = state->pm_state;
1689 if (pm_state) 1690 if (pm_state)
@@ -1709,12 +1710,12 @@ static int uart_line_info(char *buf, struct uart_driver *drv, int i)
1709 if (port->icount.overrun) 1710 if (port->icount.overrun)
1710 ret += sprintf(buf + ret, " oe:%d", 1711 ret += sprintf(buf + ret, " oe:%d",
1711 port->icount.overrun); 1712 port->icount.overrun);
1712 1713
1713#define INFOBIT(bit,str) \ 1714#define INFOBIT(bit, str) \
1714 if (port->mctrl & (bit)) \ 1715 if (port->mctrl & (bit)) \
1715 strncat(stat_buf, (str), sizeof(stat_buf) - \ 1716 strncat(stat_buf, (str), sizeof(stat_buf) - \
1716 strlen(stat_buf) - 2) 1717 strlen(stat_buf) - 2)
1717#define STATBIT(bit,str) \ 1718#define STATBIT(bit, str) \
1718 if (status & (bit)) \ 1719 if (status & (bit)) \
1719 strncat(stat_buf, (str), sizeof(stat_buf) - \ 1720 strncat(stat_buf, (str), sizeof(stat_buf) - \
1720 strlen(stat_buf) - 2) 1721 strlen(stat_buf) - 2)
@@ -1730,7 +1731,7 @@ static int uart_line_info(char *buf, struct uart_driver *drv, int i)
1730 if (stat_buf[0]) 1731 if (stat_buf[0])
1731 stat_buf[0] = ' '; 1732 stat_buf[0] = ' ';
1732 strcat(stat_buf, "\n"); 1733 strcat(stat_buf, "\n");
1733 1734
1734 ret += sprintf(buf + ret, stat_buf); 1735 ret += sprintf(buf + ret, stat_buf);
1735 } else { 1736 } else {
1736 strcat(buf, "\n"); 1737 strcat(buf, "\n");
@@ -1992,11 +1993,11 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *port)
1992 /* 1993 /*
1993 * Wait for the transmitter to empty. 1994 * Wait for the transmitter to empty.
1994 */ 1995 */
1995 for (tries = 3; !ops->tx_empty(port) && tries; tries--) { 1996 for (tries = 3; !ops->tx_empty(port) && tries; tries--)
1996 msleep(10); 1997 msleep(10);
1997 }
1998 if (!tries) 1998 if (!tries)
1999 printk(KERN_ERR "%s%s%s%d: Unable to drain transmitter\n", 1999 printk(KERN_ERR "%s%s%s%d: Unable to drain "
2000 "transmitter\n",
2000 port->dev ? port->dev->bus_id : "", 2001 port->dev ? port->dev->bus_id : "",
2001 port->dev ? ": " : "", 2002 port->dev ? ": " : "",
2002 drv->dev_name, port->line); 2003 drv->dev_name, port->line);