From patchwork Thu Aug 22 03:39:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lei Liu X-Patchwork-Id: 13772616 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 32759C3DA4A for ; Thu, 22 Aug 2024 03:47:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding: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=DXaO/BUgBs5CEaRD0e7GzAh/qeZYiJTZA+WMYjS5elI=; b=GGeBZcEYdCMlrvVU1I6EomCMy1 T15fPyul5EBggCNNP6p0c+8YTiCTY9WBB3w1D1g8z0AFiSPcZdsS8IpjRuSd0yTwGYFZAOC47VUY4 mjVFrN8yIiBSInVE/c4B2FWPcx13glOH+ihEnN6SyPmsoGnIKbnc3SLiX++W6ya6CWrKiLYlVU54B RiusHt3KRlrFXI6VrdL6YIiIPbGcrlqplcZb0VMhiaPaWLO8J1hol/G51FleldDUa/Z9f9haGUjt8 0otrUITAvsHxuQoN0iXsrNDI4MekYfRnynl1FuAFwAk5EOWRI4HIxsOvDOM1VPX0hAkya11r5HI1u 0HQzdL/w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgymy-0000000BGfu-31ZY; Thu, 22 Aug 2024 03:47:08 +0000 Received: from mail-eastasiaazlp170100000.outbound.protection.outlook.com ([2a01:111:f403:c400::] helo=HK2PR02CU002.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgyhl-0000000BFNH-1faG; Thu, 22 Aug 2024 03:41:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=so4oRbI6MmJWVuUS2qZNDk7CeGKbBooHM/kAv94ENeeVHznCggywQsYaXuONE5NS+lf0BYwfUfilxiJmxc3bRxhy3+xMkeGhvPGJdhb6fkFdYwbdKUVzwDWVSiA6BFBEPqWEkky4T8xPhdJGjJGOdeZCCaf/OMPXcWgF2VRv7LkwUpFZPPRKnjHNiugC8+mQI36DevUE+n14Wvwi3xE52rUuDyvPUqExOk+mExMjUfVLO1KDDbvCyMglAYz8pA60/eMpk9+LTYAnLHRwYygdCWUN1I6i1sQuufrtE6iO+hQenLxOvfYzbFfG3jMNVpcoiQ2JFU8cJoam8QSVgw7RWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=DXaO/BUgBs5CEaRD0e7GzAh/qeZYiJTZA+WMYjS5elI=; b=unGJSGN4yW/mOGwbIJDbrfyVc4mkI9fqyMSagpPhYRejR3HFxzqxteiNfg8dUtzLiRmqeQil3sYCFJeabsox/Uxb8HVWqMzwlpaVGhn/9NJ4Q7MO6JZ0RxtA0JpQ9gZIYVkjD2ZLWCWV2HcJSsRV5We17twSv9mMguuOAVgKMOwlCcoQ5AV3TYu7a2JN5MWerGHOSIAp7Rs+p9CZl56Lfe197tVVP51skbT6l/cD1fHqbLH/Q9w7bYSI/hLgrg3EszP7l7eqzU7CVUdYoBRZQSxZxTLDDp28R8G8eyOS6NsKF5TmSAhfPQY6sx/75AB3qk0s4WM51FEE70pRn3QiaQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DXaO/BUgBs5CEaRD0e7GzAh/qeZYiJTZA+WMYjS5elI=; b=NApVhBQP6G4GRGy4LpWAfBKNe80TA4Pjjjuh1zUWbhe+DH2SxTXI4jsB3yjM3HHl1TED61inoPOJsMheCCeOggx427Ki8XX9kQhqErKQC9bSFAz0BN9upavvOASH18/3qvxIwPeVtMdtx/G0fOvoK1uFyWM4i0DPzlrhR58pJ/AZbcIw5fMbd2bxqdW+5LbcoaJ7U40ur9kW3M1P9UaApJZzCGKs3BQXlYwE13VUlOUx6rTfLibSSFafQnU0iZEdcu9XW13eq5tbJBfB7+oGrJIOULx7fOwvZWr9aSpY+q4LnDoP5xloRiPhVxhdwnX8QQNXfyoiDktUXPSXrX8KsA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from PUZPR06MB5620.apcprd06.prod.outlook.com (2603:1096:301:ee::9) by SEYPR06MB5892.apcprd06.prod.outlook.com (2603:1096:101:d5::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.18; Thu, 22 Aug 2024 03:41:39 +0000 Received: from PUZPR06MB5620.apcprd06.prod.outlook.com ([fe80::b771:8e9f:2fb:ee83]) by PUZPR06MB5620.apcprd06.prod.outlook.com ([fe80::b771:8e9f:2fb:ee83%7]) with mapi id 15.20.7897.014; Thu, 22 Aug 2024 03:41:39 +0000 From: Lei Liu To: Paul Cercueil , Greg Kroah-Hartman , Jiri Slaby , Thierry Reding , Jonathan Hunter , Kunihiko Hayashi , Masami Hiramatsu , Richard Genoud , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Liviu Dudau , Sudeep Holla , Lorenzo Pieralisi , =?utf-8?q?Andreas_F=C3=A4rber?= , Manivannan Sadhasivam , Patrice Chotard , Maxime Coquelin , Alexandre Torgue , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , Lei Liu , Geert Uytterhoeven , Andi Shyti , Andy Shevchenko , John Ogness , Thomas Gleixner , Sebastian Andrzej Siewior , Jeff Johnson , Valentin Caron , Lino Sanfilippo , Erwan Le Ray , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-actions@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com Cc: opensource.kernel@vivo.com Subject: [PATCH 7/8] tty: st-asc: Use devm_clk_get_enabled() helpers Date: Thu, 22 Aug 2024 11:39:11 +0800 Message-Id: <20240822033924.32397-8-liulei.rjpt@vivo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240822033924.32397-1-liulei.rjpt@vivo.com> References: <20240822033924.32397-1-liulei.rjpt@vivo.com> X-ClientProxiedBy: TYAPR01CA0108.jpnprd01.prod.outlook.com (2603:1096:404:2a::24) To PUZPR06MB5620.apcprd06.prod.outlook.com (2603:1096:301:ee::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PUZPR06MB5620:EE_|SEYPR06MB5892:EE_ X-MS-Office365-Filtering-Correlation-Id: edaccbd1-4604-4120-76fc-08dcc25c54c4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|366016|1800799024|52116014|7416014|921020|38350700014; X-Microsoft-Antispam-Message-Info: 8raaJyoT9l41r84Yz4aonNVR+MCzHjFN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rwSHMYqeasanlfFcSWsq24q67W4GCKXnk4H0QIn91s16sbUUUQknG5rcTj0kKixcslQ3jBXw0c4x12a7jUbjUbnOkWQDLaBjXS+9HIHCoduL71EWBGZ3N4BvY05J8FVvzba2FWabi3M/8EKvYcGLXIP7NvdqfRImCH6ZRUnUNPGxkV9lBv4mywBTqIXxfLL1vV71Zk5ARaA94R0LB59naCjkemwHrZ8q9IMb+UmhG2G9sIbho1pC+Xn/bLVDuzkcpxMFjBpvx3wNL3SlMmf9XDFvrjqRMpGKkOWdtigtd1ywfnwdBNg50TeZaN/DAXnjSGnsWQSWaEA+0= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PUZPR06MB5620.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(366016)(1800799024)(52116014)(7416014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: j86vPhCuL2uHXBEazyGe7I3fJtkvoPacFfILH/A9yvXMOX8LbacKpj9yqEwBYA+kf+gUeaU1YU3lQA+SnTA1QRZWIWuOyIYI2Q8yNeuAWEZ2/vA7fWT/ajKQURDL0eBfmXBYumWuyJKIv9Di+eWeiUF3oNf78ADXtWRpNy57s4v1r0Ihozwesh0jsIGKZzqwVQpN63I1rINxULp6Nj+ZqNOzGuNMswQRr1BNWrixVZb23y7gULY2kRRUl4fkFgxihugc/6brlfADyk+gve5wBxVcpCwvXGVDC/U5T8Hcw3I+eUNSXhZPXYb3RdPxEwGCBHkwRUwl7CIsL82GgI85owrtYcYmeu5Zs0tvCvcCk6nYjOb2MLfbLPQQ5MSTRKfsO1oRnIQSjxhdl8hZ2HRcfOW7OH/Ts6MXNS/+6G/RDHmj6ZBlsqh5OWfSs2/sl2jhC/E29xfFToiJOVebBpLMi18N8K4EhG91V06o2u5XneCHiimPiohj7LqHWf2ICNS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QZ390ixGIJCqp X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: edaccbd1-4604-4120-76fc-08dcc25c54c4 X-MS-Exchange-CrossTenant-AuthSource: PUZPR06MB5620.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2024 03:41:39.6506 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: VD+EhJpekOgGiERZ2cAKMMyaWBNWItyWTeDohYJz8VSXYeZpGVbxICIQSIc3DM2DycVy40Fu91co92EXkHvnkA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB5892 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240821_204145_492477_B717950F X-CRM114-Status: GOOD ( 11.83 ) 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 The devm_clk_get_enabled() helpers: - call devm_clk_get() - call clk_prepare_enable() and register what is needed in order to call clk_disable_unprepare() when needed, as a managed resource. This simplifies the code and avoids calls to clk_disable_unprepare(). Signed-off-by: Lei Liu --- drivers/tty/serial/st-asc.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c index f91753a40a69..df666766d50e 100644 --- a/drivers/tty/serial/st-asc.c +++ b/drivers/tty/serial/st-asc.c @@ -706,17 +706,13 @@ static int asc_init_port(struct asc_port *ascport, spin_lock_init(&port->lock); - ascport->clk = devm_clk_get(&pdev->dev, NULL); + ascport->clk = devm_clk_get_enabled(&pdev->dev, NULL); if (WARN_ON(IS_ERR(ascport->clk))) return -EINVAL; - /* ensure that clk rate is correct by enabling the clk */ - ret = clk_prepare_enable(ascport->clk); - if (ret) - return ret; + ascport->port.uartclk = clk_get_rate(ascport->clk); WARN_ON(ascport->port.uartclk == 0); - clk_disable_unprepare(ascport->clk); ascport->pinctrl = devm_pinctrl_get(&pdev->dev); if (IS_ERR(ascport->pinctrl)) {