From patchwork Sun Dec 6 04:39:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Soren Brinkmann X-Patchwork-Id: 7778231 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C10FA9F350 for ; Sun, 6 Dec 2015 04:46:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EAB2A2045A for ; Sun, 6 Dec 2015 04:46:05 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 12DE220426 for ; Sun, 6 Dec 2015 04:46:05 +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 1a5RBF-0002BL-Os; Sun, 06 Dec 2015 04:44:13 +0000 Received: from mail-cys01nam02on0609.outbound.protection.outlook.com ([2a01:111:f400:fe45::609] helo=NAM02-CY1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1a5R7g-0007Se-J3 for linux-arm-kernel@lists.infradead.org; Sun, 06 Dec 2015 04:40:34 +0000 Received: from SN1NAM02FT051.eop-nam02.prod.protection.outlook.com (10.152.72.60) by SN1NAM02HT011.eop-nam02.prod.protection.outlook.com (10.152.73.6) with Microsoft SMTP Server (TLS) id 15.1.346.13; Sun, 6 Dec 2015 04:39:52 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.100) smtp.mailfrom=xilinx.com; ettus.com; dkim=none (message not signed) header.d=none;ettus.com; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.100 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.100; helo=xsj-pvapsmtpgw02; Received: from xsj-pvapsmtpgw02 (149.199.60.100) by SN1NAM02FT051.mail.protection.outlook.com (10.152.73.103) with Microsoft SMTP Server (TLS) id 15.1.346.13 via Frontend Transport; Sun, 6 Dec 2015 04:39:51 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66]:43225 helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw02 with esmtp (Exim 4.63) (envelope-from ) id 1a5R70-0004Pn-OD; Sat, 05 Dec 2015 20:39:50 -0800 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1a5R70-0006eP-Jj; Sat, 05 Dec 2015 20:39:50 -0800 Received: from xsj-pvapsmtp01 (smtp.xilinx.com [149.199.38.66]) by xsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id tB64dghi015377; Sat, 5 Dec 2015 20:39:42 -0800 Received: from [172.19.74.49] (helo=localhost) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1a5R6s-0006dc-3j; Sat, 05 Dec 2015 20:39:42 -0800 From: Soren Brinkmann To: Greg Kroah-Hartman , Jiri Slaby Subject: [PATCH LINUX v4 08/13] tty: xuartps: Acquire port lock for shutdown Date: Sat, 5 Dec 2015 20:39:24 -0800 Message-ID: <1449376769-13369-9-git-send-email-soren.brinkmann@xilinx.com> X-Mailer: git-send-email 2.6.3.3.g9bb996a In-Reply-To: <1449376769-13369-1-git-send-email-soren.brinkmann@xilinx.com> References: <1449376769-13369-1-git-send-email-soren.brinkmann@xilinx.com> X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.0.0.1202-21982.006 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:149.199.60.100; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(438002)(199003)(189002)(189998001)(36386004)(50986999)(6806005)(4001430100002)(107886002)(586003)(48376002)(5001960100002)(5001770100001)(36756003)(1096002)(81156007)(1220700001)(47776003)(50226001)(92566002)(2950100001)(19580405001)(5003940100001)(86362001)(50466002)(106466001)(63266004)(11100500001)(57986006)(19580395003)(5008740100001)(77096005)(87936001)(33646002)(76506005)(76176999)(229853001)(107986001)(217873001)(5001870100001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1NAM02HT011; H:xsj-pvapsmtpgw02; FPR:; SPF:Pass; PTR:unknown-60-100.xilinx.com,xapps1.xilinx.com; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501001); SRVR:SN1NAM02HT011; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(520078)(10201501046)(3002001); SRVR:SN1NAM02HT011; BCL:0; PCL:0; RULEID:; SRVR:SN1NAM02HT011; X-Forefront-PRVS: 0782EC617F X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2015 04:39:51.4296 (UTC) X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.60.100]; Helo=[xsj-pvapsmtpgw02] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1NAM02HT011 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151205_204032_895259_DC13D473 X-CRM114-Status: UNSURE ( 8.58 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Moritz Fischer , Peter Hurley , Michal Simek , linux-kernel@vger.kernel.org, Soren Brinkmann , linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_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 Shutting down the UART port can happen while console operations are in progress. Holding the port lock serializes these operations and avoids the UART HW to be disabled in the middle of console prints. Signed-off-by: Soren Brinkmann Reviewed-by: Peter Hurley --- drivers/tty/serial/xilinx_uartps.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index 62224a58056b..80248cb46bf6 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -821,6 +821,9 @@ static int cdns_uart_startup(struct uart_port *port) static void cdns_uart_shutdown(struct uart_port *port) { int status; + unsigned long flags; + + spin_lock_irqsave(&port->lock, flags); /* Disable interrupts */ status = readl(port->membase + CDNS_UART_IMR_OFFSET); @@ -830,6 +833,9 @@ static void cdns_uart_shutdown(struct uart_port *port) /* Disable the TX and RX */ writel(CDNS_UART_CR_TX_DIS | CDNS_UART_CR_RX_DIS, port->membase + CDNS_UART_CR_OFFSET); + + spin_unlock_irqrestore(&port->lock, flags); + free_irq(port->irq, port); }