diff mbox

mpc52xx_uart: report serial errors to users v2

Message ID 490EC5EF.50609@unicontrol.de (mailing list archive)
State Accepted, archived
Delegated to: Grant Likely
Headers show

Commit Message

René Bürgel Nov. 3, 2008, 9:35 a.m. UTC
I regenerated the patch with respect to your comments.

Grant Likely wrote:
> On Thu, Oct 30, 2008 at 12:14 AM, René Bürgel <r.buergel@unicontrol.de> wrote:
>   
>> Hi! This patch adds the capability to the mpc52xx-uart to report framing
>> errors, parity errors, breaks and overruns to userspace. These values may be
>> requested in userspace by using the ioctl TIOCGICOUNT.
>>
>> Signed-off-by: René Bürgel <r.buergel@unicontrol.de>
>>     
>
> Looks mostly good.  A few comments below.  Make sure you CC: me when
> you send the next version (which goes for all 5xxx patches).
>
> g.
>
diff mbox

Patch

diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c
index 6117d3d..2669aec 100644
--- a/drivers/serial/mpc52xx_uart.c
+++ b/drivers/serial/mpc52xx_uart.c
@@ -752,10 +752,15 @@  mpc52xx_uart_int_rx_chars(struct uart_port *port)
 			if (status & MPC52xx_PSC_SR_RB) {
 				flag = TTY_BREAK;
 				uart_handle_break(port);
-			} else if (status & MPC52xx_PSC_SR_PE)
+				port->icount.brk++;
+			} else if (status & MPC52xx_PSC_SR_PE) {
 				flag = TTY_PARITY;
-			else if (status & MPC52xx_PSC_SR_FE)
+				port->icount.parity++;
+			}
+			else if (status & MPC52xx_PSC_SR_FE) {
 				flag = TTY_FRAME;
+				port->icount.frame++;
+			}
 
 			/* Clear error condition */
 			out_8(&PSC(port)->command, MPC52xx_PSC_RST_ERR_STAT);
@@ -769,6 +774,7 @@  mpc52xx_uart_int_rx_chars(struct uart_port *port)
 			 * affect the current character
 			 */
 			tty_insert_flip_char(tty, 0, TTY_OVERRUN);
+			port->icount.overrun++;
 		}
 	}