From patchwork Thu Oct 14 07:10:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Francesco Dolcini X-Patchwork-Id: 12557835 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BEDD1C433FE for ; Thu, 14 Oct 2021 07:13:29 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9028A61152 for ; Thu, 14 Oct 2021 07:13:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9028A61152 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=toradex.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FrIMZpH0w4LP//7qTCZpI5+bJrAbqT2Cjj2jVytxG88=; b=mfZx3NUYrBjCyg g93HALFqxx0vlxtG6PftmWa4xfEsHqDkK8QLrWLeqNsRhYIixUc/3J5OqtWrjRZDkmp1/Ofe8KQdC fiP7rWdZr78vvMfvFWCnRESmUfeHJvfboEjocAOiRpRjNRVL/ZB4YjP9lwsPCXh0kH+cb6JyF7qei 2i33++f5Wm0PJ9Czq39glfhbPlyReAgUF2NYuVVprk1wZjNEMmlY8ncDM2NcPMuWw829i3cukegWI 3YdqVzOr0zM7j02gZyhnkQSSaBbaLXJElOITtz9+/EhAHIKfECWEYPUEsap1kVtsjTICVcc1jlIDG SQGBisjhA8pazFgEc2wg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mautW-001pA0-8K; Thu, 14 Oct 2021 07:11:14 +0000 Received: from mail-eopbgr150134.outbound.protection.outlook.com ([40.107.15.134] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mautS-001p8n-An for linux-arm-kernel@lists.infradead.org; Thu, 14 Oct 2021 07:11:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Eof60p1kOucMntIZnIgUmp9pcWatDMvvENRy2Oz4pDzeXX9//tWS3ixJcEDtQcFUxw/CiHJjZtJ4aGkZ4bLdLVZRdL2OmXvcoUQkHrZ0jtJqVFNgT0tIHvSHWJ4tW0CY0n7B0GWfq+p+bcfeo8RhDs9Qgf3h7tuHyOoImWWSOMVkk+fadoDA3m/fLLoLvrCIhnOVwNeEwu1AJ5wFRQThjyoj+WQ7BFvDSWDuljABS+ZYZrkJL/1DnD0c4lusj3dtZ1c+oVHiJA6yDFqXe2g8dO7QrSA2GrceMMmPsLq62nW9VqNNBowrw43hWV7/p5rbYCos482yrMJ0Gjr+Ima8Rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5DD5YtlIWcNrmvMMKAqkG4Ke4CitufBNgV8CcNK410k=; b=kIqQLq7S4ll4IMyal6MeBpFPt00kjuVMWXjvUlAPVkzP8ZwyHmq2bgfkIiSDoiUWfU4HkwNLwTXHait/AHJS5JVBFMhLPhtKasCS0dbaLnd95gOpRms3Ys6r2WraAmIy/w9+hlJ84ww+abWNjs06r7Vmm4KdQSqxPAALdR2cIIlyiR/dGbltrZKizGwu1LlekN0WZQJmBnm9H8ahvpLAowJUYmkuhT8giTzd+ZERIpPNBcMLTWnUorkMBCZUjqkXE9YB8ho9OtKxeD+7ufgvFJrWQDGt1Gaiq1G9hSys7gVUxlpnJd3PraUqROilshhmA9hGYMYPi8Bc+/w5TQ0HFQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=toradex.com; dmarc=pass action=none header.from=toradex.com; dkim=pass header.d=toradex.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toradex.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5DD5YtlIWcNrmvMMKAqkG4Ke4CitufBNgV8CcNK410k=; b=UurgyzkAvQNstWuHzvKTfEECCgYyxIwZiMrPUti8BxU4MQN5yH8UcRYurHN3hWj5ZYvrNbHO8d6kkPQoJEqZudeiYirD1YY+4MrXIalqstVIOaYxKR10f7+wGJTvNkrJW5/Q8SVjptuwAnI1Xvcdp8qqQJHVSq269O+PBuVvqTQ= Authentication-Results: agner.ch; dkim=none (message not signed) header.d=none;agner.ch; dmarc=none action=none header.from=toradex.com; Received: from HE1PR0501MB2602.eurprd05.prod.outlook.com (2603:10a6:3:6d::13) by HE1PR0501MB2780.eurprd05.prod.outlook.com (2603:10a6:3:ca::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.21; Thu, 14 Oct 2021 07:11:04 +0000 Received: from HE1PR0501MB2602.eurprd05.prod.outlook.com ([fe80::8463:d3:5cb2:152c]) by HE1PR0501MB2602.eurprd05.prod.outlook.com ([fe80::8463:d3:5cb2:152c%4]) with mapi id 15.20.4587.026; Thu, 14 Oct 2021 07:11:03 +0000 From: Francesco Dolcini To: Greg Kroah-Hartman , Jiri Slaby , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Stefan Agner Cc: Francesco Dolcini , linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] serial: imx: fix crash when un/re-binding console Date: Thu, 14 Oct 2021 09:10:52 +0200 Message-Id: <20211014071053.568598-2-francesco.dolcini@toradex.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211014071053.568598-1-francesco.dolcini@toradex.com> References: <20211014071053.568598-1-francesco.dolcini@toradex.com> X-ClientProxiedBy: ZR0P278CA0001.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:16::11) To HE1PR0501MB2602.eurprd05.prod.outlook.com (2603:10a6:3:6d::13) MIME-Version: 1.0 Received: from francesco-nb.toradex.int (31.10.206.124) by ZR0P278CA0001.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:16::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.25 via Frontend Transport; Thu, 14 Oct 2021 07:11:01 +0000 Received: by francesco-nb.toradex.int (Postfix, from userid 1000) id 7F05410A3843; Thu, 14 Oct 2021 09:11:00 +0200 (CEST) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7b2959d3-1183-4e82-1dc8-08d98ee1c782 X-MS-TrafficTypeDiagnostic: HE1PR0501MB2780: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2331; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: O1NO+aUEUc+O0M6AssisFzzJNmeAR5thC+9Vu4bK2W2CUMsA+Ps3YiBXHVCyQEeIu8Wk7aNTbx5njlGcR6XOBksNIM99LVA8C/c7M9O81jo6Jju6ZdHg7GiF/56a523AmHBXILH37dexH1eEKKUsKX3K4NTtbybfVK/5zMtuv0QZAX8FGKxqQ1HR1iUHB4bWqBaFrAj+khHE54g/AByBDTxPuJ34aj/2yKi2Y82bNFiEJzIZ183VzvcLExkEHU0TSt8Wk4qmjX1fDAR9bEKpnlGHyFXw1CJYORQhci2mVeHhaevxxf28uFy1OpT4D5ysG9JdR7al8vDAUVPmUlhsNQlWHfxbGxBnSmv/wRrrOl/3mxCZopBLrdr+Xko4zvUVk+aLMK1uGFyhNGkYWxUozfbe40R+8UnZhqfH3jtlDAsYYnDZwhcO8XU8MnHUWEVx4XB1V3Du2aK2nBWv0zWohZNBh5a72dZZqUF+NQJSB0mUkRPEdSV9Dy5kVNjgkwZB1fT/0wqwQTMsonqyDtTOh3Fd7S+aeNq8bax8kVgp4yZbcLeDMCfEEZASvkzkZRBjT7f4L0hMemCAuMAzDWbZODYNA3+i8YWaOcCStSCz5LU0YqSNvCSDkjKJ6G+HJRPhfIndgtZPPrVjU8e8ezlVIPR6Ti36FJ87zTjE1Y6vgnAvg6z0j6HLE5MCf2qRtq8Oq8OpG/TXFt8wSxBLzU9wvw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0501MB2602.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39850400004)(366004)(376002)(346002)(396003)(136003)(36756003)(186003)(52116002)(26005)(316002)(86362001)(6266002)(110136005)(1076003)(508600001)(2616005)(38350700002)(8676002)(66556008)(83380400001)(66946007)(66476007)(5660300002)(8936002)(6666004)(42186006)(7416002)(38100700002)(4326008)(2906002)(44832011); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: AYPhq6kdRK7YE5kgsgWQOXq6zgmBLKSbSGIif5vb8hP8OzbtYYu7UFhMnYIrS8TCRJh9dth1e7IP91X1dB5qt4RYkjQAtZ2pJVpI9ItfSHv/ILCHCnoM7ufMKScCbH39enNAqJwQ+7IQ4+paTdHfW6E1R0d/XNSxLG8h+07eg5Xkt0BjZ1eryRhpMA/CKCeqYsZSDX72l63ENMGrwNnu9nK8Twkw0kajDA383n8mGXLqSrhRPgQGTUAJ6r+bH+VZ7mKjN3X1y1o+RrhnNM4r9prdH0iRNKVxkfBbXbys+gWiiXdTLV204QxCLzXmdy5U/WSlPrjOSjR6m5csFNbflriljsKGX52IKVFOtq40gd7KBIeaiO6Erczm3ySSQlpn8BKOfvdJauzAwWf1GmxV2XoHpNlwfQ3oY9PVhD2vtR/aydEZ3ASnKjiHe+XspHC/+6uIevQTG/IUTDBvllvWCxHNqMXW/t4z1qHDqYtNwoEpLWRXHFSMokgQuMa4ZWSGFfc4NcF/QhN98+Ax+pdwLerdhW7TjmTV9hePPT72k845YUq9z4gWHEmFMkOT3mRF4nVc8wfKFDHfWrMBnynXHn5b2aaNIK9Tm+mey6xA+W2OpVqDDDRB5qqjdOQbKDwQAfs6mMmroGOqwcKTRE3CrkpiI5c96ZNQF8FcSVKeXuu3LLff4zICgnu5UjQgtTWLNDBW/DlHBRd1qx58fiF4fxU93j04fNp87wZQfUNm4eRLEz6pKQGTjcuFZs5Wni4g1ntikyeoiakRzGyihBBmPeRhYq3kVgs4Aa8BLFLbn2Vg6+Gm8gbzbNtScwxDHTd130utkzfHriye9p95FK/BBmEgC47PVX9l5Rdty0FVd8Oz8jk1lLOscpJ66bOeY+bB+5A67hD29aPsmUDhnEjXA752kZg7vS4sgmMN+BVGwxtg3yGK3zUvzGm+p7fTs5f8/21X5+lc5gN4hrTwCoan0AiKmuK+2PruVNmWUjixyDtLmGoR/m7zfuUatyKrVQ5QirJ7HIuYsrT1sRqzLokJn9Di8uH6RkZmOnAe3YEraDG8HRMRtROaqMhWNbPuQX5hoLoZeQniHlIrCo05oFyLKrkwWD7NCuyPsRspnlN3OVf6PctSCyvRVg+NBkA2K0Z/HnJurWTcshwwYVEqZaLbPvUdFE3Myw//ncSiEty9fkEtFRDgpvKQZovQQ6/UZiy//kW4xdzd3JTyyIiQo+DfWw7NQ339GYN9AR7jVLGqqi8R0ExnvalfB23ygV8sscN4kwEtyFh2iGnDajPnvx82jbGqVZ3IYkwiLB1nt9OUC3plEvOpN6T7bndfvRqvHMko X-OriginatorOrg: toradex.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7b2959d3-1183-4e82-1dc8-08d98ee1c782 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0501MB2602.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2021 07:11:01.8213 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d9995866-0d9b-4251-8315-093f062abab4 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: izAoPUl+dzyqcBN//agLTa1nE+oUnnxAbRavpOawxlI0XzmHPTn4JY6hQ8ep5AASEM+IqkTkYn5hCpO1OilmK7Kqv4dl7xQNby6BlfOQZRk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0501MB2780 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211014_001110_422558_B9ADE9FC X-CRM114-Status: GOOD ( 12.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Stefan Agner If the device used as a serial console gets un/re-binded, then register_console() will call imx_uart_setup_console() again. Drop __init so that imx_uart_setup_console() can be safely called at runtime. Signed-off-by: Stefan Agner Signed-off-by: Francesco Dolcini --- drivers/tty/serial/imx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 8b121cd869e9..51a9f9423b1a 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -2017,7 +2017,7 @@ imx_uart_console_write(struct console *co, const char *s, unsigned int count) * If the port was already initialised (eg, by a boot loader), * try to determine the current setup. */ -static void __init +static void imx_uart_console_get_options(struct imx_port *sport, int *baud, int *parity, int *bits) { @@ -2076,7 +2076,7 @@ imx_uart_console_get_options(struct imx_port *sport, int *baud, } } -static int __init +static int imx_uart_console_setup(struct console *co, char *options) { struct imx_port *sport; From patchwork Thu Oct 14 07:10:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Francesco Dolcini X-Patchwork-Id: 12557837 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20FD4C433EF for ; Thu, 14 Oct 2021 07:13:56 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E7DB0610EA for ; Thu, 14 Oct 2021 07:13:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E7DB0610EA Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=toradex.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=HZd9vfCMvbxWCSt7pDWFWOsiL1X0goXf2r5dMbzKN4o=; b=LGYPqqnE+JMEky XFCuWy6F1tfgz3DANp0oiZyk/6gMzNGuZjtvQdH00JWa8jHcUrYWSjCmb/TaCG2Sx5SfdTo1jpHQv 1vCwOEqyNj2xLoHLNRd1yxq/9AeJwBfoHES+LYqNrO5V7iYU48x51K+gvVkiXtwQ550PFIbtwOHgB U4ZFLZyXO/lqsoNnPjaVTcoFsBk8FWr3wnPWkyZ9OkXsT+p0/lat8fo8282Xx/JHC8SFO0Dfb0UJ1 BLSNw8IkL+5wwYDlmPrSW9Gu/royR+iTZGaurRQuBxfz+9fPHooqvrGY3TYJFNR8aJY9Wnx/wU8HT iO0uqT9Iq0QjjNPJauaA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mautt-001pDY-K5; Thu, 14 Oct 2021 07:11:37 +0000 Received: from mail-eopbgr150134.outbound.protection.outlook.com ([40.107.15.134] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mautX-001p8n-CR for linux-arm-kernel@lists.infradead.org; Thu, 14 Oct 2021 07:11:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eHDE4pUbxSOAaIFDKq0iKifWx5+f8FJxKS0eoXbwrFBe8yQ7stVPhJhdIlJuJTunJLqAzxVAHlg6UPPf+hWH99QsqhJ4+u0D4PsfAYGFZxY1X7f/6IjAkziEnMyKpfSp6AdbhyPdBkIG+heb8ZqUp9W+BHj0ROBG1KR0q0HqYbkgfu+XmWNc6dO8SNKnrwLm1qlEPgvDq9ZeTEmCFokc1RgAfwd4vkHF+xQF9CcAF8M/tiu002JLoOqUgmJV03VmEuk0jGSSkmZCMF0KQED/1Kb0RrtMmR79zs5qM69cC+f7xcwEHenh+0kUC4BZFLKDNaymi8XbpdYQC/o3c/UrjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=p4ETRBHsx5i4D/K6K7sLiad91vJHjBv9R3XWa+PcHcw=; b=nScIugaJL5q11Ql3/jPXmrWjkKblX6b2VdZHwiDjTHlIEq4zAJ07PoK1yadPBtYeN2YAiVuAG0P3jesB9iOTg8JlRiNa3mhP0YpeFmSt0uor9PBXPuMmQk4mSgKeU4HljYiM8fS7XjkL1chGkvkvonXrI3v1tirKxLBLvZDWWYkUkXBUcX1C9jJzHuvR84mu0LniXXVnPpvgwZtvSXAa9Qt0T71/pv8L9JqdYYo/nbn8uAdHkWHZ+L2KYCrpzIqzAtAns5IzobGfFrDvMeBj6mIh/YG3jp1FlXbDVErYCymw5UuJzvztqsrq1QWhKh45xYfuzdzXYu5cF/eSKMOQYA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=toradex.com; dmarc=pass action=none header.from=toradex.com; dkim=pass header.d=toradex.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toradex.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=p4ETRBHsx5i4D/K6K7sLiad91vJHjBv9R3XWa+PcHcw=; b=l1bAYHmf0bv5b6OYsJzQAKmTeLRr8OAEghV2sNE3tcOh9Gl9nQIvuZS0uy+un4dW/oSREfdVAtozBd0b7BM8kMpvtUOSaYX25EA8Yhlv3+6dgWlFYm2sUQ1aPzhbU/TCFNMvlqSf/ic8Wm2ms/uNwMBm6BzvOSeLXE9vXLYnAbE= Authentication-Results: agner.ch; dkim=none (message not signed) header.d=none;agner.ch; dmarc=none action=none header.from=toradex.com; Received: from HE1PR0501MB2602.eurprd05.prod.outlook.com (2603:10a6:3:6d::13) by HE1PR0501MB2780.eurprd05.prod.outlook.com (2603:10a6:3:ca::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.21; Thu, 14 Oct 2021 07:11:03 +0000 Received: from HE1PR0501MB2602.eurprd05.prod.outlook.com ([fe80::8463:d3:5cb2:152c]) by HE1PR0501MB2602.eurprd05.prod.outlook.com ([fe80::8463:d3:5cb2:152c%4]) with mapi id 15.20.4587.026; Thu, 14 Oct 2021 07:11:03 +0000 From: Francesco Dolcini To: Greg Kroah-Hartman , Jiri Slaby , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Stefan Agner Cc: Francesco Dolcini , linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] serial: imx: disable console clocks on unregister Date: Thu, 14 Oct 2021 09:10:53 +0200 Message-Id: <20211014071053.568598-3-francesco.dolcini@toradex.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211014071053.568598-1-francesco.dolcini@toradex.com> References: <20211014071053.568598-1-francesco.dolcini@toradex.com> X-ClientProxiedBy: ZR0P278CA0130.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:40::9) To HE1PR0501MB2602.eurprd05.prod.outlook.com (2603:10a6:3:6d::13) MIME-Version: 1.0 Received: from francesco-nb.toradex.int (31.10.206.124) by ZR0P278CA0130.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:40::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.16 via Frontend Transport; Thu, 14 Oct 2021 07:11:01 +0000 Received: by francesco-nb.toradex.int (Postfix, from userid 1000) id 8170C10A3844; Thu, 14 Oct 2021 09:11:00 +0200 (CEST) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7b9d0c85-6f66-4792-10da-08d98ee1c77f X-MS-TrafficTypeDiagnostic: HE1PR0501MB2780: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hgnqZqVtvzQSAj0EFePTavyJ4eUz9LSzS82CwjSMRmArDgA4Rev2BvNEsKcAJRhqfMO5WMKHDI7KPVULjLkImLs8LKRR0kdmXN1tg+IviPe+sx01XDjk5DNBkHD4jZzNV93wkophrWAq8Vc7hxqfXKVtE/roAlUaDnRQ63HFL4OBcmY6jlBSQacEyWenydy0F3msQLJL8MqHazzxUCnhhjCAgYeIK1rq1fKA7T7zvNyqmtKxNCwYQ+y7nrhQRpMdwBar6cP4qSZVJSOP5q00kmABYBCoLJ15ql14RRx1tdV92Wut170t/+qj197Cdej1+QGF7MD4raTL1bjouE5Z19xxNNRPK+Qfz7sXbmnkaIey+StpSeqiE9L1z2Y1te+GA1POuVCgZBxPgWyxXBnbkLCjqGjzEoBMFa8jL3jcgbU6g9ndZyx8Q0ticjdzohV396ddIng7xGGymwiFf6PxbmJerNr1UgrCYTL9aYJS9fVMvFYR8PPlNDd3fLE8YME2DKxsJIMELTQQPnN+T/Gm+k4s1i4NipYrQOaWxTbowt0b5XujL0UhvAXm0Mc+UF3+FupQpvoSNdh/H7ucl06nbT9Y16zU/n6//skrDJa4AxSYzFZ+Iem2S1W1Wn3IOe/uHCm/fQAq7nA60wcBKhdYehuDhyUBMEXVr1ntMUqKSAg3PmpSTn/kTxnV53STUPXqH4RR0QXI+MgHJ1VkTTauXQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0501MB2602.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(346002)(36756003)(186003)(52116002)(26005)(316002)(86362001)(6266002)(110136005)(1076003)(508600001)(2616005)(38350700002)(8676002)(66556008)(83380400001)(66946007)(66476007)(5660300002)(8936002)(6666004)(42186006)(7416002)(38100700002)(4326008)(2906002)(44832011); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 00aakVHYGAx2K8YV1UF0taBhy23TnzliXc8fsQax+dnNvXIMjwpofKgBgMZvSpCCBGWsdwZquxXbVGBV6lO4Gh2owymCfT5DSyRtnBcOM61s9YJ0asYr9ODDxoswdXjZF0RSXZcJ0bKteB4681aQHe6OdQ8koZHcxTNtsdBHIP2AuYBGBkeyfQbtGpvCGZ6DJatKVeu56jVUo8nu7jHRghDqHwkzw7scwuajaQyOU3vNZCcFRHGO9J/jw8NkYynPtZ0sWIMmS8ZKdLo8BP7de/ShNTbFGTlgmXY9XBIJVYSIGWNa8tcu9+NGT8RvsI9NcwjwtieSH6xqRhCqa5GKxAW6Gy+Rqy8nmFVTiB8+/k5yVea0wepjTrisvagtJ3rx7AHOKW3kHM6ryeHjcgLM5ahudY5DK47BOu5GYA4i0b3JSdbCiu23g5elKDIdBtwL4Z9TKnTzqHrPw2Iu+laHWxrq4s4TfNEGLguIzADq2mqwnSKTA8YJa2TtqD4+mb1BdEWq5jmM3xC11IBeBKhXdxaIpXNUJduWmwOgckrJPLvlhFRL3NNMr+/+O8gk3Mmq3SIU7lRY6AmvOAMk1WEl6sjUt+aP450OlgIc/3TSq8zStwhTe9oM4mEpSt1cHCpcK11w2VbBAA5H3JKoDHRoN/GFjO966dyHjJTvqAOu5pJONn28DD3qrn2CKy/qIKpDGk8sRjUqa0rY07cW+g8lD1jqQ0NLEweE6BkqMiYwxIGNZQCvHbFkOIrJWVjwhC2IIyCV+fK4em7Ep/jfAzC49HVttkODMAId2BFyA3d90MgnJzKAr/yu0rB9sspiiHlz4iMGeZlujRs9rxQMTFEy7PIVPIqMCl3ytdguq53eDmgsas5to5s28/NHZr5w6HSsmJs4AMgM8d+kzVs3lIUbTEufRyrZG6hVwZ7xTH2j+LUon9bDhiTx5frpvGLF7LbOSSeWeKdOca/3BBtPDa5iojClzrVEgl87CLsNuNFCGexma25kyRbmdU6ZihVc9ri+PDBPbDXu1cUgLJWw9ankIdCpYEGYmQaFQ5Vx21T8Cmx+Uzn+JZQ6xL+xsY/MY6FQAgWLtxejMzbIgXHp0TgMhgSllwDp1uaV2hjxrWPfCLU0JOWEnUflCaJenA5IMt+/PsH6zhZ3/eUNWhWx6YLS8sNhcLvPxiGm3ts0AmhVk+QLP+NsjvlvxdGqjkULdP0bSBp7CzUETl1ejEE5Zv8RE0EulXRQRtZJnHhuZgTNbK/fw+CHd0jK1+JC4SnLAQp5dGJPHdywd3QVhr34tJ2c9TddseShude41Mc3FRlDr7qrD/6VuC05vFWUoFMLB4Of X-OriginatorOrg: toradex.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7b9d0c85-6f66-4792-10da-08d98ee1c77f X-MS-Exchange-CrossTenant-AuthSource: HE1PR0501MB2602.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2021 07:11:01.8123 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d9995866-0d9b-4251-8315-093f062abab4 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: o/3zzgl7j+iiVn/DBUF94ywEg/p6qkuhuHUy/wht+8kRRBZfzNFNwGFXrvdogFPi80zz1ZBzHY0BF6LJSipRQ9cSwq4sekCidIGyIQ9fpKo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0501MB2780 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211014_001115_473103_14B13BF7 X-CRM114-Status: GOOD ( 11.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org During console setup imx_uart_console_setup() enables clocks, but they are never disabled when the console is unregistered, this leads to clk_prepare_enable() being called multiple times without a matching clk_disable_unprepare() in case of unbind/bind. Ensure that clock enable/disable are balanced adding clk_disable_unprepare() in the console exit callback. Signed-off-by: Francesco Dolcini --- drivers/tty/serial/imx.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 51a9f9423b1a..90f82e6c54e4 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -2124,12 +2124,24 @@ imx_uart_console_setup(struct console *co, char *options) return retval; } +static int +imx_uart_console_exit(struct console *co) +{ + struct imx_port *sport = imx_uart_ports[co->index]; + + clk_disable_unprepare(sport->clk_per); + clk_disable_unprepare(sport->clk_ipg); + + return 0; +} + static struct uart_driver imx_uart_uart_driver; static struct console imx_uart_console = { .name = DEV_NAME, .write = imx_uart_console_write, .device = uart_console_device, .setup = imx_uart_console_setup, + .exit = imx_uart_console_exit, .flags = CON_PRINTBUFFER, .index = -1, .data = &imx_uart_uart_driver,