Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965187AbbKDAXE (ORCPT ); Tue, 3 Nov 2015 19:23:04 -0500 Received: from mail-bn1bon0071.outbound.protection.outlook.com ([157.56.111.71]:3671 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932707AbbKDAVL (ORCPT ); Tue, 3 Nov 2015 19:21:11 -0500 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; linuxfoundation.org; dkim=none (message not signed) header.d=none;linuxfoundation.org; dmarc=bestguesspass action=none header.from=xilinx.com; From: Soren Brinkmann To: Greg Kroah-Hartman , Jiri Slaby CC: Michal Simek , , , , "Soren Brinkmann" Subject: [PATCH 7/9] tty: xuartps: Acquire port lock for shutdown Date: Tue, 3 Nov 2015 16:20:48 -0800 Message-ID: <1446596450-20918-8-git-send-email-soren.brinkmann@xilinx.com> X-Mailer: git-send-email 2.6.2.3.ga463a5b In-Reply-To: <1446596450-20918-1-git-send-email-soren.brinkmann@xilinx.com> References: <1446596450-20918-1-git-send-email-soren.brinkmann@xilinx.com> X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.0.0.1202-21918.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BN1BFFO11FD008;1:VFedsEwXVSoi2XZBXK7lFXt6LkFv9nBLIT1vQHmd3a554Yetiu1Er2/p7+GIDIa4LzvYyLSdH+LbTWjOcP6tJHJEKjGa3dLq8ETODjT5jFzXGQvHDUj023cxo2pwqVampFa+MipLWu5ZsNTozWeu+UCwG+R76BTpUhdDBIaWuv4A6SU8S88oXR6QrykUDZX3rc70sFTj1BMh1NvCKK/ukcUK4ZUT5wv/EAeBE3+49LDpWRuZJCoz2sTnzC6TM+rkmsJRCmmULlUr/ph4eBkEdrM2Pv2SKmuoYBjK9lWQdEwS98nGFdi3GVUjcrLawtJLSliUQHtDHVm/WnVcnejTcGP3mkSix300+MheEZ7i5rg= X-Forefront-Antispam-Report: CIP:149.199.60.83;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(2980300002)(438002)(189002)(199003)(5001960100002)(36386004)(50226001)(48376002)(2950100001)(87936001)(76176999)(19580405001)(16796002)(189998001)(107886002)(92566002)(19580395003)(4001430100002)(76506005)(106466001)(33646002)(57986006)(81156007)(50986999)(5001770100001)(47776003)(229853001)(63266004)(11100500001)(5007970100001)(36756003)(77096005)(50466002)(6806005)(86362001)(5003940100001)(5008740100001)(107986001);DIR:OUT;SFP:1101;SCL:1;SRVR:BN1BFFO11HUB027;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;PTR:unknown-60-83.xilinx.com;MX:1;A:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Exchange-Diagnostics: 1;BN1BFFO11HUB027;2:Kv3/GH1tpvqFfD6J5qFDRFGmslqNvLsa0rgxEAOWiXFOFoPpt0L84MEnUBYuAhY7PLcQnh1YrFQ6nNrD7MHJ4QxMGSNgqzaNqUg2/hrz+ElhmS0+sPAh/pfCjUAlFNz4Ncw6PC2lRl68931uTg88E1zAc5Chx8MEwaFiAbTj/Lo=;3:kbH9MeygLNzYZO6C92WE+6XZj2LrFzr2uK6N7d/aGEffiE6Ld70bs+onH3AFvAwKC1KKKP56Vn457wvkynv1KVogcj7Ib67ePxLTjaeJi12s+rWQDJ1lhkkm5UBwwcC524kXFCd6Z/ZEFEwkFixygz1jDZWs+0eSwr7UPjkMcX6ihOX+dt/TRHEuIqYvzGJPOiqsYgDxFhOkR54snc3QSmQMqC7b4fDWgEem9Ye5278fYtFpOkaFnZsZkMbWUsUm/zp98WIIUbJSbhCSwAxdkg==;25:wwj9OWMSfnwa5F6PhQ9czrsHSJbCBHHwyc5KvmjEUGtE2Q1m1ZZZu4X0K1351uuRQ+njI2+R8Az2Ghuw7C9fSYzTZpdmShC6NMq6cxARQElfdxqD1vmjFWM7+DGizk08WqQiGxLMBFMByfqt0eBlrHJvOdY6zSe0hnpRKvXhp3HzKnekltApbwQPgknpfKrfz5TLInzwoiGY5O8Wp4mMLg+a7rSSS+9t9kCG4hkPK6905MVFkVlsuEIf/bqRYhKG7wy/5YterKABsPayaRRolg== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(8251501001);SRVR:BN1BFFO11HUB027; X-Microsoft-Exchange-Diagnostics: 1;BN1BFFO11HUB027;20:P24gEMT/tQI2UHXffcvfSjBt0Say0nrC2QvYxgP2vnEsD1Ug2XcQYlywGH7TZyUIR+xqaTliudCTFIV85unr9CyrPJe7RmWKRvhfGIzPMVgn1dhhzucfj533RPMcwozfLpWlVJYUUTtiYvjbv62kSpGKC/lVjCRBXvyxUAbafRiegVk5EAQCk8MG2ExysVVgSmMrzNJG62xerjwQj80G3lj0hiTZ0NEmW/M0DZods7BuMm0H7BSU5YNT8KX1yx7MQWioX0DhOGQu28EiANT2LZZPoApqxkML0TfFTxGrIH+eHGYqvP+qf5BnH50SfxGxIknEOO4HQYgho9IRvIub4aNLGHQHOH8KisgwrHEimxsYJxjEGaRS7ui6eGjQwmOgb3IrxwW5xFWysif9E74tsz+ly/9NUyzXoNWq9qmOcRAb2C55SaCmR0m94DdGG1gSbFGskCxxiNIgziFgpVDtsTkhoslvTuGG11S0IXjd0E+/l06gJfXogioSEZuhpJtO;4:VyznlRFO1tY0OyagflDfSy2sHXP/AxSufJgt/oMwpUpfuJ1bMn9wI3HIwR73qwOxV6+3Lt45hUEBPuUEkd7q+6MhESiMQtJEzMJJJeUUs9Y+VrWh/pmqKBTuyTN5v5p8sM95QV/04ktvZo/vad6n81Fpd6lwDWrg8bRO2DbrKxa7ZfKVv11KP5hTfVSYstrJ5S2a6zCoTVCPMJzPIFKx16e9NyEEZZ7dBMUU0ND9alqRn6ierytlxurPs/cpopkt/G/RU/QTpl5OBfCC4SGmqVOp+oHDl15kL8d6esqQMUeZlK2ApUMp89vzkB3KcKWztQ5lr0DWOs9M0c6IB401M8njcLdHKLfEsV3p4zIa8G0/joatU2gslNCGfHaDrK1y X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(520078)(8121501046)(5005006)(10201501046)(3002001);SRVR:BN1BFFO11HUB027;BCL:0;PCL:0;RULEID:;SRVR:BN1BFFO11HUB027; X-Forefront-PRVS: 0750463DC9 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BN1BFFO11HUB027;23:wqQH2h+xDXj0iv/DOmwSbktWo4HYMttARuZQEs8?= =?us-ascii?Q?t0CbkZ4FdPaPgPK/7RzUa1GlsXHwrdGmQOgwhLardchWqVhjHkkfa1zpcYAc?= =?us-ascii?Q?l1hmQaBS8YRmFSVmI/xtjjxgzoodG75z7TXP/w42WX2Azl+cKmtNYjIdqe3q?= =?us-ascii?Q?RtUt1PJoN2Mrq7mt6LtN4mRN4uzWqLKIfxPzHsbTJLz09qIwbKUO1Ap3SOI/?= =?us-ascii?Q?0jZk8ngac0rwmlLY4eI/PsiWJ233S4KUDBLfD2QdTxaqp8WADVWZJWXrlRj0?= =?us-ascii?Q?CKldrec/5Jn4wSkdKh+Q1WO9MHgeWxOfW6ltPw9fNP+mswYjjsFs1z3bcW0P?= =?us-ascii?Q?fqWCSEprnaFxMfUZfp2lf7MKxc2L4Viesrg8yG5iv/bH1kZnG02Be1RVODIu?= =?us-ascii?Q?6XQKEpVeTDwKnrk0NjiFLsN5q4QwooyvIJzUToprLGU3E0uZtR05L8dbw6Si?= =?us-ascii?Q?op+h7QKyyYnO5WObM8g6bXa2Ir33Fi7eqou7msF9lPKgj4kt9ZQBRxl4kIAU?= =?us-ascii?Q?j4k1Uuo+61qzp/AVJmL2l1tVlpbivUsrlG0ILS1yXhDG3Z84ViDzEhm6Qtzw?= =?us-ascii?Q?fPVx38YjKi24Iznc7/Y+BDUL0SLF0g6jic5HimetHS0+J7Dr9fmDPkKgQrER?= =?us-ascii?Q?SllCfJpq1N+MC3P4xrGyWEK1rUgP4I5QGNjY65H9Bt1Pds8N4P3Jbm/blAb8?= =?us-ascii?Q?LC4UPljbIHmXHL3BqrP+ssMvihMkXVC8wnr2uEIsi0rf/UKBfrwYT3HQeG0G?= =?us-ascii?Q?1EI3TUfwwuq443qZOwiDK4G1odG1uxwdk/Zur0uHi4uan2OKIqHaQoFwBAxh?= =?us-ascii?Q?qAsNhG32ZfCTmLCaVND33i5LEMCVSZL21PUBqs+CTXlKkuj3K3MnhrEzY1x1?= =?us-ascii?Q?9QaDdm1/rR73U+5CMv1Nw7WeEuykrhnx5obMLNd+xOitE1w8ZTEJkoANFzaU?= =?us-ascii?Q?0zvz0YQZbEL48CbXRkpvpWUsOtun3wmEsN5o29qe1xrWtLjXEB6TpDMexOOW?= =?us-ascii?Q?pAHC0jq5nfF3+VQIQmaPIszyP8Akxf0b2zn+9Gqh2ODcJvSDhOsRz5NhsZ63?= =?us-ascii?Q?xvkPrW2jyNjqbfSs5cP0vRAjdfH+n?= X-Microsoft-Exchange-Diagnostics: 1;BN1BFFO11HUB027;5:o0LooE2La6ZW12liPUcfFV8HyjotSuf0Bl4xvF9JV3JJPdKQJO+Rjpw2rppjqKhVHcthNv18rM2+ShmllvtgjGIGCjk9JxTQU9xJKqlfQJIZegCu2DtrM2sTFHMusD6OvQcMYRDBm9XBGoE/HB/SkA==;24:cLQqOnbUER1JIVs+kDUOLxFKYByQRuVwrIyhchQNWfVtNiLIiv5grnbLeXlwX75uP3Lp4Ex4Dr87e0WY3yjyn0LWVt/ID2l7t450fp0jeKE= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2015 00:21:09.5200 (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.83];Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN1BFFO11HUB027 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1402 Lines: 41 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 --- 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 544ea13e2e93..4904eec37621 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -823,6 +823,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); @@ -832,6 +835,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); } -- 2.6.2.3.ga463a5b -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/