summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorHaavard Skinnemoen <haavard.skinnemoen@atmel.com>2008-07-14 18:59:15 +1000
committerStephen Rothwell <sfr@canb.auug.org.au>2008-07-14 18:59:15 +1000
commit5236b57b06b14d3ed357989f12ffbb88f3249c22 (patch)
tree9df1b114018dbdcb9c5a9dc12418e28ee19ee7ab /drivers
parent15d59e9528cfbdcccf8146ceeb161d8b8cc6cf49 (diff)
serial: Add flush_buffer() operation to uart_ops
Serial drivers using DMA (like the atmel_serial driver) tend to get very confused when the xmit buffer is flushed and nobody told them. They also tend to spew a lot of garbage since the DMA engine keeps running after the buffer is flushed and possibly refilled with unrelated data. This patch adds a new flush_buffer operation to the uart_ops struct, along with a call to it from uart_flush_buffer() right after the xmit buffer has been cleared. The driver can implement this in order to syncronize its internal DMA state with the xmit buffer when the buffer is flushed. Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com> Acked-by: Alan Cox <alan@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/serial/serial_core.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index 42d2e108b679..9884bc9eecb1 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -573,6 +573,8 @@ static void uart_flush_buffer(struct tty_struct *tty)
spin_lock_irqsave(&port->lock, flags);
uart_circ_clear(&state->info->xmit);
+ if (port->ops->flush_buffer)
+ port->ops->flush_buffer(port);
spin_unlock_irqrestore(&port->lock, flags);
tty_wakeup(tty);
}