serial: imx: only count 0->1 transitions for RNG
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Thu, 24 Mar 2016 13:24:23 +0000 (14:24 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 30 Apr 2016 16:26:55 +0000 (09:26 -0700)
According to tty_ioctl(4) (from man-pages 4.04) the rng member only
counts 0->1 transitions. For the other signals (DSR, CD, CTS) both edges
are supposed to be counted.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/imx.c

index aa07301df262bc7f4721b3aafb39df8ba1387890..8ec8127bc3dc8c9dd853e61625ffa2182f55df93 100644 (file)
@@ -887,7 +887,7 @@ static void imx_mctrl_check(struct imx_port *sport)
 
        sport->old_status = status;
 
-       if (changed & TIOCM_RI)
+       if (changed & TIOCM_RI && status & TIOCM_RI)
                sport->port.icount.rng++;
        if (changed & TIOCM_DSR)
                sport->port.icount.dsr++;