diff options
-rw-r--r-- | drivers/serial/serial_core.c | 153 | ||||
-rw-r--r-- | include/linux/serial.h | 2 | ||||
-rw-r--r-- | include/linux/serial_core.h | 48 |
3 files changed, 98 insertions, 105 deletions
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index 4af3364dd811..744dec9301fb 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c | |||
@@ -29,10 +29,10 @@ | |||
29 | #include <linux/console.h> | 29 | #include <linux/console.h> |
30 | #include <linux/proc_fs.h> | 30 | #include <linux/proc_fs.h> |
31 | #include <linux/seq_file.h> | 31 | #include <linux/seq_file.h> |
32 | #include <linux/serial_core.h> | ||
33 | #include <linux/smp_lock.h> | 32 | #include <linux/smp_lock.h> |
34 | #include <linux/device.h> | 33 | #include <linux/device.h> |
35 | #include <linux/serial.h> /* for serial_state and serial_icounter_struct */ | 34 | #include <linux/serial.h> /* for serial_state and serial_icounter_struct */ |
35 | #include <linux/serial_core.h> | ||
36 | #include <linux/delay.h> | 36 | #include <linux/delay.h> |
37 | #include <linux/mutex.h> | 37 | #include <linux/mutex.h> |
38 | 38 | ||
@@ -146,7 +146,7 @@ static int uart_startup(struct uart_state *state, int init_hw) | |||
146 | unsigned long page; | 146 | unsigned long page; |
147 | int retval = 0; | 147 | int retval = 0; |
148 | 148 | ||
149 | if (state->flags & UIF_INITIALIZED) | 149 | if (port->flags & ASYNC_INITIALIZED) |
150 | return 0; | 150 | return 0; |
151 | 151 | ||
152 | /* | 152 | /* |
@@ -189,14 +189,14 @@ static int uart_startup(struct uart_state *state, int init_hw) | |||
189 | uart_set_mctrl(uport, TIOCM_RTS | TIOCM_DTR); | 189 | uart_set_mctrl(uport, TIOCM_RTS | TIOCM_DTR); |
190 | } | 190 | } |
191 | 191 | ||
192 | if (state->flags & UIF_CTS_FLOW) { | 192 | if (port->flags & ASYNC_CTS_FLOW) { |
193 | spin_lock_irq(&uport->lock); | 193 | spin_lock_irq(&uport->lock); |
194 | if (!(uport->ops->get_mctrl(uport) & TIOCM_CTS)) | 194 | if (!(uport->ops->get_mctrl(uport) & TIOCM_CTS)) |
195 | port->tty->hw_stopped = 1; | 195 | port->tty->hw_stopped = 1; |
196 | spin_unlock_irq(&uport->lock); | 196 | spin_unlock_irq(&uport->lock); |
197 | } | 197 | } |
198 | 198 | ||
199 | state->flags |= UIF_INITIALIZED; | 199 | set_bit(ASYNCB_INITIALIZED, &port->flags); |
200 | 200 | ||
201 | clear_bit(TTY_IO_ERROR, &port->tty->flags); | 201 | clear_bit(TTY_IO_ERROR, &port->tty->flags); |
202 | } | 202 | } |
@@ -214,7 +214,7 @@ static int uart_startup(struct uart_state *state, int init_hw) | |||
214 | */ | 214 | */ |
215 | static void uart_shutdown(struct uart_state *state) | 215 | static void uart_shutdown(struct uart_state *state) |
216 | { | 216 | { |
217 | struct uart_port *port = state->uart_port; | 217 | struct uart_port *uport = state->uart_port; |
218 | struct tty_struct *tty = state->port.tty; | 218 | struct tty_struct *tty = state->port.tty; |
219 | 219 | ||
220 | /* | 220 | /* |
@@ -223,14 +223,12 @@ static void uart_shutdown(struct uart_state *state) | |||
223 | if (tty) | 223 | if (tty) |
224 | set_bit(TTY_IO_ERROR, &tty->flags); | 224 | set_bit(TTY_IO_ERROR, &tty->flags); |
225 | 225 | ||
226 | if (state->flags & UIF_INITIALIZED) { | 226 | if (test_and_clear_bit(ASYNCB_INITIALIZED, &state->port.flags)) { |
227 | state->flags &= ~UIF_INITIALIZED; | ||
228 | |||
229 | /* | 227 | /* |
230 | * Turn off DTR and RTS early. | 228 | * Turn off DTR and RTS early. |
231 | */ | 229 | */ |
232 | if (!tty || (tty->termios->c_cflag & HUPCL)) | 230 | if (!tty || (tty->termios->c_cflag & HUPCL)) |
233 | uart_clear_mctrl(port, TIOCM_DTR | TIOCM_RTS); | 231 | uart_clear_mctrl(uport, TIOCM_DTR | TIOCM_RTS); |
234 | 232 | ||
235 | /* | 233 | /* |
236 | * clear delta_msr_wait queue to avoid mem leaks: we may free | 234 | * clear delta_msr_wait queue to avoid mem leaks: we may free |
@@ -244,12 +242,12 @@ static void uart_shutdown(struct uart_state *state) | |||
244 | /* | 242 | /* |
245 | * Free the IRQ and disable the port. | 243 | * Free the IRQ and disable the port. |
246 | */ | 244 | */ |
247 | port->ops->shutdown(port); | 245 | uport->ops->shutdown(uport); |
248 | 246 | ||
249 | /* | 247 | /* |
250 | * Ensure that the IRQ handler isn't running on another CPU. | 248 | * Ensure that the IRQ handler isn't running on another CPU. |
251 | */ | 249 | */ |
252 | synchronize_irq(port->irq); | 250 | synchronize_irq(uport->irq); |
253 | } | 251 | } |
254 | 252 | ||
255 | /* | 253 | /* |
@@ -429,15 +427,16 @@ EXPORT_SYMBOL(uart_get_divisor); | |||
429 | static void | 427 | static void |
430 | uart_change_speed(struct uart_state *state, struct ktermios *old_termios) | 428 | uart_change_speed(struct uart_state *state, struct ktermios *old_termios) |
431 | { | 429 | { |
432 | struct tty_struct *tty = state->port.tty; | 430 | struct tty_port *port = &state->port; |
433 | struct uart_port *port = state->uart_port; | 431 | struct tty_struct *tty = port->tty; |
432 | struct uart_port *uport = state->uart_port; | ||
434 | struct ktermios *termios; | 433 | struct ktermios *termios; |
435 | 434 | ||
436 | /* | 435 | /* |
437 | * If we have no tty, termios, or the port does not exist, | 436 | * If we have no tty, termios, or the port does not exist, |
438 | * then we can't set the parameters for this port. | 437 | * then we can't set the parameters for this port. |
439 | */ | 438 | */ |
440 | if (!tty || !tty->termios || port->type == PORT_UNKNOWN) | 439 | if (!tty || !tty->termios || uport->type == PORT_UNKNOWN) |
441 | return; | 440 | return; |
442 | 441 | ||
443 | termios = tty->termios; | 442 | termios = tty->termios; |
@@ -446,16 +445,16 @@ uart_change_speed(struct uart_state *state, struct ktermios *old_termios) | |||
446 | * Set flags based on termios cflag | 445 | * Set flags based on termios cflag |
447 | */ | 446 | */ |
448 | if (termios->c_cflag & CRTSCTS) | 447 | if (termios->c_cflag & CRTSCTS) |
449 | state->flags |= UIF_CTS_FLOW; | 448 | set_bit(ASYNCB_CTS_FLOW, &port->flags); |
450 | else | 449 | else |
451 | state->flags &= ~UIF_CTS_FLOW; | 450 | clear_bit(ASYNCB_CTS_FLOW, &port->flags); |
452 | 451 | ||
453 | if (termios->c_cflag & CLOCAL) | 452 | if (termios->c_cflag & CLOCAL) |
454 | state->flags &= ~UIF_CHECK_CD; | 453 | clear_bit(ASYNCB_CHECK_CD, &port->flags); |
455 | else | 454 | else |
456 | state->flags |= UIF_CHECK_CD; | 455 | set_bit(ASYNCB_CHECK_CD, &port->flags); |
457 | 456 | ||
458 | port->ops->set_termios(port, termios, old_termios); | 457 | uport->ops->set_termios(uport, termios, old_termios); |
459 | } | 458 | } |
460 | 459 | ||
461 | static inline int | 460 | static inline int |
@@ -848,7 +847,7 @@ static int uart_set_info(struct uart_state *state, | |||
848 | retval = 0; | 847 | retval = 0; |
849 | if (uport->type == PORT_UNKNOWN) | 848 | if (uport->type == PORT_UNKNOWN) |
850 | goto exit; | 849 | goto exit; |
851 | if (state->flags & UIF_INITIALIZED) { | 850 | if (port->flags & ASYNC_INITIALIZED) { |
852 | if (((old_flags ^ uport->flags) & UPF_SPD_MASK) || | 851 | if (((old_flags ^ uport->flags) & UPF_SPD_MASK) || |
853 | old_custom_divisor != uport->custom_divisor) { | 852 | old_custom_divisor != uport->custom_divisor) { |
854 | /* | 853 | /* |
@@ -1306,7 +1305,7 @@ static void uart_close(struct tty_struct *tty, struct file *filp) | |||
1306 | * At this point, we stop accepting input. To do this, we | 1305 | * At this point, we stop accepting input. To do this, we |
1307 | * disable the receive line status interrupts. | 1306 | * disable the receive line status interrupts. |
1308 | */ | 1307 | */ |
1309 | if (state->flags & UIF_INITIALIZED) { | 1308 | if (port->flags & ASYNC_INITIALIZED) { |
1310 | unsigned long flags; | 1309 | unsigned long flags; |
1311 | spin_lock_irqsave(&port->lock, flags); | 1310 | spin_lock_irqsave(&port->lock, flags); |
1312 | uport->ops->stop_rx(uport); | 1311 | uport->ops->stop_rx(uport); |
@@ -1337,7 +1336,7 @@ static void uart_close(struct tty_struct *tty, struct file *filp) | |||
1337 | /* | 1336 | /* |
1338 | * Wake up anyone trying to open this port. | 1337 | * Wake up anyone trying to open this port. |
1339 | */ | 1338 | */ |
1340 | state->flags &= ~UIF_NORMAL_ACTIVE; | 1339 | clear_bit(ASYNCB_NORMAL_ACTIVE, &port->flags); |
1341 | wake_up_interruptible(&port->open_wait); | 1340 | wake_up_interruptible(&port->open_wait); |
1342 | 1341 | ||
1343 | done: | 1342 | done: |
@@ -1418,11 +1417,11 @@ static void uart_hangup(struct tty_struct *tty) | |||
1418 | pr_debug("uart_hangup(%d)\n", state->uart_port->line); | 1417 | pr_debug("uart_hangup(%d)\n", state->uart_port->line); |
1419 | 1418 | ||
1420 | mutex_lock(&state->mutex); | 1419 | mutex_lock(&state->mutex); |
1421 | if (state->flags & UIF_NORMAL_ACTIVE) { | 1420 | if (port->flags & ASYNC_NORMAL_ACTIVE) { |
1422 | uart_flush_buffer(tty); | 1421 | uart_flush_buffer(tty); |
1423 | uart_shutdown(state); | 1422 | uart_shutdown(state); |
1424 | port->count = 0; | 1423 | port->count = 0; |
1425 | state->flags &= ~UIF_NORMAL_ACTIVE; | 1424 | clear_bit(ASYNCB_NORMAL_ACTIVE, &port->flags); |
1426 | port->tty = NULL; | 1425 | port->tty = NULL; |
1427 | wake_up_interruptible(&port->open_wait); | 1426 | wake_up_interruptible(&port->open_wait); |
1428 | wake_up_interruptible(&state->delta_msr_wait); | 1427 | wake_up_interruptible(&state->delta_msr_wait); |
@@ -1493,7 +1492,7 @@ uart_block_til_ready(struct file *filp, struct uart_state *state) | |||
1493 | /* | 1492 | /* |
1494 | * If the port has been closed, tell userspace/restart open. | 1493 | * If the port has been closed, tell userspace/restart open. |
1495 | */ | 1494 | */ |
1496 | if (!(state->flags & UIF_INITIALIZED)) | 1495 | if (!(port->flags & ASYNC_INITIALIZED)) |
1497 | break; | 1496 | break; |
1498 | 1497 | ||
1499 | /* | 1498 | /* |
@@ -1662,8 +1661,8 @@ static int uart_open(struct tty_struct *tty, struct file *filp) | |||
1662 | /* | 1661 | /* |
1663 | * If this is the first open to succeed, adjust things to suit. | 1662 | * If this is the first open to succeed, adjust things to suit. |
1664 | */ | 1663 | */ |
1665 | if (retval == 0 && !(state->flags & UIF_NORMAL_ACTIVE)) { | 1664 | if (retval == 0 && !(port->flags & ASYNC_NORMAL_ACTIVE)) { |
1666 | state->flags |= UIF_NORMAL_ACTIVE; | 1665 | set_bit(ASYNCB_NORMAL_ACTIVE, &port->flags); |
1667 | 1666 | ||
1668 | uart_update_termios(state); | 1667 | uart_update_termios(state); |
1669 | } | 1668 | } |
@@ -1985,63 +1984,64 @@ static int serial_match_port(struct device *dev, void *data) | |||
1985 | return dev->devt == devt; /* Actually, only one tty per port */ | 1984 | return dev->devt == devt; /* Actually, only one tty per port */ |
1986 | } | 1985 | } |
1987 | 1986 | ||
1988 | int uart_suspend_port(struct uart_driver *drv, struct uart_port *port) | 1987 | int uart_suspend_port(struct uart_driver *drv, struct uart_port *uport) |
1989 | { | 1988 | { |
1990 | struct uart_state *state = drv->state + port->line; | 1989 | struct uart_state *state = drv->state + uport->line; |
1990 | struct tty_port *port = &state->port; | ||
1991 | struct device *tty_dev; | 1991 | struct device *tty_dev; |
1992 | struct uart_match match = {port, drv}; | 1992 | struct uart_match match = {uport, drv}; |
1993 | 1993 | ||
1994 | mutex_lock(&state->mutex); | 1994 | mutex_lock(&state->mutex); |
1995 | 1995 | ||
1996 | if (!console_suspend_enabled && uart_console(port)) { | 1996 | if (!console_suspend_enabled && uart_console(uport)) { |
1997 | /* we're going to avoid suspending serial console */ | 1997 | /* we're going to avoid suspending serial console */ |
1998 | mutex_unlock(&state->mutex); | 1998 | mutex_unlock(&state->mutex); |
1999 | return 0; | 1999 | return 0; |
2000 | } | 2000 | } |
2001 | 2001 | ||
2002 | tty_dev = device_find_child(port->dev, &match, serial_match_port); | 2002 | tty_dev = device_find_child(uport->dev, &match, serial_match_port); |
2003 | if (device_may_wakeup(tty_dev)) { | 2003 | if (device_may_wakeup(tty_dev)) { |
2004 | enable_irq_wake(port->irq); | 2004 | enable_irq_wake(uport->irq); |
2005 | put_device(tty_dev); | 2005 | put_device(tty_dev); |
2006 | mutex_unlock(&state->mutex); | 2006 | mutex_unlock(&state->mutex); |
2007 | return 0; | 2007 | return 0; |
2008 | } | 2008 | } |
2009 | port->suspended = 1; | 2009 | uport->suspended = 1; |
2010 | 2010 | ||
2011 | if (state->flags & UIF_INITIALIZED) { | 2011 | if (port->flags & ASYNC_INITIALIZED) { |
2012 | const struct uart_ops *ops = port->ops; | 2012 | const struct uart_ops *ops = uport->ops; |
2013 | int tries; | 2013 | int tries; |
2014 | 2014 | ||
2015 | state->flags = (state->flags & ~UIF_INITIALIZED) | 2015 | set_bit(ASYNCB_SUSPENDED, &port->flags); |
2016 | | UIF_SUSPENDED; | 2016 | clear_bit(ASYNCB_INITIALIZED, &port->flags); |
2017 | 2017 | ||
2018 | spin_lock_irq(&port->lock); | 2018 | spin_lock_irq(&uport->lock); |
2019 | ops->stop_tx(port); | 2019 | ops->stop_tx(uport); |
2020 | ops->set_mctrl(port, 0); | 2020 | ops->set_mctrl(uport, 0); |
2021 | ops->stop_rx(port); | 2021 | ops->stop_rx(uport); |
2022 | spin_unlock_irq(&port->lock); | 2022 | spin_unlock_irq(&uport->lock); |
2023 | 2023 | ||
2024 | /* | 2024 | /* |
2025 | * Wait for the transmitter to empty. | 2025 | * Wait for the transmitter to empty. |
2026 | */ | 2026 | */ |
2027 | for (tries = 3; !ops->tx_empty(port) && tries; tries--) | 2027 | for (tries = 3; !ops->tx_empty(uport) && tries; tries--) |
2028 | msleep(10); | 2028 | msleep(10); |
2029 | if (!tries) | 2029 | if (!tries) |
2030 | printk(KERN_ERR "%s%s%s%d: Unable to drain " | 2030 | printk(KERN_ERR "%s%s%s%d: Unable to drain " |
2031 | "transmitter\n", | 2031 | "transmitter\n", |
2032 | port->dev ? dev_name(port->dev) : "", | 2032 | uport->dev ? dev_name(uport->dev) : "", |
2033 | port->dev ? ": " : "", | 2033 | uport->dev ? ": " : "", |
2034 | drv->dev_name, | 2034 | drv->dev_name, |
2035 | drv->tty_driver->name_base + port->line); | 2035 | drv->tty_driver->name_base + uport->line); |
2036 | 2036 | ||
2037 | ops->shutdown(port); | 2037 | ops->shutdown(uport); |
2038 | } | 2038 | } |
2039 | 2039 | ||
2040 | /* | 2040 | /* |
2041 | * Disable the console device before suspending. | 2041 | * Disable the console device before suspending. |
2042 | */ | 2042 | */ |
2043 | if (uart_console(port)) | 2043 | if (uart_console(uport)) |
2044 | console_stop(port->cons); | 2044 | console_stop(uport->cons); |
2045 | 2045 | ||
2046 | uart_change_pm(state, 3); | 2046 | uart_change_pm(state, 3); |
2047 | 2047 | ||
@@ -2050,67 +2050,68 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *port) | |||
2050 | return 0; | 2050 | return 0; |
2051 | } | 2051 | } |
2052 | 2052 | ||
2053 | int uart_resume_port(struct uart_driver *drv, struct uart_port *port) | 2053 | int uart_resume_port(struct uart_driver *drv, struct uart_port *uport) |
2054 | { | 2054 | { |
2055 | struct uart_state *state = drv->state + port->line; | 2055 | struct uart_state *state = drv->state + uport->line; |
2056 | struct tty_port *port = &state->port; | ||
2056 | struct device *tty_dev; | 2057 | struct device *tty_dev; |
2057 | struct uart_match match = {port, drv}; | 2058 | struct uart_match match = {uport, drv}; |
2058 | 2059 | ||
2059 | mutex_lock(&state->mutex); | 2060 | mutex_lock(&state->mutex); |
2060 | 2061 | ||
2061 | if (!console_suspend_enabled && uart_console(port)) { | 2062 | if (!console_suspend_enabled && uart_console(uport)) { |
2062 | /* no need to resume serial console, it wasn't suspended */ | 2063 | /* no need to resume serial console, it wasn't suspended */ |
2063 | mutex_unlock(&state->mutex); | 2064 | mutex_unlock(&state->mutex); |
2064 | return 0; | 2065 | return 0; |
2065 | } | 2066 | } |
2066 | 2067 | ||
2067 | tty_dev = device_find_child(port->dev, &match, serial_match_port); | 2068 | tty_dev = device_find_child(uport->dev, &match, serial_match_port); |
2068 | if (!port->suspended && device_may_wakeup(tty_dev)) { | 2069 | if (!uport->suspended && device_may_wakeup(tty_dev)) { |
2069 | disable_irq_wake(port->irq); | 2070 | disable_irq_wake(uport->irq); |
2070 | mutex_unlock(&state->mutex); | 2071 | mutex_unlock(&state->mutex); |
2071 | return 0; | 2072 | return 0; |
2072 | } | 2073 | } |
2073 | port->suspended = 0; | 2074 | uport->suspended = 0; |
2074 | 2075 | ||
2075 | /* | 2076 | /* |
2076 | * Re-enable the console device after suspending. | 2077 | * Re-enable the console device after suspending. |
2077 | */ | 2078 | */ |
2078 | if (uart_console(port)) { | 2079 | if (uart_console(uport)) { |
2079 | struct ktermios termios; | 2080 | struct ktermios termios; |
2080 | 2081 | ||
2081 | /* | 2082 | /* |
2082 | * First try to use the console cflag setting. | 2083 | * First try to use the console cflag setting. |
2083 | */ | 2084 | */ |
2084 | memset(&termios, 0, sizeof(struct ktermios)); | 2085 | memset(&termios, 0, sizeof(struct ktermios)); |
2085 | termios.c_cflag = port->cons->cflag; | 2086 | termios.c_cflag = uport->cons->cflag; |
2086 | 2087 | ||
2087 | /* | 2088 | /* |
2088 | * If that's unset, use the tty termios setting. | 2089 | * If that's unset, use the tty termios setting. |
2089 | */ | 2090 | */ |
2090 | if (state->port.tty && termios.c_cflag == 0) | 2091 | if (port->tty && termios.c_cflag == 0) |
2091 | termios = *state->port.tty->termios; | 2092 | termios = *port->tty->termios; |
2092 | 2093 | ||
2093 | uart_change_pm(state, 0); | 2094 | uart_change_pm(state, 0); |
2094 | port->ops->set_termios(port, &termios, NULL); | 2095 | uport->ops->set_termios(uport, &termios, NULL); |
2095 | console_start(port->cons); | 2096 | console_start(uport->cons); |
2096 | } | 2097 | } |
2097 | 2098 | ||
2098 | if (state->flags & UIF_SUSPENDED) { | 2099 | if (port->flags & ASYNC_SUSPENDED) { |
2099 | const struct uart_ops *ops = port->ops; | 2100 | const struct uart_ops *ops = uport->ops; |
2100 | int ret; | 2101 | int ret; |
2101 | 2102 | ||
2102 | uart_change_pm(state, 0); | 2103 | uart_change_pm(state, 0); |
2103 | spin_lock_irq(&port->lock); | 2104 | spin_lock_irq(&uport->lock); |
2104 | ops->set_mctrl(port, 0); | 2105 | ops->set_mctrl(uport, 0); |
2105 | spin_unlock_irq(&port->lock); | 2106 | spin_unlock_irq(&uport->lock); |
2106 | ret = ops->startup(port); | 2107 | ret = ops->startup(uport); |
2107 | if (ret == 0) { | 2108 | if (ret == 0) { |
2108 | uart_change_speed(state, NULL); | 2109 | uart_change_speed(state, NULL); |
2109 | spin_lock_irq(&port->lock); | 2110 | spin_lock_irq(&uport->lock); |
2110 | ops->set_mctrl(port, port->mctrl); | 2111 | ops->set_mctrl(uport, uport->mctrl); |
2111 | ops->start_tx(port); | 2112 | ops->start_tx(uport); |
2112 | spin_unlock_irq(&port->lock); | 2113 | spin_unlock_irq(&uport->lock); |
2113 | state->flags |= UIF_INITIALIZED; | 2114 | set_bit(ASYNCB_INITIALIZED, &port->flags); |
2114 | } else { | 2115 | } else { |
2115 | /* | 2116 | /* |
2116 | * Failed to resume - maybe hardware went away? | 2117 | * Failed to resume - maybe hardware went away? |
@@ -2120,7 +2121,7 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port) | |||
2120 | uart_shutdown(state); | 2121 | uart_shutdown(state); |
2121 | } | 2122 | } |
2122 | 2123 | ||
2123 | state->flags &= ~UIF_SUSPENDED; | 2124 | clear_bit(ASYNCB_SUSPENDED, &port->flags); |
2124 | } | 2125 | } |
2125 | 2126 | ||
2126 | mutex_unlock(&state->mutex); | 2127 | mutex_unlock(&state->mutex); |
diff --git a/include/linux/serial.h b/include/linux/serial.h index e5bb75a63802..c8613c3ff9d3 100644 --- a/include/linux/serial.h +++ b/include/linux/serial.h | |||
@@ -122,6 +122,7 @@ struct serial_uart_config { | |||
122 | 122 | ||
123 | /* Internal flags used only by kernel */ | 123 | /* Internal flags used only by kernel */ |
124 | #define ASYNCB_INITIALIZED 31 /* Serial port was initialized */ | 124 | #define ASYNCB_INITIALIZED 31 /* Serial port was initialized */ |
125 | #define ASYNCB_SUSPENDED 30 /* Serial port is suspended */ | ||
125 | #define ASYNCB_NORMAL_ACTIVE 29 /* Normal device is active */ | 126 | #define ASYNCB_NORMAL_ACTIVE 29 /* Normal device is active */ |
126 | #define ASYNCB_BOOT_AUTOCONF 28 /* Autoconfigure port on bootup */ | 127 | #define ASYNCB_BOOT_AUTOCONF 28 /* Autoconfigure port on bootup */ |
127 | #define ASYNCB_CLOSING 27 /* Serial port is closing */ | 128 | #define ASYNCB_CLOSING 27 /* Serial port is closing */ |
@@ -133,6 +134,7 @@ struct serial_uart_config { | |||
133 | #define ASYNCB_FIRST_KERNEL 22 | 134 | #define ASYNCB_FIRST_KERNEL 22 |
134 | 135 | ||
135 | #define ASYNC_HUP_NOTIFY (1U << ASYNCB_HUP_NOTIFY) | 136 | #define ASYNC_HUP_NOTIFY (1U << ASYNCB_HUP_NOTIFY) |
137 | #define ASYNC_SUSPENDED (1U << ASYNCB_SUSPENDED) | ||
136 | #define ASYNC_FOURPORT (1U << ASYNCB_FOURPORT) | 138 | #define ASYNC_FOURPORT (1U << ASYNCB_FOURPORT) |
137 | #define ASYNC_SAK (1U << ASYNCB_SAK) | 139 | #define ASYNC_SAK (1U << ASYNCB_SAK) |
138 | #define ASYNC_SPLIT_TERMIOS (1U << ASYNCB_SPLIT_TERMIOS) | 140 | #define ASYNC_SPLIT_TERMIOS (1U << ASYNCB_SPLIT_TERMIOS) |
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 63ad90966db2..284ef7f54890 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h | |||
@@ -20,6 +20,8 @@ | |||
20 | #ifndef LINUX_SERIAL_CORE_H | 20 | #ifndef LINUX_SERIAL_CORE_H |
21 | #define LINUX_SERIAL_CORE_H | 21 | #define LINUX_SERIAL_CORE_H |
22 | 22 | ||
23 | #include <linux/serial.h> | ||
24 | |||
23 | /* | 25 | /* |
24 | * The type definitions. These are from Ted Ts'o's serial.h | 26 | * The type definitions. These are from Ted Ts'o's serial.h |
25 | */ | 27 | */ |
@@ -356,19 +358,6 @@ struct uart_state { | |||
356 | 358 | ||
357 | int pm_state; | 359 | int pm_state; |
358 | struct circ_buf xmit; | 360 | struct circ_buf xmit; |
359 | uif_t flags; | ||
360 | |||
361 | /* | ||
362 | * Definitions for info->flags. These are _private_ to serial_core, and | ||
363 | * are specific to this structure. They may be queried by low level drivers. | ||
364 | * | ||
365 | * FIXME: use the ASY_ definitions | ||
366 | */ | ||
367 | #define UIF_CHECK_CD ((__force uif_t) (1 << 25)) | ||
368 | #define UIF_CTS_FLOW ((__force uif_t) (1 << 26)) | ||
369 | #define UIF_NORMAL_ACTIVE ((__force uif_t) (1 << 29)) | ||
370 | #define UIF_INITIALIZED ((__force uif_t) (1 << 31)) | ||
371 | #define UIF_SUSPENDED ((__force uif_t) (1 << 30)) | ||
372 | 361 | ||
373 | struct tasklet_struct tlet; | 362 | struct tasklet_struct tlet; |
374 | wait_queue_head_t delta_msr_wait; | 363 | wait_queue_head_t delta_msr_wait; |
@@ -509,22 +498,23 @@ static inline int uart_handle_break(struct uart_port *port) | |||
509 | * @status: new carrier detect status, nonzero if active | 498 | * @status: new carrier detect status, nonzero if active |
510 | */ | 499 | */ |
511 | static inline void | 500 | static inline void |
512 | uart_handle_dcd_change(struct uart_port *port, unsigned int status) | 501 | uart_handle_dcd_change(struct uart_port *uport, unsigned int status) |
513 | { | 502 | { |
514 | struct uart_state *state = port->state; | 503 | struct uart_state *state = uport->state; |
504 | struct tty_port *port = &state->port; | ||
515 | 505 | ||
516 | port->icount.dcd++; | 506 | uport->icount.dcd++; |
517 | 507 | ||
518 | #ifdef CONFIG_HARD_PPS | 508 | #ifdef CONFIG_HARD_PPS |
519 | if ((port->flags & UPF_HARDPPS_CD) && status) | 509 | if ((uport->flags & UPF_HARDPPS_CD) && status) |
520 | hardpps(); | 510 | hardpps(); |
521 | #endif | 511 | #endif |
522 | 512 | ||
523 | if (state->flags & UIF_CHECK_CD) { | 513 | if (port->flags & ASYNC_CHECK_CD) { |
524 | if (status) | 514 | if (status) |
525 | wake_up_interruptible(&state->port.open_wait); | 515 | wake_up_interruptible(&port->open_wait); |
526 | else if (state->port.tty) | 516 | else if (port->tty) |
527 | tty_hangup(state->port.tty); | 517 | tty_hangup(port->tty); |
528 | } | 518 | } |
529 | } | 519 | } |
530 | 520 | ||
@@ -534,24 +524,24 @@ uart_handle_dcd_change(struct uart_port *port, unsigned int status) | |||
534 | * @status: new clear to send status, nonzero if active | 524 | * @status: new clear to send status, nonzero if active |
535 | */ | 525 | */ |
536 | static inline void | 526 | static inline void |
537 | uart_handle_cts_change(struct uart_port *port, unsigned int status) | 527 | uart_handle_cts_change(struct uart_port *uport, unsigned int status) |
538 | { | 528 | { |
539 | struct uart_state *state = port->state; | 529 | struct tty_port *port = &uport->state->port; |
540 | struct tty_struct *tty = state->port.tty; | 530 | struct tty_struct *tty = port->tty; |
541 | 531 | ||
542 | port->icount.cts++; | 532 | uport->icount.cts++; |
543 | 533 | ||
544 | if (state->flags & UIF_CTS_FLOW) { | 534 | if (port->flags & ASYNC_CTS_FLOW) { |
545 | if (tty->hw_stopped) { | 535 | if (tty->hw_stopped) { |
546 | if (status) { | 536 | if (status) { |
547 | tty->hw_stopped = 0; | 537 | tty->hw_stopped = 0; |
548 | port->ops->start_tx(port); | 538 | uport->ops->start_tx(uport); |
549 | uart_write_wakeup(port); | 539 | uart_write_wakeup(uport); |
550 | } | 540 | } |
551 | } else { | 541 | } else { |
552 | if (!status) { | 542 | if (!status) { |
553 | tty->hw_stopped = 1; | 543 | tty->hw_stopped = 1; |
554 | port->ops->stop_tx(port); | 544 | uport->ops->stop_tx(uport); |
555 | } | 545 | } |
556 | } | 546 | } |
557 | } | 547 | } |