Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3689a0ec60bc8f56cc372c1dfa0d89dab48f7c9c
Commit:     3689a0ec60bc8f56cc372c1dfa0d89dab48f7c9c
Parent:     9b22271d4b8c1be8a81563c322d3f04e7cbe2153
Author:     George G. Davis <[EMAIL PROTECTED]>
AuthorDate: Wed Feb 14 00:33:06 2007 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Wed Feb 14 08:09:52 2007 -0800

    [PATCH] serial: make sure UART is powered up when dumping MCTRL status
    
    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 <[EMAIL PROTECTED]>
    Cc: Russell King <[EMAIL PROTECTED]>
    Cc: Alan Cox <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 drivers/serial/serial_core.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index f84982e..66fdd3b 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -1660,6 +1660,7 @@ static const char *uart_type(struct uart_port *port)
 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, struct uart_driver 
*drv, int i)
 
        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 *drv, struct 
uart_state *state,
 
                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
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to