diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-08-29 16:40:27 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-08-29 16:40:27 -0400 |
commit | c1b054d03f5b31c33eaa0b267c629b118eaf3790 (patch) | |
tree | 9333907ca767be24fcb3667877242976c3e3c8dd /drivers/serial/serial_core.c | |
parent | 559fb51ba7e66fe298b8355fabde1275b7def35f (diff) | |
parent | bf4e70e54cf31dcca48d279c7f7e71328eebe749 (diff) |
Merge /spare/repo/linux-2.6/
Diffstat (limited to 'drivers/serial/serial_core.c')
-rw-r--r-- | drivers/serial/serial_core.c | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index 36b1ae083fb..54699c3a00a 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c | |||
@@ -182,6 +182,13 @@ static int uart_startup(struct uart_state *state, int init_hw) | |||
182 | uart_set_mctrl(port, TIOCM_RTS | TIOCM_DTR); | 182 | uart_set_mctrl(port, TIOCM_RTS | TIOCM_DTR); |
183 | } | 183 | } |
184 | 184 | ||
185 | if (info->flags & UIF_CTS_FLOW) { | ||
186 | spin_lock_irq(&port->lock); | ||
187 | if (!(port->ops->get_mctrl(port) & TIOCM_CTS)) | ||
188 | info->tty->hw_stopped = 1; | ||
189 | spin_unlock_irq(&port->lock); | ||
190 | } | ||
191 | |||
185 | info->flags |= UIF_INITIALIZED; | 192 | info->flags |= UIF_INITIALIZED; |
186 | 193 | ||
187 | clear_bit(TTY_IO_ERROR, &info->tty->flags); | 194 | clear_bit(TTY_IO_ERROR, &info->tty->flags); |
@@ -828,7 +835,10 @@ static int uart_tiocmget(struct tty_struct *tty, struct file *file) | |||
828 | if ((!file || !tty_hung_up_p(file)) && | 835 | if ((!file || !tty_hung_up_p(file)) && |
829 | !(tty->flags & (1 << TTY_IO_ERROR))) { | 836 | !(tty->flags & (1 << TTY_IO_ERROR))) { |
830 | result = port->mctrl; | 837 | result = port->mctrl; |
838 | |||
839 | spin_lock_irq(&port->lock); | ||
831 | result |= port->ops->get_mctrl(port); | 840 | result |= port->ops->get_mctrl(port); |
841 | spin_unlock_irq(&port->lock); | ||
832 | } | 842 | } |
833 | up(&state->sem); | 843 | up(&state->sem); |
834 | 844 | ||
@@ -1131,6 +1141,16 @@ static void uart_set_termios(struct tty_struct *tty, struct termios *old_termios | |||
1131 | spin_unlock_irqrestore(&state->port->lock, flags); | 1141 | spin_unlock_irqrestore(&state->port->lock, flags); |
1132 | } | 1142 | } |
1133 | 1143 | ||
1144 | /* Handle turning on CRTSCTS */ | ||
1145 | if (!(old_termios->c_cflag & CRTSCTS) && (cflag & CRTSCTS)) { | ||
1146 | spin_lock_irqsave(&state->port->lock, flags); | ||
1147 | if (!(state->port->ops->get_mctrl(state->port) & TIOCM_CTS)) { | ||
1148 | tty->hw_stopped = 1; | ||
1149 | state->port->ops->stop_tx(state->port, 0); | ||
1150 | } | ||
1151 | spin_unlock_irqrestore(&state->port->lock, flags); | ||
1152 | } | ||
1153 | |||
1134 | #if 0 | 1154 | #if 0 |
1135 | /* | 1155 | /* |
1136 | * No need to wake up processes in open wait, since they | 1156 | * No need to wake up processes in open wait, since they |
@@ -1369,6 +1389,7 @@ uart_block_til_ready(struct file *filp, struct uart_state *state) | |||
1369 | DECLARE_WAITQUEUE(wait, current); | 1389 | DECLARE_WAITQUEUE(wait, current); |
1370 | struct uart_info *info = state->info; | 1390 | struct uart_info *info = state->info; |
1371 | struct uart_port *port = state->port; | 1391 | struct uart_port *port = state->port; |
1392 | unsigned int mctrl; | ||
1372 | 1393 | ||
1373 | info->blocked_open++; | 1394 | info->blocked_open++; |
1374 | state->count--; | 1395 | state->count--; |
@@ -1416,7 +1437,10 @@ uart_block_til_ready(struct file *filp, struct uart_state *state) | |||
1416 | * and wait for the carrier to indicate that the | 1437 | * and wait for the carrier to indicate that the |
1417 | * modem is ready for us. | 1438 | * modem is ready for us. |
1418 | */ | 1439 | */ |
1419 | if (port->ops->get_mctrl(port) & TIOCM_CAR) | 1440 | spin_lock_irq(&port->lock); |
1441 | mctrl = port->ops->get_mctrl(port); | ||
1442 | spin_unlock_irq(&port->lock); | ||
1443 | if (mctrl & TIOCM_CAR) | ||
1420 | break; | 1444 | break; |
1421 | 1445 | ||
1422 | up(&state->sem); | 1446 | up(&state->sem); |
@@ -1618,7 +1642,9 @@ static int uart_line_info(char *buf, struct uart_driver *drv, int i) | |||
1618 | 1642 | ||
1619 | if(capable(CAP_SYS_ADMIN)) | 1643 | if(capable(CAP_SYS_ADMIN)) |
1620 | { | 1644 | { |
1645 | spin_lock_irq(&port->lock); | ||
1621 | status = port->ops->get_mctrl(port); | 1646 | status = port->ops->get_mctrl(port); |
1647 | spin_unlock_irq(&port->lock); | ||
1622 | 1648 | ||
1623 | ret += sprintf(buf + ret, " tx:%d rx:%d", | 1649 | ret += sprintf(buf + ret, " tx:%d rx:%d", |
1624 | port->icount.tx, port->icount.rx); | 1650 | port->icount.tx, port->icount.rx); |
@@ -1782,6 +1808,12 @@ uart_set_options(struct uart_port *port, struct console *co, | |||
1782 | struct termios termios; | 1808 | struct termios termios; |
1783 | int i; | 1809 | int i; |
1784 | 1810 | ||
1811 | /* | ||
1812 | * Ensure that the serial console lock is initialised | ||
1813 | * early. | ||
1814 | */ | ||
1815 | spin_lock_init(&port->lock); | ||
1816 | |||
1785 | memset(&termios, 0, sizeof(struct termios)); | 1817 | memset(&termios, 0, sizeof(struct termios)); |
1786 | 1818 | ||
1787 | termios.c_cflag = CREAD | HUPCL | CLOCAL; | 1819 | termios.c_cflag = CREAD | HUPCL | CLOCAL; |
@@ -2170,10 +2202,16 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *port) | |||
2170 | 2202 | ||
2171 | state->port = port; | 2203 | state->port = port; |
2172 | 2204 | ||
2173 | spin_lock_init(&port->lock); | ||
2174 | port->cons = drv->cons; | 2205 | port->cons = drv->cons; |
2175 | port->info = state->info; | 2206 | port->info = state->info; |
2176 | 2207 | ||
2208 | /* | ||
2209 | * If this port is a console, then the spinlock is already | ||
2210 | * initialised. | ||
2211 | */ | ||
2212 | if (!uart_console(port)) | ||
2213 | spin_lock_init(&port->lock); | ||
2214 | |||
2177 | uart_configure_port(drv, state, port); | 2215 | uart_configure_port(drv, state, port); |
2178 | 2216 | ||
2179 | /* | 2217 | /* |