From patchwork Fri Feb 10 21:06:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 9567523 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5DC9A602B6 for ; Fri, 10 Feb 2017 21:07:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4DB0D27F4B for ; Fri, 10 Feb 2017 21:07:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 424142819A; Fri, 10 Feb 2017 21:07:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_SORBS_SPAM autolearn=no version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E07F027F4B for ; Fri, 10 Feb 2017 21:07:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=9J2bwJEiyZf8SuIohMAE7xdxZnYaV3vVz1FWLhNqjnY=; b=d0b Z688BqF9A0ftG7iZYsWg47TbHroaI0/aZpykPNpty0Omlziu7jvSOGweh6RkSVghVE+coBO+nzlUG KHEX2MrssEoJb7vH9VO5bXpS3lpvxqUZ5yjOT4Ld7P7ZqezRu03pZ0esACc0bah93MfnbdMe4NQ5r G2ECzLt9DpAVtGv1G2MgbiFYQE9jB0BZ/StnV8twpEmSplwxcY3IHhU1q6n98XSEFIwFJPKUV49ID n/9CG3GTUZ4gYz4n+ZkiR/AQpAV0Mfpi8MsPF2Mxd///dbgtyOJINBtdGkwyTTRNxIl6DxWK0YGpd wMnCOwPUqKPIjS+Z61D1+Iyf2QCMtgQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ccIPZ-0005wi-Df; Fri, 10 Feb 2017 21:07:21 +0000 Received: from smtp08.smtpout.orange.fr ([80.12.242.130] helo=smtp.smtpout.orange.fr) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1ccIPT-0005t0-SZ for linux-arm-kernel@lists.infradead.org; Fri, 10 Feb 2017 21:07:20 +0000 Received: from localhost.localdomain ([92.140.232.165]) by mwinf5d43 with ME id j96l1u0023amV8k0396lgu; Fri, 10 Feb 2017 22:06:49 +0100 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Fri, 10 Feb 2017 22:06:49 +0100 X-ME-IP: 92.140.232.165 From: Christophe JAILLET To: gregkh@linuxfoundation.org, jslaby@suse.com, kernel@pengutronix.de Subject: [PATCH] serial: efm32: Fix parity management in 'efm32_uart_console_get_options()' Date: Fri, 10 Feb 2017 22:06:40 +0100 Message-Id: <20170210210640.17749-1-christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.9.3 X-Antivirus: avast! (VPS 170210-3, 10/02/2017), Outbound message X-Antivirus-Status: Clean X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170210_130716_974105_02B06147 X-CRM114-Status: UNSURE ( 8.45 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Christophe JAILLET , kernel-janitors@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP UARTn_FRAME_PARITY_ODD is 0x0300 UARTn_FRAME_PARITY_EVEN is 0x0200 So if the UART is configured for EVEN parity, it would be reported as ODD. Fix it by testing if the 2 bits are set in the ODD case. Signed-off-by: Christophe JAILLET --- Un-tested --- drivers/tty/serial/efm32-uart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/efm32-uart.c b/drivers/tty/serial/efm32-uart.c index ebd8569f9ad5..84034ef20c88 100644 --- a/drivers/tty/serial/efm32-uart.c +++ b/drivers/tty/serial/efm32-uart.c @@ -572,9 +572,9 @@ static void efm32_uart_console_get_options(struct efm32_uart_port *efm_port, 16 * (4 + (clkdiv >> 6))); frame = efm32_uart_read32(efm_port, UARTn_FRAME); - if (frame & UARTn_FRAME_PARITY_ODD) + if ((frame & UARTn_FRAME_PARITY_ODD) == UARTn_FRAME_PARITY_ODD) *parity = 'o'; - else if (frame & UARTn_FRAME_PARITY_EVEN) + else if ((frame & UARTn_FRAME_PARITY_EVEN) == UARTn_FRAME_PARITY_EVEN) *parity = 'e'; else *parity = 'n';