aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/serial_core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/serial/serial_core.c')
-rw-r--r--drivers/serial/serial_core.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index d814bb1dcb05..397147a7054f 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -1940,6 +1940,9 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *port)
1940 if (state->info && state->info->flags & UIF_INITIALIZED) { 1940 if (state->info && state->info->flags & UIF_INITIALIZED) {
1941 const struct uart_ops *ops = port->ops; 1941 const struct uart_ops *ops = port->ops;
1942 1942
1943 state->info->flags = (state->info->flags & ~UIF_INITIALIZED)
1944 | UIF_SUSPENDED;
1945
1943 spin_lock_irq(&port->lock); 1946 spin_lock_irq(&port->lock);
1944 ops->stop_tx(port); 1947 ops->stop_tx(port);
1945 ops->set_mctrl(port, 0); 1948 ops->set_mctrl(port, 0);
@@ -2006,7 +2009,7 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port)
2006 console_start(port->cons); 2009 console_start(port->cons);
2007 } 2010 }
2008 2011
2009 if (state->info && state->info->flags & UIF_INITIALIZED) { 2012 if (state->info && state->info->flags & UIF_SUSPENDED) {
2010 const struct uart_ops *ops = port->ops; 2013 const struct uart_ops *ops = port->ops;
2011 int ret; 2014 int ret;
2012 2015
@@ -2018,15 +2021,17 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port)
2018 ops->set_mctrl(port, port->mctrl); 2021 ops->set_mctrl(port, port->mctrl);
2019 ops->start_tx(port); 2022 ops->start_tx(port);
2020 spin_unlock_irq(&port->lock); 2023 spin_unlock_irq(&port->lock);
2024 state->info->flags |= UIF_INITIALIZED;
2021 } else { 2025 } else {
2022 /* 2026 /*
2023 * Failed to resume - maybe hardware went away? 2027 * Failed to resume - maybe hardware went away?
2024 * Clear the "initialized" flag so we won't try 2028 * Clear the "initialized" flag so we won't try
2025 * to call the low level drivers shutdown method. 2029 * to call the low level drivers shutdown method.
2026 */ 2030 */
2027 state->info->flags &= ~UIF_INITIALIZED;
2028 uart_shutdown(state); 2031 uart_shutdown(state);
2029 } 2032 }
2033
2034 state->info->flags &= ~UIF_SUSPENDED;
2030 } 2035 }
2031 2036
2032 mutex_unlock(&state->mutex); 2037 mutex_unlock(&state->mutex);