Patchwork mpc52xx_uart: report serial errors to users

login
register
mail settings
Submitter René Bürgel
Date Oct. 30, 2008, 6:14 a.m.
Message ID <490950AF.1000303@unicontrol.de>
Download mbox | patch
Permalink /patch/6444/
State Changes Requested, archived
Headers show

Comments

René Bürgel - Oct. 30, 2008, 6:14 a.m.
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>

Kind regards, René Bürgel
Grant Likely - Oct. 30, 2008, 3:19 p.m.
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.

>
> Kind regards, René Bürgel
>
> --
> René Bürgel
> Software Engineer
> Unicontrol Systemtechnik GmbH
> OT Dittersbach
> Sachsenburger Weg 34
> 09669 Frankenberg
>
> Tel.: 03 72 06/ 88 73 - 19
> Fax: 03 72 06/ 88 73 - 60
> E-Mail: r.buergel@unicontrol.de
> Internet: www.unicontrol.de
>
>
>
> --- drivers/serial/mpc52xx_uart.c       2008-08-07 15:55:43.000000000 +0200
> +++ drivers/serial/mpc52xx_uart_orig.c  2008-09-11 13:19:12.000000000 +0200

Patch is one level too shallow; for regular tools to work without
manual intervention you should be generating the patch from the
directory above the kernel source.

> @@ -752,10 +752,17 @@
>                        if (status & MPC52xx_PSC_SR_RB) {
>                                flag = TTY_BREAK;
>                                uart_handle_break(port);
> +                               port->icount.brk++;
>                        } else if (status & MPC52xx_PSC_SR_PE)
> +                       {

Please use '} else if () {' form

>                                flag = TTY_PARITY;
> +                               port->icount.parity++;
> +                       }
>                        else if (status & MPC52xx_PSC_SR_FE)
> +                       {

ditto

>                                flag = TTY_FRAME;
> +                               port->icount.frame++;
> +                       }
>
>                        /* Clear error condition */
>                        out_8(&PSC(port)->command, MPC52xx_PSC_RST_ERR_STAT);
> @@ -769,6 +776,7 @@
>                         * affect the current character
>                         */
>                        tty_insert_flip_char(tty, 0, TTY_OVERRUN);
> +                       port->icount.overrun++;
>                }
>        }
>
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
>

Patch

--- drivers/serial/mpc52xx_uart.c	2008-08-07 15:55:43.000000000 +0200
+++ drivers/serial/mpc52xx_uart_orig.c	2008-09-11 13:19:12.000000000 +0200
@@ -752,10 +752,17 @@ 
 			if (status & MPC52xx_PSC_SR_RB) {
 				flag = TTY_BREAK;
 				uart_handle_break(port);
+				port->icount.brk++;
 			} else if (status & MPC52xx_PSC_SR_PE)
+			{
 				flag = TTY_PARITY;
+				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 +776,7 @@ 
 			 * affect the current character
 			 */
 			tty_insert_flip_char(tty, 0, TTY_OVERRUN);
+			port->icount.overrun++;
 		}
 	}