Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1826152pxb; Wed, 20 Oct 2021 12:31:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxgM8tiIhaV2Tns26cK8nxNzAqAet5nprxvCjp1V9F+1yzCTzT6OeZ4VcANJ6wCqluxrSsb X-Received: by 2002:a17:907:3f04:: with SMTP id hq4mr1594310ejc.202.1634758281971; Wed, 20 Oct 2021 12:31:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1634758281; cv=pass; d=google.com; s=arc-20160816; b=oJNSCSNMrrsQWBbgz8puNRmIN+Tbj20/OuCHvoX3XJsgM1I9RbcotjfJZjdp5LO59V 9nEiHN4uEnl0zY1t5s1eBJnCFPRdAOieJt7HAzV7OozoIEhWEFaTbMSe+X0iMKD/1qNy 4tIzKQ0X/s5lFQZTbRNhtNw/rKwRpT3qAi20LiOKKXDc5avFQ2sMVMYV7f3CETJ/34jn Rqh2KUfZ5ZdaYN5JuXn1QH1SroQkXA3j/HdI4OS3AvxUop46WhdJ5yQznHTdTHYH/Vyw W/J4lhEALyY95gW7iPrh8QKW5KmJS0O43uoBkPlEiTbboOm25Sv8fLao7MGPsJ1AxGRQ JkmA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=uk4Aq+3imqvr/LIjNMIF8PPZuSEipaDzcqXRp6mLp00=; b=P5QQ/VRZtccQAOxqfeZSh6xeT8XAE+w3K5otzTcJJGCU1XQX5e1aCx1q4y5mwYQeoE HETPr1Sy/P5pQ830Twarbb3v6KcVqlZu0EISQIWQc+M8uVywpWYU5WCMByAwGVUcPqTa Rac3a4R6ARh3GneZS/iyqm2CNoViHGqHqQ7DRUaj3VKmLWyeKM2dULcrshV6MpzET2Bi 5WPcPA7deSJ3hRNybpo26lr9Bm3Wyh9qvmigk8ZnbWo+KhIxEjN6H90AniqsnRmgdnE2 EvoCAb5Eq2jC/b5FYq2FbNF8LE6lRW775ZbnXorxXMqMkqrNAwwBi0Fu6pXor7s/5HhQ UhaA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@toradex.com header.s=selector2 header.b=hF1n65pS; arc=pass (i=1 spf=pass spfdomain=toradex.com dkim=pass dkdomain=toradex.com dmarc=pass fromdomain=toradex.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=toradex.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f19si3867109edr.604.2021.10.20.12.30.57; Wed, 20 Oct 2021 12:31:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@toradex.com header.s=selector2 header.b=hF1n65pS; arc=pass (i=1 spf=pass spfdomain=toradex.com dkim=pass dkdomain=toradex.com dmarc=pass fromdomain=toradex.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=toradex.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231604AbhJTT3a (ORCPT + 99 others); Wed, 20 Oct 2021 15:29:30 -0400 Received: from mail-eopbgr80120.outbound.protection.outlook.com ([40.107.8.120]:1212 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231612AbhJTT30 (ORCPT ); Wed, 20 Oct 2021 15:29:26 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K1reiMRBXuS9Iwp485VuPgtmoQ+kIdx3Tixqd6LxNPXJDlGXXB44FBlEwJyKDavjjV9r1Xub2aDgW3OwjXdqinTZQoA3IdRin2t2ziY9j1AKUdJQWWxWYVTs3ahiCbTbOhXwAd1E9ejQ1WhTXnLVNZqpqjHIK0QHunrpXEhud9MENmC+o2MYMfB3f9BPGoPaQ50KzjlJXWFPhNRQvfPyemY44Ih6PVtilnpQWjk/E7r8niAMfp5eBYwh989OrbwlikQX5EJ0CG2sKEYgb2cHDnFn1fpCR1c082yOU6WUpPOJxsYC59sypa8BRx2Fvofl+KoyMC5GFTT2w/hC0qE8Gg== 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=uk4Aq+3imqvr/LIjNMIF8PPZuSEipaDzcqXRp6mLp00=; b=Q4Oq0dW9vGYSiOtd883hgbv42fPhnZIxdugUyPCL8fVYCIiHJ5rs3PNShP+wC2KG49l06bu1pbea2khSpZua4/ZjKQW/z1uWqhr2OZnK2qkhDxWFXTtUH77jt2JUTl7SlsAQ9CZM5EOHtPVgVxr3y+kUm0mbMlFN7uvtN7+En1Ic3r2YyToKnWhyVGZYYS+yLBGEwCA7sRH++1zSAvaDN5ObUQSTmMgt1pkkYGPYzy1Iwgv5/Qyd8pZWTp5QngWqmHeOeWAjncrvBP/zEcJ7Vqv0iYdV7+So/YOnDsZYVdWhKf+gXyTMIe3xJLzh/d+mrPjCbPXjHXBf7f92WdYAIA== 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=uk4Aq+3imqvr/LIjNMIF8PPZuSEipaDzcqXRp6mLp00=; b=hF1n65pSIOzKcByyLpF9wZkJ2Z2arVIPVjJVUOE9pOSG7xA4nMPM/mz5RJnAX43+UL1B4tWopKpu+kTREJgW6OWEK8d97kldYL1GOmAYROSJwpfDuRj7EH+qxeqSwpsE1yhz4/d+b/9U22F7FJ4PU35seiHcEkFwhJESyCOXnBg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=toradex.com; Received: from DBAPR05MB7445.eurprd05.prod.outlook.com (2603:10a6:10:1a0::8) by DB7PR05MB5338.eurprd05.prod.outlook.com (2603:10a6:10:64::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.15; Wed, 20 Oct 2021 19:27:07 +0000 Received: from DBAPR05MB7445.eurprd05.prod.outlook.com ([fe80::98f8:53ac:8110:c783]) by DBAPR05MB7445.eurprd05.prod.outlook.com ([fe80::98f8:53ac:8110:c783%3]) with mapi id 15.20.4628.016; Wed, 20 Oct 2021 19:27:07 +0000 From: Francesco Dolcini To: Greg Kroah-Hartman , Jiri Slaby , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team Cc: Francesco Dolcini , linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] serial: imx: disable console clocks on unregister Date: Wed, 20 Oct 2021 21:26:43 +0200 Message-Id: <20211020192643.476895-3-francesco.dolcini@toradex.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211020192643.476895-1-francesco.dolcini@toradex.com> References: <20211020192643.476895-1-francesco.dolcini@toradex.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: GV0P278CA0062.CHEP278.PROD.OUTLOOK.COM (2603:10a6:710:2a::13) To DBAPR05MB7445.eurprd05.prod.outlook.com (2603:10a6:10:1a0::8) MIME-Version: 1.0 Received: from francesco-nb.toradex.int (93.49.2.63) by GV0P278CA0062.CHEP278.PROD.OUTLOOK.COM (2603:10a6:710:2a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18 via Frontend Transport; Wed, 20 Oct 2021 19:27:07 +0000 Received: by francesco-nb.toradex.int (Postfix, from userid 1000) id 069B410A3948; Wed, 20 Oct 2021 21:27:06 +0200 (CEST) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: aed2924a-e91c-438a-4dac-08d993ff9ad1 X-MS-TrafficTypeDiagnostic: DB7PR05MB5338: 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: mORYzimFQMJ4l3L52JsjHnHzDCEm9w3oNht+ltGIMYNn7uW4huTvJn2gBDXQEBrUzHmddlvMcyiLOBM2DaINPZqDgJt3a3EHnmsing6ppBXHvUFPaSM/w2t4iUmVjRz7HdbP6omt96ET7l/zAjQUW08MOAaPNKhrNVB5DESHTp/2T+lxRY2a9m/PQ+Bo5Uto78awI3YyP6+1LJepbjRcKYIFlf2p7j5UT8LUN3a/Z3yQjCPDlG1IhZafriJ41qaBwpEM37ml/e/BiEO/Ux+2p0+nOatdmx/Lgfntubdve8H87waX1bK1uBir4ZwHs3xdwpX2Qh/p0oKn3sD44POVWHS9PgbRXBJ2wawywpTPWjAy6BO6wdOBvjMbuT5vURa16p02jpOJT5DybgpKaBNn7SVaHF30Tc0pn6NHEsvU3k84aKZNV2bc7PdX3fTf7NtgumE9WOWnPAHoelBx9qbpWCoBEjqvM+g2SShFagy9UJqoYdAoeuoFnrgu6u0WdCpO+lk0Y+Tb943ZYnwpCO84P12qR3wwFCbFOZ4KZNUcDzM+L05b+E8gFa3QcSJdGCmKh9JbTyzYCbZbOXvhO+P4le/QjbClj/1QGEx42guWafJq4p9591ED6Hf5jkTxmu5VlZah3bAYR9wCDzlKYbtFQJpQJsCEfTLSOwxlZmIPRGoGwfaoqK8zG0f9/GWQh9S8e3y1LWEMEezFJurROKnM3w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DBAPR05MB7445.eurprd05.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(376002)(39850400004)(346002)(136003)(366004)(396003)(38100700002)(38350700002)(86362001)(66556008)(66946007)(7416002)(6666004)(186003)(66476007)(1076003)(83380400001)(508600001)(2906002)(44832011)(42186006)(316002)(36756003)(6266002)(52116002)(8936002)(5660300002)(4326008)(26005)(110136005)(8676002)(2616005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?UdWyOD67mEi3ZChrlf8Mfc5da8b3wN77ZeRqwC/lMy5Hkz4QJEaFqKEfxqIc?= =?us-ascii?Q?x6AZqL3YdiXewaKO0nm7tfo0RyXT82+LSobJku3MSMRdFWVNbacie18rWMr1?= =?us-ascii?Q?hdzLEdX4vhIptN4iOx1UGPlsVVscIZFh/YQ5Ut6TIxfmR/kg5ZNbRtZcv0N3?= =?us-ascii?Q?+7vXg6jFuPSHtcQt4kkeFVCVXSIBVOI3BrBEhDWEtGegoFMlmKwpTfR32UjD?= =?us-ascii?Q?LIapCyQgQVVLbdvvFLIl+gv28dlYFkCfloDmcnMUF+CthdcTwiqfGzs7CBCx?= =?us-ascii?Q?hch9gFtTfNW0ZDR4J7QfOZQBv52Cz3RjGlGpRn1sYbVLsBhsNukzf42VQgJZ?= =?us-ascii?Q?ZqyywrTQpg2fyP50DGlo46ihSXUS8WAru/Nvi2ILL4KsrgaCA14KpizdbRPW?= =?us-ascii?Q?EyGZMcMCx9busc31F7h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= =?us-ascii?Q?N5xInCB04MxOTANu9MHpn7FDFNcTnxfpjU8TDm6DCmQi2Wt+kqKMjuGc+d7o?= =?us-ascii?Q?3RL757USJxAXN7VpWhZkIXjJ8WxIK0qQugJTuj0siNNIZvScEPLRfMgdl5Km?= =?us-ascii?Q?1SvnpkgSVYL7q1M+Ov85nRZTG8tIEci8AgXzfGkSASBmy2u94arDu4QavgQm?= =?us-ascii?Q?sfhtH0l+qHjc5AGSW7Xcd9PVTm86G97fpLjWekWCwzUDcZfO6PgJLL1Su5zR?= =?us-ascii?Q?9dJT8SOXjKANSH/bM5hlpNTEw48DpDpDySP+ghQNOSBb6l5Ad9cE7nlfNjaO?= =?us-ascii?Q?p2ZKN8H0o9DsRvqq5B/HkT8uNyAXlirbPS8TdHbTM3c/afDBXlBc7IPASid4?= =?us-ascii?Q?9VvZoQ=3D=3D?= X-OriginatorOrg: toradex.com X-MS-Exchange-CrossTenant-Network-Message-Id: aed2924a-e91c-438a-4dac-08d993ff9ad1 X-MS-Exchange-CrossTenant-AuthSource: DBAPR05MB7445.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Oct 2021 19:27:07.3704 (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: WA7vn/lht/mTi8MZorIF2nBzJwkPJAnIXUA5ATW6Q/liGj9roII6EdFIkqOh3v04N7+uSaaDpWUcx038zh7ybpXqpwViKCBGJHNfESr6Kpg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB5338 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 console unregister. 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, -- 2.25.1