Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1032826AbbKEHWr (ORCPT ); Thu, 5 Nov 2015 02:22:47 -0500 Received: from mail-bn1on0094.outbound.protection.outlook.com ([157.56.110.94]:49152 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1032366AbbKEHVh (ORCPT ); Thu, 5 Nov 2015 02:21:37 -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 v2 07/10] tty: xuartps: Acquire port lock for shutdown Date: Wed, 4 Nov 2015 23:21:16 -0800 Message-ID: <1446708079-1105-8-git-send-email-soren.brinkmann@xilinx.com> X-Mailer: git-send-email 2.6.2.3.ga463a5b In-Reply-To: <1446708079-1105-1-git-send-email-soren.brinkmann@xilinx.com> References: <1446708079-1105-1-git-send-email-soren.brinkmann@xilinx.com> X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.0.0.1202-21920.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11FD018;1:iiks8MFtKDglmvD2AZ3UF/o0PDgSQ6++l/k4ESpAp1e7qIdu1JjvS86T7vgXBQxVtlNxfYwGH3Zj90GsXBnauW8HQWNDeVzb5JZScqonfRTesI8JwP9gPeyrFz3VZruhuE/5i44Xyvcb4mSzAlvwzbshuTYWAtcVxzRDv9odncajMVqcZ8IHVVVhGa/EN9jKgLOmpGIkpfd56229um3xUPRUN+fJZylnOItyJONkBIB0ZvbAr9LGPgM7/IZbsbDgChpmV9DgFKgztA1zmnvurwF3b7YcXDqQasjdWavG4VCb7YPt/oamoXskje/95XMAu9iMX7Q76ltc0gRp42mmcQSHN2ZZloSAepSTpjhVByZfm2g6bYQxVIFJgsmOcZK4 X-Forefront-Antispam-Report: CIP:149.199.60.83;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(2980300002)(438002)(189002)(199003)(33646002)(189998001)(50226001)(19580405001)(19580395003)(4001430100002)(5001960100002)(107886002)(47776003)(87936001)(76176999)(16796002)(5008740100001)(5001920100001)(77096005)(57986006)(5007970100001)(106466001)(229853001)(86362001)(6806005)(11100500001)(92566002)(5001770100001)(81156007)(36756003)(63266004)(50986999)(76506005)(36386004)(50466002)(48376002)(2950100001)(5003940100001)(107986001);DIR:OUT;SFP:1101;SCL:1;SRVR:BY2FFO11HUB045;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;BY2FFO11HUB045;2:6JnSIFMfxrKGwuHwWbBBtcsHqERUzFDnX4Q87NY8vc5M3/H/DY2ef7Yvvh2hlW5zRkUi1zG+jMmibg3d67wKxuOZiPpBaiAe9boPZ/qBA92QuVlv8/7k1EO9iFW6YqsVi/Ggq7+b1nEe+dkLGhNbXQPLV/OzZ0fcqjnPw2Kkrh0=;3:kn++Mbc70e4aZFuyQsWofks9mX8U5RsWs2MfVXbV8VfDYyMz18CxhwJxo9KOtt7NuyrIArihH4v/5buxKTUpOJUQJFrI4wNWZGA6wFA0B/GFS6wp8jUfx7yaBBEQYDrKKiry46/Z3m6HJxDypX89m/POPNNPVvndyz5lHpNLb1vReCcAqQ5kucp+m7DAujlxm8CbIFG3SvsiKVzJFR3qEoT/cq9KzJ6tjmEeYkd3VwLxp6ul1p5gQGiD1NEjc9Z6fICuPQHhDoUtOS1eKZthXQ==;25:PQrTDdupcIhpKkJpQzMIeK04xmK8xkkmHtX5CsG/+R3depGIKX4IzZfmqY5XLdpcF+1XNfEcqqOo+LLldtuygzbiCddou6dVaIGF3+ibxiiHkKAdbnj8FtdWBKPWbMA6nEDaCicpscQti/ONI/RtFP9aOwO+2u+Jke82xbV78zB9KFg77vTo/TN2Mcv96XwuQl+jMQkT0vlqVcTPnqIwEEdopbLxt3RFPSfi/4M/Xfot7YRw0snVfH9dLouhbZdWow4yOS/fd5QsxSouF5j9gg== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(8251501001);SRVR:BY2FFO11HUB045; X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11HUB045;20:8fjA4OJYxog4RkK2Gfple3hGiwYjlNhrt8GOlsSstawlScuUCxN/8WaHmrmLnZNoMRHnfDLHMXXqw3Kw/V9PdWB4DfKzcsJn28HboKA8RHE4P7nD82iCyLzjESns28xleRDgwq4Fn6ggxzMNAhHDZx5xMKUz21XO/7bshBaHlZ8dvlXbwreduqX/CMOoBGrInTm7ifEv6YyQCsRAHq0M+dKFzGj0kfKMKvz6zw0lHhybPNkgA6BLJec8nig9LNWQ0GJfPLhiN64DuQyW0avvFdgkK2w2peJfFp44jDi2sAkG0SpR1NYikFhhAmuUwxM65dQLzOpsF6oqFqAed6QwF3LaCqLGRIh/bxSLN/MZUZaSOR/4EiOwyfLyuR9KNgvGAorcBHEGaMjze6w35jCLpXKXgi47/Wr57ULh9UBsMgfNpIfagAZTJW12qX3No5+CryEAtK3xJ1Mff2IkeAWYj1I6np7GcEKkp2zK6uD/E+yrB6j+kwq1KYvYSFDy83on;4:GQuuGzrhZ5zrMgDpbHajJJFUKxVF1pFUjxZ6VI54m1hzkrSvjx1zl819VHObOyO5u0eV7ewBJBz7SS8n0X0sE9nxdFx0rimoYmBjro55R5hx9aJnr5aGsdyAWXYjo7tADQ1d5hq7iq591+SR0pBlg1Kv+sOFWPTPbDf/nws11dhuhz/DIq762xDSi6nTRRDLXSVCVThIQsujd7jF9DqSsH+Ps37UVpacSftOaqljqRCERaRvAzBaUaEUYtPR3VrfHc9TEbhFo8dBT/iS9jhEXFZdJfrvtB84piqsQ/fUipaSeD7HZNwCL7cblcZ3UMaFBdIbC+J4wusGWHCdzTZFH7YjsfhjNI+nWVkwmhlJl8h7QNjnWNiZE1YhAtb4gjvL X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(8121501046)(5005006)(520078)(10201501046)(3002001);SRVR:BY2FFO11HUB045;BCL:0;PCL:0;RULEID:;SRVR:BY2FFO11HUB045; X-Forefront-PRVS: 0751474A44 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BY2FFO11HUB045;23:uTLRGhXrDlqYSNgS+g0BL6QHWQE6kTfIQbAv1Gvg?= =?us-ascii?Q?jHiCR8ERI6iMpzWnTn/2jZNoXJUEEo4tDDtA8YftQYZvGfnTKocoyHXISy1z?= =?us-ascii?Q?DRymwS+qguVDBQkiJmA4ZUwB14I79kh1wanN+gPD8RaWVE3eReaPT55qFTwU?= =?us-ascii?Q?hY9iQD8XRy7B7g3JY+vU8149HPGWkhte9Mq6HxI6GMftS/udemc5NqLpFyw7?= =?us-ascii?Q?G9hhL6l/fd2NvQFG1sJHPmSC87Ezwy2qV5uzdHFzuuWV08rdHuUIl1M/9oCB?= =?us-ascii?Q?L2nFZCczvr+bEprCsrSqXhpvhljpCAYAOWIsPdiOcRvkFVKdiP1NnLtMeoqY?= =?us-ascii?Q?VZYvXmwrhdJMCW8MZmOftTmbAohuoJ1CvzaGuGo1I2ERJqpejw+OyHLrar7l?= =?us-ascii?Q?gdS8ofABdye2ky0vLBZPTy37YXjM9Ln2LYvWyYqa/hKwLHSKi4KFP0UiAB3p?= =?us-ascii?Q?+PPzq8ZFkp8SuTkUjKE+tZZFs8hjLnDyeo9JAgf/uFigz5LdlIejlY1tjcXz?= =?us-ascii?Q?gebbhnHLaMsDON2yGpWN/svVAu3T5yzPclLhMYcKFeh+inuPhOzlpYFd/8//?= =?us-ascii?Q?UovNsGAht/BoESGMrFH7OHGGSmga2XCtH4r9RVhmKm4p326a99RnvGvkhWld?= =?us-ascii?Q?LwIlrphGRNqigWZzCI8pdNzjpuXhJ1k51svgPmiXjFNDc3OlqQb5zZa+eC/a?= =?us-ascii?Q?1RrwNZnwkCW2xl5DY4hwXdUe1O0yRjbuLT+xfWn48i9XRNf/8tEUIgBC7pro?= =?us-ascii?Q?qZLxjsCTNmeWPeYkRCBrrZiZ3KGVnbYM4dUEM5ulWtPE0dc63fkBH9P6+a2I?= =?us-ascii?Q?pNj6RGyCcAS9S2WTZvC6/ZrQhA71JQVjoxO1nMdzCtAYkpricoEXtdzHrgzp?= =?us-ascii?Q?1ZSa1X78iVkWdL2xA8oqaSbIUqAN4wRW9aSq63Abx3Z662uo0H+NT+ZCiDJ6?= =?us-ascii?Q?GOwY5fVFvVFsRXwC+qpg3uvWrhlK6aGy5Lp5nrxJRAC9l7DAP2XPjlPL6LxJ?= =?us-ascii?Q?nKumFf29/ToGDsPJ4FsUQiZb9/weedsbmrq2jAt4+/u/0Vhn7v0bPget3kLv?= =?us-ascii?Q?g0KTGrd7F1d93KpYo+y14BC2kwpR7gb5hFNprEbyMnnnJggky/HNzpOMAaQ5?= =?us-ascii?Q?60zFZ9Jf/zU=3D?= X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11HUB045;5:7LRHtUVaHw5zV8a3B2WR6wn5IlTfgzkZPqSLxn5OLq9jo3LM4/wj8+1ishrIc1ZxWtXP/0A0xYCz523ZqXnYGCsjVl4KSiPENyqaQ7y5X36/B9pV7Ghp7pFBVJTyzPbjpQerzpU9ccGGda2XVXA1gw==;24:ElDrLYitcGX8bTD0BszLsvNixFXQblqaHDd9hzg5zbDZO2VdxEUgnLf08WFnv9AqzlQVhxeuyxTBFS1+og9a+3u877PNDZXFRu4spkdd9Q0= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Nov 2015 07:21:34.5702 (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: BY2FFO11HUB045 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 5efd1b9d220f..7fd226d65496 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/