From: "George G. Davis" Since serial devices are powered down when not in use and some of those devices cannot be accessed when powered down, we need to enable power around calls to get_mcrtl() when dumping port state via uart_line_info(). This resolves hangs observed on some machines while reading serial device registers when a port is powered off. Signed-off-by: George G. Davis Cc: Russell King Cc: Alan Cox Signed-off-by: Andrew Morton --- drivers/serial/serial_core.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff -puN drivers/serial/serial_core.c~make-sure-uart-is-powered-up-when-dumping-mctrl-status drivers/serial/serial_core.c --- a/drivers/serial/serial_core.c~make-sure-uart-is-powered-up-when-dumping-mctrl-status +++ a/drivers/serial/serial_core.c @@ -1660,6 +1660,7 @@ static const char *uart_type(struct uart static int uart_line_info(char *buf, struct uart_driver *drv, int i) { struct uart_state *state = drv->state + i; + int pm_state; struct uart_port *port = state->port; char stat_buf[32]; unsigned int status; @@ -1682,9 +1683,16 @@ static int uart_line_info(char *buf, str if(capable(CAP_SYS_ADMIN)) { + mutex_lock(&state->mutex); + pm_state = state->pm_state; + if (pm_state) + uart_change_pm(state, 0); spin_lock_irq(&port->lock); status = port->ops->get_mctrl(port); spin_unlock_irq(&port->lock); + if (pm_state) + uart_change_pm(state, pm_state); + mutex_unlock(&state->mutex); ret += sprintf(buf + ret, " tx:%d rx:%d", port->icount.tx, port->icount.rx); @@ -2100,6 +2108,9 @@ uart_configure_port(struct uart_driver * uart_report_port(drv, port); + /* Power up port for set_mctrl() */ + uart_change_pm(state, 0); + /* * Ensure that the modem control lines are de-activated. * We probably don't need a spinlock around this, but _