From patchwork Fri Nov 16 01:53:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinya Kuribayashi X-Patchwork-Id: 1752431 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id A3AFBDF2AB for ; Fri, 16 Nov 2012 01:53:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751217Ab2KPBxN (ORCPT ); Thu, 15 Nov 2012 20:53:13 -0500 Received: from relmlor2.renesas.com ([210.160.252.172]:36404 "EHLO relmlor2.renesas.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750937Ab2KPBxM (ORCPT ); Thu, 15 Nov 2012 20:53:12 -0500 Received: from relmlir4.idc.renesas.com ([10.200.68.154]) by relmlor2.idc.renesas.com ( SJSMS) with ESMTP id <0MDK0093O58NJE60@relmlor2.idc.renesas.com>; Fri, 16 Nov 2012 10:53:11 +0900 (JST) Received: from relmlac4.idc.renesas.com ([10.200.69.24]) by relmlir4.idc.renesas.com ( SJSMS) with ESMTP id <0MDK00AK258N7L10@relmlir4.idc.renesas.com>; Fri, 16 Nov 2012 10:53:11 +0900 (JST) Received: by relmlac4.idc.renesas.com (Postfix, from userid 0) id A4F67480A4; Fri, 16 Nov 2012 10:53:11 +0900 (JST) Received: from relmlac4.idc.renesas.com (localhost [127.0.0.1]) by relmlac4.idc.renesas.com (Postfix) with ESMTP id A0D5D480A0; Fri, 16 Nov 2012 10:53:11 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac4.idc.renesas.com with ESMTP id LAB25850; Fri, 16 Nov 2012 10:53:11 +0900 X-IronPort-AV: E=Sophos; i="4.83,261,1352041200"; d="scan'208"; a="106341115" Received: from unknown (HELO [10.161.64.55]) ([10.161.64.55]) by relmlii1.idc.renesas.com with ESMTP; Fri, 16 Nov 2012 10:53:11 +0900 Message-id: <50A59C87.5010905@renesas.com> Date: Fri, 16 Nov 2012 10:53:11 +0900 From: Shinya Kuribayashi User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 MIME-version: 1.0 To: lethal@linux-sh.org, magnus.damm@gmail.com, takashi.yoshii.zj@renesas.com, alan@linux.intel.com, gregkh@linuxfoundation.org Cc: rjw@sisk.pl, linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sh@vger.kernel.org Subject: [PATCH v2 07/10] serial: sh-sci: mask SCTFDR/RFDR according to fifosize References: <509A0658.1010503@renesas.com> <509A0B4E.1030801@renesas.com> <20121116010107.GA6068@kroah.com> <50A59B9B.2010501@renesas.com> In-reply-to: <50A59B9B.2010501@renesas.com> Content-type: text/plain; charset=ISO-8859-1 Content-transfer-encoding: 7bit Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org From: Takashi Yoshii 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 Signed-off-by: Shinya Kuribayashi --- drivers/tty/serial/sh-sci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 3021912..63a3bd0 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -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)