diff options
author | Alan Cox <alan@linux.intel.com> | 2009-09-19 16:13:31 -0400 |
---|---|---|
committer | Live-CD User <linux@linux.site> | 2009-09-19 16:13:31 -0400 |
commit | bdc04e3174e18f475289fa8f4144f66686326b7e (patch) | |
tree | c0bf03c8d6df1629bfa26b686fe65ffb0c87aeb7 /drivers/serial/serial_core.c | |
parent | a2bceae065ed8c4f552b35c4dde4cc2db05ce9e3 (diff) |
serial: move delta_msr_wait into the tty_port
This is used by various drivers not just serial and can be extracted
as commonality
Signed-off-by: Alan Cox <alan@linux.intel.com>
Diffstat (limited to 'drivers/serial/serial_core.c')
-rw-r--r-- | drivers/serial/serial_core.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index 9d42e57e197..e16d15343df 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c | |||
@@ -215,7 +215,8 @@ static int uart_startup(struct uart_state *state, int init_hw) | |||
215 | static void uart_shutdown(struct uart_state *state) | 215 | static void uart_shutdown(struct uart_state *state) |
216 | { | 216 | { |
217 | struct uart_port *uport = state->uart_port; | 217 | struct uart_port *uport = state->uart_port; |
218 | struct tty_struct *tty = state->port.tty; | 218 | struct tty_port *port = &state->port; |
219 | struct tty_struct *tty = port->tty; | ||
219 | 220 | ||
220 | /* | 221 | /* |
221 | * Set the TTY IO error marker | 222 | * Set the TTY IO error marker |
@@ -223,7 +224,7 @@ static void uart_shutdown(struct uart_state *state) | |||
223 | if (tty) | 224 | if (tty) |
224 | set_bit(TTY_IO_ERROR, &tty->flags); | 225 | set_bit(TTY_IO_ERROR, &tty->flags); |
225 | 226 | ||
226 | if (test_and_clear_bit(ASYNCB_INITIALIZED, &state->port.flags)) { | 227 | if (test_and_clear_bit(ASYNCB_INITIALIZED, &port->flags)) { |
227 | /* | 228 | /* |
228 | * Turn off DTR and RTS early. | 229 | * Turn off DTR and RTS early. |
229 | */ | 230 | */ |
@@ -237,7 +238,7 @@ static void uart_shutdown(struct uart_state *state) | |||
237 | * any outstanding file descriptors should be pointing at | 238 | * any outstanding file descriptors should be pointing at |
238 | * hung_up_tty_fops now. | 239 | * hung_up_tty_fops now. |
239 | */ | 240 | */ |
240 | wake_up_interruptible(&state->delta_msr_wait); | 241 | wake_up_interruptible(&port->delta_msr_wait); |
241 | 242 | ||
242 | /* | 243 | /* |
243 | * Free the IRQ and disable the port. | 244 | * Free the IRQ and disable the port. |
@@ -1004,11 +1005,15 @@ static int uart_do_autoconfig(struct uart_state *state) | |||
1004 | * - mask passed in arg for lines of interest | 1005 | * - mask passed in arg for lines of interest |
1005 | * (use |'ed TIOCM_RNG/DSR/CD/CTS for masking) | 1006 | * (use |'ed TIOCM_RNG/DSR/CD/CTS for masking) |
1006 | * Caller should use TIOCGICOUNT to see which one it was | 1007 | * Caller should use TIOCGICOUNT to see which one it was |
1008 | * | ||
1009 | * FIXME: This wants extracting into a common all driver implementation | ||
1010 | * of TIOCMWAIT using tty_port. | ||
1007 | */ | 1011 | */ |
1008 | static int | 1012 | static int |
1009 | uart_wait_modem_status(struct uart_state *state, unsigned long arg) | 1013 | uart_wait_modem_status(struct uart_state *state, unsigned long arg) |
1010 | { | 1014 | { |
1011 | struct uart_port *uport = state->uart_port; | 1015 | struct uart_port *uport = state->uart_port; |
1016 | struct tty_port *port = &state->port; | ||
1012 | DECLARE_WAITQUEUE(wait, current); | 1017 | DECLARE_WAITQUEUE(wait, current); |
1013 | struct uart_icount cprev, cnow; | 1018 | struct uart_icount cprev, cnow; |
1014 | int ret; | 1019 | int ret; |
@@ -1025,7 +1030,7 @@ uart_wait_modem_status(struct uart_state *state, unsigned long arg) | |||
1025 | uport->ops->enable_ms(uport); | 1030 | uport->ops->enable_ms(uport); |
1026 | spin_unlock_irq(&uport->lock); | 1031 | spin_unlock_irq(&uport->lock); |
1027 | 1032 | ||
1028 | add_wait_queue(&state->delta_msr_wait, &wait); | 1033 | add_wait_queue(&port->delta_msr_wait, &wait); |
1029 | for (;;) { | 1034 | for (;;) { |
1030 | spin_lock_irq(&uport->lock); | 1035 | spin_lock_irq(&uport->lock); |
1031 | memcpy(&cnow, &uport->icount, sizeof(struct uart_icount)); | 1036 | memcpy(&cnow, &uport->icount, sizeof(struct uart_icount)); |
@@ -1053,7 +1058,7 @@ uart_wait_modem_status(struct uart_state *state, unsigned long arg) | |||
1053 | } | 1058 | } |
1054 | 1059 | ||
1055 | current->state = TASK_RUNNING; | 1060 | current->state = TASK_RUNNING; |
1056 | remove_wait_queue(&state->delta_msr_wait, &wait); | 1061 | remove_wait_queue(&port->delta_msr_wait, &wait); |
1057 | 1062 | ||
1058 | return ret; | 1063 | return ret; |
1059 | } | 1064 | } |
@@ -1430,7 +1435,7 @@ static void uart_hangup(struct tty_struct *tty) | |||
1430 | clear_bit(ASYNCB_NORMAL_ACTIVE, &port->flags); | 1435 | clear_bit(ASYNCB_NORMAL_ACTIVE, &port->flags); |
1431 | port->tty = NULL; | 1436 | port->tty = NULL; |
1432 | wake_up_interruptible(&port->open_wait); | 1437 | wake_up_interruptible(&port->open_wait); |
1433 | wake_up_interruptible(&state->delta_msr_wait); | 1438 | wake_up_interruptible(&port->delta_msr_wait); |
1434 | } | 1439 | } |
1435 | mutex_unlock(&port->mutex); | 1440 | mutex_unlock(&port->mutex); |
1436 | } | 1441 | } |
@@ -2378,7 +2383,6 @@ int uart_register_driver(struct uart_driver *drv) | |||
2378 | tty_port_init(port); | 2383 | tty_port_init(port); |
2379 | port->close_delay = 500; /* .5 seconds */ | 2384 | port->close_delay = 500; /* .5 seconds */ |
2380 | port->closing_wait = 30000; /* 30 seconds */ | 2385 | port->closing_wait = 30000; /* 30 seconds */ |
2381 | init_waitqueue_head(&state->delta_msr_wait); | ||
2382 | tasklet_init(&state->tlet, uart_tasklet_action, | 2386 | tasklet_init(&state->tlet, uart_tasklet_action, |
2383 | (unsigned long)state); | 2387 | (unsigned long)state); |
2384 | } | 2388 | } |