]> git.karo-electronics.de Git - linux-beck.git/commitdiff
serial: sh-sci: mask SCTFDR/RFDR according to fifosize
authorTakashi Yoshii <takashi.yoshii.zj@renesas.com>
Fri, 16 Nov 2012 01:53:11 +0000 (10:53 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 16 Nov 2012 02:02:37 +0000 (18:02 -0800)
Current mask 0xff to SCTFDR/RFDR damages SCIFB, because the
registers on SCIFB have 9-bit data (0 to 256).

This patch changes the mask according to port->fifosize.
Though I'm not sure if the mask is really needed (I don't know if
there are variants which have non-zero upper bits), it is safer.

Signed-off-by: Takashi Yoshii <takashi.yoshii.zj@renesas.com>
Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi.px@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/sh-sci.c

index a54c47d0fd63b87869028a25529cf428b9d3116e..c2d359cba55d47db40708b29a1582cbd1235961a 100644 (file)
@@ -485,7 +485,7 @@ static int sci_txfill(struct uart_port *port)
 
        reg = sci_getreg(port, SCTFDR);
        if (reg->size)
-               return serial_port_in(port, SCTFDR) & 0xff;
+               return serial_port_in(port, SCTFDR) & ((port->fifosize << 1) - 1);
 
        reg = sci_getreg(port, SCFDR);
        if (reg->size)
@@ -505,7 +505,7 @@ static int sci_rxfill(struct uart_port *port)
 
        reg = sci_getreg(port, SCRFDR);
        if (reg->size)
-               return serial_port_in(port, SCRFDR) & 0xff;
+               return serial_port_in(port, SCRFDR) & ((port->fifosize << 1) - 1);
 
        reg = sci_getreg(port, SCFDR);
        if (reg->size)