Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 864eeed0 authored by Sascha Hauer's avatar Sascha Hauer Committed by Russell King
Browse files

[ARM] 4994/1: <IMX UART>: Move error handling into execution path



Move the error handling code for erroneous receive characters into
execution path. This makes the code more readable and the compiler
should know how to optimize this, right?

Signed-off-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 8c9915bf
Loading
Loading
Loading
Loading
+33 −41
Original line number Original line Diff line number Diff line
@@ -354,10 +354,9 @@ static irqreturn_t imx_rxint(int irq, void *dev_id)
	struct tty_struct *tty = sport->port.info->tty;
	struct tty_struct *tty = sport->port.info->tty;
	unsigned long flags, temp;
	unsigned long flags, temp;


	rx = readl(sport->port.membase + URXD0);
	spin_lock_irqsave(&sport->port.lock,flags);
	spin_lock_irqsave(&sport->port.lock,flags);


	do {
	while ((rx = readl(sport->port.membase + URXD0)) & URXD_CHARRDY) {
		flg = TTY_NORMAL;
		flg = TTY_NORMAL;
		sport->port.icount.rx++;
		sport->port.icount.rx++;


@@ -365,29 +364,14 @@ static irqreturn_t imx_rxint(int irq, void *dev_id)
		if (temp & USR2_BRCD) {
		if (temp & USR2_BRCD) {
			writel(temp | USR2_BRCD, sport->port.membase + USR2);
			writel(temp | USR2_BRCD, sport->port.membase + USR2);
			if (uart_handle_break(&sport->port))
			if (uart_handle_break(&sport->port))
				goto ignore_char;
				continue;
		}
		}


		if (uart_handle_sysrq_char
		if (uart_handle_sysrq_char
		            (&sport->port, (unsigned char)rx))
		            (&sport->port, (unsigned char)rx))
			goto ignore_char;
			continue;


		if( rx & (URXD_PRERR | URXD_OVRRUN | URXD_FRMERR) )
		if (rx & (URXD_PRERR | URXD_OVRRUN | URXD_FRMERR) ) {
			goto handle_error;

	error_return:
		tty_insert_flip_char(tty, rx, flg);

	ignore_char:
		rx = readl(sport->port.membase + URXD0);
	} while(rx & URXD_CHARRDY);

out:
	spin_unlock_irqrestore(&sport->port.lock,flags);
	tty_flip_buffer_push(tty);
	return IRQ_HANDLED;

handle_error:
			if (rx & URXD_PRERR)
			if (rx & URXD_PRERR)
				sport->port.icount.parity++;
				sport->port.icount.parity++;
			else if (rx & URXD_FRMERR)
			else if (rx & URXD_FRMERR)
@@ -398,7 +382,7 @@ static irqreturn_t imx_rxint(int irq, void *dev_id)
			if (rx & sport->port.ignore_status_mask) {
			if (rx & sport->port.ignore_status_mask) {
				if (++ignored > 100)
				if (++ignored > 100)
					goto out;
					goto out;
		goto ignore_char;
				continue;
			}
			}


			rx &= sport->port.read_status_mask;
			rx &= sport->port.read_status_mask;
@@ -413,7 +397,15 @@ static irqreturn_t imx_rxint(int irq, void *dev_id)
#ifdef SUPPORT_SYSRQ
#ifdef SUPPORT_SYSRQ
			sport->port.sysrq = 0;
			sport->port.sysrq = 0;
#endif
#endif
	goto error_return;
		}

		tty_insert_flip_char(tty, rx, flg);
	}

out:
	spin_unlock_irqrestore(&sport->port.lock,flags);
	tty_flip_buffer_push(tty);
	return IRQ_HANDLED;
}
}


/*
/*