aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/tty/serial/serial_core.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 984605bb5bf1..2c67a077042a 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -2008,23 +2008,24 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *uport)
2008 } 2008 }
2009 put_device(tty_dev); 2009 put_device(tty_dev);
2010 2010
2011 if (console_suspend_enabled || !uart_console(uport)) 2011 /* Nothing to do if the console is not suspending */
2012 uport->suspended = 1; 2012 if (!console_suspend_enabled && uart_console(uport))
2013 goto unlock;
2014
2015 uport->suspended = 1;
2013 2016
2014 if (port->flags & ASYNC_INITIALIZED) { 2017 if (port->flags & ASYNC_INITIALIZED) {
2015 const struct uart_ops *ops = uport->ops; 2018 const struct uart_ops *ops = uport->ops;
2016 int tries; 2019 int tries;
2017 2020
2018 if (console_suspend_enabled || !uart_console(uport)) { 2021 set_bit(ASYNCB_SUSPENDED, &port->flags);
2019 set_bit(ASYNCB_SUSPENDED, &port->flags); 2022 clear_bit(ASYNCB_INITIALIZED, &port->flags);
2020 clear_bit(ASYNCB_INITIALIZED, &port->flags); 2023
2021 2024 spin_lock_irq(&uport->lock);
2022 spin_lock_irq(&uport->lock); 2025 ops->stop_tx(uport);
2023 ops->stop_tx(uport); 2026 ops->set_mctrl(uport, 0);
2024 ops->set_mctrl(uport, 0); 2027 ops->stop_rx(uport);
2025 ops->stop_rx(uport); 2028 spin_unlock_irq(&uport->lock);
2026 spin_unlock_irq(&uport->lock);
2027 }
2028 2029
2029 /* 2030 /*
2030 * Wait for the transmitter to empty. 2031 * Wait for the transmitter to empty.
@@ -2036,19 +2037,17 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *uport)
2036 drv->dev_name, 2037 drv->dev_name,
2037 drv->tty_driver->name_base + uport->line); 2038 drv->tty_driver->name_base + uport->line);
2038 2039
2039 if (console_suspend_enabled || !uart_console(uport)) 2040 ops->shutdown(uport);
2040 ops->shutdown(uport);
2041 } 2041 }
2042 2042
2043 /* 2043 /*
2044 * Disable the console device before suspending. 2044 * Disable the console device before suspending.
2045 */ 2045 */
2046 if (console_suspend_enabled && uart_console(uport)) 2046 if (uart_console(uport))
2047 console_stop(uport->cons); 2047 console_stop(uport->cons);
2048 2048
2049 if (console_suspend_enabled || !uart_console(uport)) 2049 uart_change_pm(state, UART_PM_STATE_OFF);
2050 uart_change_pm(state, UART_PM_STATE_OFF); 2050unlock:
2051
2052 mutex_unlock(&port->mutex); 2051 mutex_unlock(&port->mutex);
2053 2052
2054 return 0; 2053 return 0;