serial: avoid stalling suspend if serial port won't drain
authorRussell King <rmk+lkml@arm.linux.org.uk>
Tue, 5 Feb 2008 06:27:52 +0000 (22:27 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Tue, 5 Feb 2008 17:44:10 +0000 (09:44 -0800)
commitc8c6bfa39d6bd7347f43937c8767ae145b61bcb4
tree0d15a6faa56f7527359ea0360ca93e68010de02f
parent9d778a69370cc1b643b13648df971c83ff5654ef
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 <rmk+kernel@arm.linux.org.uk>
Acked-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/serial/serial_core.c