From patchwork Fri Oct 10 16:53:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: j.uzycki@elproma.com.pl X-Patchwork-Id: 5066581 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E6CF3C11AC for ; Fri, 10 Oct 2014 16:54:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0C07A20220 for ; Fri, 10 Oct 2014 16:54:36 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 207AD2021A for ; Fri, 10 Oct 2014 16:54:35 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XcdPh-0007pU-LN; Fri, 10 Oct 2014 16:51:33 +0000 Received: from v032797.home.net.pl ([89.161.177.31]) by bombadil.infradead.org with smtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XcdPd-0007mY-1D for linux-arm-kernel@lists.infradead.org; Fri, 10 Oct 2014 16:51:30 +0000 Received: from ip-78-133-172-40.ibd.gtsenergis.pl [78.133.172.40] (HELO ip165.elproma.lan) by elproma.home.pl [89.161.177.31] with SMTP (IdeaSmtpServer v0.80) id 0deb255401f44a2a; Fri, 10 Oct 2014 18:51:04 +0200 From: Janusz Uzycki To: Greg Kroah-Hartman Subject: [PATCH v4 1/4] serial: mxs-auart: clean get_mctrl and set_mctrl Date: Fri, 10 Oct 2014 18:53:24 +0200 Message-Id: <1412960007-28159-2-git-send-email-j.uzycki@elproma.com.pl> X-Mailer: git-send-email 1.7.11.3 In-Reply-To: <1412960007-28159-1-git-send-email-j.uzycki@elproma.com.pl> References: <1412960007-28159-1-git-send-email-j.uzycki@elproma.com.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141010_095129_309245_7E998226 X-CRM114-Status: GOOD ( 12.42 ) X-Spam-Score: 0.0 (/) Cc: devicetree@vger.kernel.org, Russell King - ARM Linux , Richard Genoud , Fabio Estevam , Janusz Uzycki , linux-serial@vger.kernel.org, Jiri Slaby , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Russell King: The only thing which the .get_mctrl method is supposed to do is to return the state of the /input/ lines, which are CTS, DCD, DSR, RI. The output line state is stored in port->mctrl, and is added to the returned value by serial_core when it's required. RTS output state should not be returned from the .get_mctrl method. This patch removes ctrl variable from mxs_auart_port and removes useless reading back RTS line. The ctrl variable in mxs_auart_port duplicated mctrl, member of uart_port structure in serial_core.h. The removed code from mxs_auart_set_mctrl() and mxs_auart_get_mctrl duplicated uart_update_mctrl() and uart_tiocmget() in serial_core.c. Signed-off-by: Janusz Uzycki Reviewed-by: Richard Genoud --- v3 -> v4 changelog: [PATCH 1/4] serial: mxs-auart: clean get_mctrl and set_mctrl * renamed from "serial: mxs-auart: ctrl removed from mxs_auart_port" * mxs_auart_get_mctrl() read back RTS line. It is removed too. v2 -> v3 changelog: The patch was introduced: new [PATCH 1/4] serial: mxs-auart: ctrl removed from mxs_auart_port * the ctrl variable duplicated mctrl, member of uart_port structure in serial_core.h * the code duplicated uart_update_mctrl() and uart_tiocmget() in serial_core.c * mxs_auart_get_mctrl() reads back RTS line. It could be removed too but not sure. --- drivers/tty/serial/mxs-auart.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c index e838e84..2d49901 100644 --- a/drivers/tty/serial/mxs-auart.c +++ b/drivers/tty/serial/mxs-auart.c @@ -143,7 +143,6 @@ struct mxs_auart_port { #define MXS_AUART_DMA_RX_READY 3 /* bit 3 */ #define MXS_AUART_RTSCTS 4 /* bit 4 */ unsigned long flags; - unsigned int ctrl; enum mxs_auart_type devtype; unsigned int irq; @@ -406,8 +405,6 @@ static void mxs_auart_release_port(struct uart_port *u) static void mxs_auart_set_mctrl(struct uart_port *u, unsigned mctrl) { - struct mxs_auart_port *s = to_auart_port(u); - u32 ctrl = readl(u->membase + AUART_CTRL2); ctrl &= ~(AUART_CTRL2_RTSEN | AUART_CTRL2_RTS); @@ -418,24 +415,17 @@ static void mxs_auart_set_mctrl(struct uart_port *u, unsigned mctrl) ctrl |= AUART_CTRL2_RTS; } - s->ctrl = mctrl; writel(ctrl, u->membase + AUART_CTRL2); } static u32 mxs_auart_get_mctrl(struct uart_port *u) { - struct mxs_auart_port *s = to_auart_port(u); u32 stat = readl(u->membase + AUART_STAT); - int ctrl2 = readl(u->membase + AUART_CTRL2); - u32 mctrl = s->ctrl; + u32 mctrl = 0; - mctrl &= ~TIOCM_CTS; if (stat & AUART_STAT_CTS) mctrl |= TIOCM_CTS; - if (ctrl2 & AUART_CTRL2_RTS) - mctrl |= TIOCM_RTS; - return mctrl; } @@ -1071,8 +1061,6 @@ static int mxs_auart_probe(struct platform_device *pdev) s->port.type = PORT_IMX; s->port.dev = s->dev = &pdev->dev; - s->ctrl = 0; - s->irq = platform_get_irq(pdev, 0); s->port.irq = s->irq; ret = request_irq(s->irq, mxs_auart_irq_handle, 0, dev_name(&pdev->dev), s);