]> Git Repo - linux.git/commitdiff
tty/serial: at91: reset rx_ring when port is shutdown
authorMark Deneen <[email protected]>
Tue, 7 Jan 2014 10:45:09 +0000 (11:45 +0100)
committerGreg Kroah-Hartman <[email protected]>
Wed, 8 Jan 2014 01:11:48 +0000 (17:11 -0800)
When using RX DMA, the driver won't pass any data to the uart layer
until the buffer is flipped. When the port is shutdown, the dma buffers
are unmapped, but the head and tail of the ring buffer are not reseted.
Since the serial console will keep the port open, this will only
present itself when the uart is not shared.

To reproduce the issue, with an unpatched driver, run a getty on /dev/ttyS0
with no serial console and exit. Getty will exit, and when the new one returns
you will be unable to log in.  If you hold down a key long enough to fill the
DMA buffer and flip it, you can then log in.

Signed-off-by: Mark Deneen <[email protected]>
Acked-by: Leilei Zhao <[email protected]>
[[email protected]: adapt to mainline kernel, handle !DMA case]
Cc: <[email protected]> # v3.12
Signed-off-by: Nicolas Ferre <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/tty/serial/atmel_serial.c

index c421d11b3d4c884afd13701d03b0d8ea24981460..2b6ac1be00d36b55bfbea4e545430a0554afcbeb 100644 (file)
@@ -1676,6 +1676,12 @@ static void atmel_shutdown(struct uart_port *port)
        if (atmel_port->release_tx)
                atmel_port->release_tx(port);
 
+       /*
+        * Reset ring buffer pointers
+        */
+       atmel_port->rx_ring.head = 0;
+       atmel_port->rx_ring.tail = 0;
+
        /*
         * Free the interrupt
         */
This page took 0.060024 seconds and 4 git commands to generate.