From patchwork Tue Apr 5 02:55:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 65039 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp213247lbc; Mon, 4 Apr 2016 19:52:44 -0700 (PDT) X-Received: by 10.66.160.7 with SMTP id xg7mr57804397pab.10.1459824764569; Mon, 04 Apr 2016 19:52:44 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 5si45717547pfq.158.2016.04.04.19.52.44; Mon, 04 Apr 2016 19:52:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-serial-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-serial-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-serial-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752706AbcDECwn (ORCPT + 2 others); Mon, 4 Apr 2016 22:52:43 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:9983 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752496AbcDECwm (ORCPT ); Mon, 4 Apr 2016 22:52:42 -0400 Received: from 172.24.1.47 (EHLO szxeml422-hub.china.huawei.com) ([172.24.1.47]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DEQ36641; Tue, 05 Apr 2016 10:52:37 +0800 (CST) Received: from localhost.localdomain (10.175.100.166) by szxeml422-hub.china.huawei.com (10.82.67.152) with Microsoft SMTP Server id 14.3.235.1; Tue, 5 Apr 2016 10:52:26 +0800 From: Kefeng Wang To: Noam Camus , Greg Kroah-Hartman CC: Andy Shevchenko , Heikki Krogerus , , , , , Kefeng Wang Subject: [PATCH v2 resend] serial: 8250_dw: fix wrong logic in dw8250_check_lcr() Date: Tue, 5 Apr 2016 10:55:15 +0800 Message-ID: <1459824915-10550-1-git-send-email-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.6.0.GIT MIME-Version: 1.0 X-Originating-IP: [10.175.100.166] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020205.57032876.00B6, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 3b9f4b7318837b33497b463757e15651 Sender: linux-serial-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Commit cdcea058e510 ("serial: 8250_dw: Avoid serial_outx code duplicate with new dw8250_check_lcr()") introduce a wrong logic when write val to LCR reg. When CONFIG_64BIT enabled, __raw_writeq is used unconditionally. The __raw_readq/__raw_writeq is introduced by commit bca2092d7897 ("serial: 8250_dw: Use 64-bit access for OCTEON.") for OCTEON, so for !PORT_OCTEON, we better to use coincident write func. Fixes: cdcea058e510("serial: 8250_dw: Avoid serial_outx code duplicate with new dw8250_check_lcr()") Signed-off-by: Kefeng Wang --- drivers/tty/serial/8250/8250_dw.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) -- 2.6.0.GIT -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c index a3fb95d..003ce60 100644 --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c @@ -103,16 +103,14 @@ static void dw8250_check_lcr(struct uart_port *p, int value) dw8250_force_idle(p); -#ifdef CONFIG_64BIT - __raw_writeq(value & 0xff, offset); -#else - if (p->iotype == UPIO_MEM32) + if (IS_ENABLED(CONFIG_64BIT) && p->type == PORT_OCTEON) + __raw_writeq(value & 0xff, offset); + else if (p->iotype == UPIO_MEM32) writel(value, offset); else if (p->iotype == UPIO_MEM32BE) iowrite32be(value, offset); else writeb(value, offset); -#endif } /* * FIXME: this deadlocks if port->lock is already held