summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2011-04-11 10:59:09 +0200
committerAndi Kleen <ak@linux.intel.com>2011-04-28 08:21:12 -0700
commit617a954d482ca5c165da9ec8345a02a23fbaab78 (patch)
tree0148eaea903a8471304e5b4bc6603f1a820a7c4f
parent0993450a8cccc34704e7375ca47ec555be909b05 (diff)
downloadlwn-617a954d482ca5c165da9ec8345a02a23fbaab78.tar.gz
lwn-617a954d482ca5c165da9ec8345a02a23fbaab78.zip
serial/imx: read cts state only after acking cts change irq
commit 5680e94148a86e8c31fdc5cb0ea0d5c6810c05b0 upstream. If cts changes between reading the level at the cts input (USR1_RTSS) and acking the irq (USR1_RTSD) the last edge doesn't generate an irq and uart_handle_cts_change is called with a outdated value for cts. The race was introduced by commit ceca629 ([ARM] 2971/1: i.MX uart handle rts irq) Reported-by: Arwed Springer <Arwed.Springer@de.trumpf.com> Tested-by: Arwed Springer <Arwed.Springer@de.trumpf.com> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Andi Kleen <ak@linux.intel.com>
-rw-r--r--drivers/serial/imx.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c
index eacb588a9345..6d2028e996ad 100644
--- a/drivers/serial/imx.c
+++ b/drivers/serial/imx.c
@@ -383,12 +383,13 @@ static void imx_start_tx(struct uart_port *port)
static irqreturn_t imx_rtsint(int irq, void *dev_id)
{
struct imx_port *sport = dev_id;
- unsigned int val = readl(sport->port.membase + USR1) & USR1_RTSS;
+ unsigned int val;
unsigned long flags;
spin_lock_irqsave(&sport->port.lock, flags);
writel(USR1_RTSD, sport->port.membase + USR1);
+ val = readl(sport->port.membase + USR1) & USR1_RTSS;
uart_handle_cts_change(&sport->port, !!val);
wake_up_interruptible(&sport->port.state->port.delta_msr_wait);