Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c8c6bfa39d6bd7347f43937c8767ae145b61bcb4
Commit:     c8c6bfa39d6bd7347f43937c8767ae145b61bcb4
Parent:     9d778a69370cc1b643b13648df971c83ff5654ef
Author:     Russell King <[EMAIL PROTECTED]>
AuthorDate: Mon Feb 4 22:27:52 2008 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Tue Feb 5 09:44:10 2008 -0800

    serial: avoid stalling suspend if serial port won't drain
    
    Some ports seem to be unable to drain their transmitters on shut down.  
Such a
    problem can occur if the port is programmed for hardware imposed flow 
control,
    characters are in the FIFO but the CTS signal is inactive.
    
    Normally, this isn't a problem because most places where we wait for the
    transmitter to drain have a time-out.  However, there is no timeout in the
    suspend path.
    
    Give a port 30ms to drain; this is an arbitary value chosen to avoid long
    delays if there are many such ports in the system, while giving a reasonable
    chance for a single port to drain.  Should a port not drain within this
    timeout, issue a warning.
    
    Signed-off-by: Russell King <[EMAIL PROTECTED]>
    Acked-by: Alan Cox <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 drivers/serial/serial_core.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index 2554d2f..304fe32 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -1977,6 +1977,7 @@ int uart_suspend_port(struct uart_driver *drv, struct 
uart_port *port)
 
        if (state->info && state->info->flags & UIF_INITIALIZED) {
                const struct uart_ops *ops = port->ops;
+               int tries;
 
                state->info->flags = (state->info->flags & ~UIF_INITIALIZED)
                                     | UIF_SUSPENDED;
@@ -1990,9 +1991,14 @@ int uart_suspend_port(struct uart_driver *drv, struct 
uart_port *port)
                /*
                 * Wait for the transmitter to empty.
                 */
-               while (!ops->tx_empty(port)) {
+               for (tries = 3; !ops->tx_empty(port) && tries; tries--) {
                        msleep(10);
                }
+               if (!tries)
+                       printk(KERN_ERR "%s%s%s%d: Unable to drain 
transmitter\n",
+                              port->dev ? port->dev->bus_id : "",
+                              port->dev ? ": " : "",
+                              drv->dev_name, port->line);
 
                ops->shutdown(port);
        }
-
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