@@ -111,7 +111,8 @@ void uart_write_wakeup(struct uart_port *port)
* closed. No cookie for you.
*/
BUG_ON(!state);
- tty_wakeup(state->port.tty);
+ if (state->port.tty)
+ tty_wakeup(state->port.tty);
}
static void uart_stop(struct tty_struct *tty)
@@ -528,6 +528,8 @@ static void flush_to_ldisc(struct work_struct *work)
void tty_flip_buffer_push(struct tty_port *port)
{
+ if (!port->tty)
+ return;
tty_schedule_flip(port);
}
EXPORT_SYMBOL(tty_flip_buffer_push);
@@ -412,7 +412,7 @@ int uart_resume_port(struct uart_driver *reg, struct uart_port *port);
static inline int uart_tx_stopped(struct uart_port *port)
{
struct tty_struct *tty = port->state->port.tty;
- if (tty->stopped || port->hw_stopped)
+ if ((tty && tty->stopped) || port->hw_stopped)
return 1;
return 0;
}
In order to allow serial drivers to work without a tty, make calls from drivers and serial_core work when tty_struct is NULL. Signed-off-by: Rob Herring <robh@kernel.org> --- drivers/tty/serial/serial_core.c | 3 ++- drivers/tty/tty_buffer.c | 2 ++ include/linux/serial_core.h | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) -- 2.9.2