From patchwork Thu Aug 22 03:39:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lei Liu X-Patchwork-Id: 13772608 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 B8340C3DA4A for ; Thu, 22 Aug 2024 03:41:39 +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=UiZVK6mFjVNSqR1S8r8LmfxlCe/JeulgxB2FxD2lQ18=; b=RpHowY9TXzw6U5nvPKL9FrGK9B qgisSSnEK2IlXet2vx7+j2ktAbQlPFc9CyzhR/YQY4sgHFnxG/Gr4pTnii8Q8KT0jY+08YrL3junR x4VhiChhK+U4mTECZKRh3cmBxMxSsb5+aLmSMfFwM96zdaTgYpGXkE1DI+ruCGKCXddyji5dZbXj/ Y/eoc16L/+W3BDkeczNWpHyrzdA69+ImQ3zeXDcLda21totwjA710UHQrKGIhvedNyE+Z5RIb97kb /38OG5sa0COWts1KCu902grXTqIDUkmGpLpnG6sDCXevLmcrC1au3hD3yxUOUtClbg8NgOvVpqfHY sFj0JSAw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgyhS-0000000BFGa-26s8; Thu, 22 Aug 2024 03:41:26 +0000 Received: from mail-psaapc01on2047.outbound.protection.outlook.com ([40.107.255.47] helo=APC01-PSA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgygB-0000000BErk-3oHW; Thu, 22 Aug 2024 03:40:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YgAGFxZZIwEwnFhSsOYH/jGPjzCExollyjto5KvgAtGHE41iLRhstl/7RV5Nu694m7AQTc873gjE2I/6r8FhRMvnMGT+NAbqW6MRVUflWVXTmX1Z+C9kWC4SPJYwZWMr2l1gS2qhNpzhUWMhGCrrTIYa69k589Iw9QuHVZO8o9XExMaUR9L6FWHlAmhaP0QEPl0hglnjp0jmhUzKfkGDeWEdKwaYeR/WlC2pJaDflJZhGXxZJRZasRXxNedw7e13kropmKGQexxSkro9+6pWi4xInSpJVwLtRysBXGeDOyQaALc/OB/fkUu5s4OV+VISY6hUyhJ9cIlpFP7BSTSMFg== 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=UiZVK6mFjVNSqR1S8r8LmfxlCe/JeulgxB2FxD2lQ18=; b=pJZGtXX942Rz0eAPyslr0CWpWvjJkL9Y6hg9zvWNu0chzTrZk8jTj/q6BVzErqWujd8WUQdootH4GKTmaE3jyabAxG37QSbK20KIrX2dbU3EXcNNnDikANbEsPIB9r2EBflXXrBtRy6bM+wTes+yE8TQ4lLHAgRy/3Mgh27aWIaFWFnrXWlNFg7UbBb0PrlZytVkP/e9NSNTsEkBiKhmD+TsHPgDwSLzrKoyzkgTFEDhE/rhnYbvWKngovA9N2bzD4cAdeyrW0KUDTn3UZ4aI2/l4mPN+g2Ya82XdH38HX6omRS2R2Aghily3UwRxEhGVscDC7wpeockN6y3/0n1Cg== 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=UiZVK6mFjVNSqR1S8r8LmfxlCe/JeulgxB2FxD2lQ18=; b=nZSgbW62F5KfDuQREXHu0FJKelvk8GJLAdbfeCSscXyAQ1Zp3pPT3FyHmoe1UmOF4nY4hpSiCE8JLIoPR8/9NaudipmDWmJ8ChwkFeMIL6KAGhCxGisCTYz58lT8tgd48xrWC3ZboeDzbZpUr5tAJv/P3UU2KeCFHPunS9v9/x9AUxe71s9rExyTuv3U4/aT2PzitH0ZOzckzAgHR2jkw2Bv+GNkKREYcpsrEbaDCfPkDAglKwkOwmT8hIVC+CjfAf9pQozHmSDV/DUuS6nuvlnNnUCXgIFt37nGaL/dLlGcnCVxBogph7x7Y2floS8PsJK6kqyq8+A13rjgjRwiXw== 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 TY0PR06MB4982.apcprd06.prod.outlook.com (2603:1096:400:1ae::5) 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:39:59 +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:39:59 +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 , Geert Uytterhoeven , Andy Shevchenko , Florian Fainelli , Lei Liu , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Thomas Gleixner , John Ogness , Jeff Johnson , Sebastian Andrzej Siewior , Valentin Caron , Lino Sanfilippo , 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 1/8] tty: 8250_ingenic: Use devm_clk_get_enabled() helpers Date: Thu, 22 Aug 2024 11:39:05 +0800 Message-Id: <20240822033924.32397-2-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_|TY0PR06MB4982:EE_ X-MS-Office365-Filtering-Correlation-Id: 70796efc-0ab1-4b23-630e-08dcc25c18cd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|7416014|376014|52116014|921020|38350700014; X-Microsoft-Antispam-Message-Info: Eu0ziXW3d9LmtmkrMRGEssfWDIDxJDS7bTxQ8hZcegPzRpLVudrusRscVWnOk+LiSs35I5eaDrh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MVGVpoT7kg6oqRKJbpeEZXNC5a69eDNLkhkPCIJrvsq3KDFD0SKx+0CghZSIhvBV4xnzg/FcPaddbJai7s7GcXMbvgQnJYroDsPVtyLe1lhVu3lDWr/g/uoDO5zpIL6hy6m4/7wpBF8EouskecyXs7LxXGvmJAbtrDBo9h/h9poOJgRK/9y1vTeRna7hZT2AoljbkFCTBC5es/6nNB/k4PgVk5Lzpauh+dQi6qBVQ7ZoL6XVv3ihhqagBBTtzq5Bhg0iKGQKmbSCJ6mV+Q9770xJmX2FgQw7pM3fllN3E4= 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)(1800799024)(366016)(7416014)(376014)(52116014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zilX5i/S0EK2BJZP9PCzezZhJud1jrQ2ypprTDCIk3lAFGnuNCnmo475QOTq2SeKRr/s8pTIT72qkIpA5kge1pbCSgXdAuaveJZskUByF8vdAXYDxjZUx4fW4bXQ5jVa9FUrsCLCe4zKFpStpcHUEeDIq9Wi+J5LsC4X7HiCV1ULex8lnasRsJAxRxKZnmIay0hmtNkJRCyDdy8DTyB7lhetu8Mu//xeb7rFndpkxgVjb6Y3E2yoooYm08nvcOvORpNSd8qoOMW6bIEN7RZq2gh5f8O+Q2bLAtvxIJDIDy3q91RFuQA19njlLpL1+WSSl0lc6OpV3MED+bg1tS7URvimxdQppBRloc5iMuXn1nMtnnvdk6U/2VbRiES8jQF8/PSmiKoPvObeLjtbCaPjzqlweK1VyrbxmA5v5EuAvtMtkRd6OEk3tV4EMeIvgZa5gPzMOtIn53bHrGKBYAC5o7Kttj/BE+sd2v0cdVIwKzQLj9DVYlw5oPmONZ7s/yh03QI0iISh7tj2zHw66sgsrZvUC9GYw5nL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change-CrossTenant-Network-Message-Id: 70796efc-0ab1-4b23-630e-08dcc25c18cd 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:39:59.1991 (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: r2UMZpRAk2ao4UQFIy0cr43pbAs0BmlkXfOgYlnBXazjnmBB9sf6Iyoxoac0oeTfzHRmSCjM/S2lT0ORViAlKQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY0PR06MB4982 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240821_204008_088577_4222F59C X-CRM114-Status: GOOD ( 13.22 ) 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 Acked-by: Paul Cercueil --- drivers/tty/serial/8250/8250_ingenic.c | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/drivers/tty/serial/8250/8250_ingenic.c b/drivers/tty/serial/8250/8250_ingenic.c index a2783e38a2e3..5f8787309064 100644 --- a/drivers/tty/serial/8250/8250_ingenic.c +++ b/drivers/tty/serial/8250/8250_ingenic.c @@ -274,44 +274,26 @@ static int ingenic_uart_probe(struct platform_device *pdev) if (!uart.port.membase) return -ENOMEM; - data->clk_module = devm_clk_get(&pdev->dev, "module"); + data->clk_module = devm_clk_get_enabled(&pdev->dev, "module"); if (IS_ERR(data->clk_module)) return dev_err_probe(&pdev->dev, PTR_ERR(data->clk_module), "unable to get module clock\n"); - data->clk_baud = devm_clk_get(&pdev->dev, "baud"); + data->clk_baud = devm_clk_get_enabled(&pdev->dev, "baud"); if (IS_ERR(data->clk_baud)) return dev_err_probe(&pdev->dev, PTR_ERR(data->clk_baud), "unable to get baud clock\n"); - err = clk_prepare_enable(data->clk_module); - if (err) { - dev_err(&pdev->dev, "could not enable module clock: %d\n", err); - goto out; - } - - err = clk_prepare_enable(data->clk_baud); - if (err) { - dev_err(&pdev->dev, "could not enable baud clock: %d\n", err); - goto out_disable_moduleclk; - } uart.port.uartclk = clk_get_rate(data->clk_baud); data->line = serial8250_register_8250_port(&uart); if (data->line < 0) { err = data->line; - goto out_disable_baudclk; + return err; } platform_set_drvdata(pdev, data); return 0; - -out_disable_baudclk: - clk_disable_unprepare(data->clk_baud); -out_disable_moduleclk: - clk_disable_unprepare(data->clk_module); -out: - return err; } static void ingenic_uart_remove(struct platform_device *pdev) @@ -319,8 +301,6 @@ static void ingenic_uart_remove(struct platform_device *pdev) struct ingenic_uart_data *data = platform_get_drvdata(pdev); serial8250_unregister_port(data->line); - clk_disable_unprepare(data->clk_module); - clk_disable_unprepare(data->clk_baud); } static const struct ingenic_uart_config jz4740_uart_config = { From patchwork Thu Aug 22 03:39:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lei Liu X-Patchwork-Id: 13772609 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 7B926C52D7C for ; Thu, 22 Aug 2024 03:42:25 +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=1r3BMP1FBquX5ukAVmQnyy2vqTNUoSxsqb+JL74roAQ=; b=RKcViI4WzjycHJiuOh34R60/o0 0u6rwcgEvtWvocU4oFrBdGONsbNXB9i9Djh0sWs3KysYR9+dHz8cmuP9LnNT54DBUgMdsrMtsTZMi ej+UthJIKCATdSGFnN2kCIo9skNsdSA1Zm726BOUKGXlGB8JolTRF3ovJlpJpvmQxY6oQXbEM+hry 5HutuCQXq3szU9Xo8ReQE80FvdEWtCdWjwlVkWYLZ1M0UGP9Iq1z2oUOLFV47UuhXnxK1U+gyIujH x4xj6iwP4aGIunaxBdHm802vY2Kh5cvSuMlsQsxnZBA81xozDMTsxc8wqO/++rPDj/mDBYXY7lwrl hPORsaMQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgyiB-0000000BFUQ-0GPX; Thu, 22 Aug 2024 03:42:11 +0000 Received: from mail-sgaapc01on20628.outbound.protection.outlook.com ([2a01:111:f400:feab::628] helo=APC01-SG2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgygT-0000000BEwl-2kYM; Thu, 22 Aug 2024 03:40:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ApIjj4xwrqe4fCIEc2buyqhsKEHyMc8Qc8ce7eG2PFjKHc/f0HG8SoP1Vjd5UDWIfcSR5RfcM4bkpD62Zj09cySE5jk6XvkI5OQuVT5W1hlhfPB/eUi90xU7shEInl/Wvw8TYCoIZUDI4mY2vN96HybELhSQ1Obk/w2+YJiVZctdYQf62ErKVFDtUz90QGxocRvujDBGKPGCfNsw9c5/rXeUA2mhDr5/0hVpa1ncei6eSyODLQo8726oN1waaDVGDVjMRdTCbdINoPH80PfsxvEA+uHusJWUu6ugpvkkd+icmOqsgpTrOdWwt19KCyTQu8pDXHQx6lxlHxJjxwhk+g== 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=1r3BMP1FBquX5ukAVmQnyy2vqTNUoSxsqb+JL74roAQ=; b=IoDlQE4TSnbvlFv7AFuAqlMIgG11sPjgakXQQgQfTIaJS2qXBg0UWgcbO4YHebHYZSigYHqnCqgtVfrkzmtjLEeN831umEYPblk1gQtY0J9jZe5FKgi8OZKIGKhgz2ah5dHVKuUDjyME9Yr4UMKp5cRTPdLD1xbehNU+HN0ZgwKR1+SpcTqYF7b6LmThSdtXyd6GuabBJ+LLawj45Y8G7S1qK1WN/IW4jCX3vmcjkpI95HbDJ13+6+qAGaKxXZnG5Xvm1IPbJzL5SUYza8l9NNdF1+SGY8tP1DP1JjqIJZeFaVUI+eGTEJgNHu4APIuzXrfEVCHua4//LRI5AMlSDg== 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=1r3BMP1FBquX5ukAVmQnyy2vqTNUoSxsqb+JL74roAQ=; b=afglBshmBJLHeJa34Y1jwwRFG2mw3ztvrQq+BvicoWodb3gGtZBKKQ8CIs9+Cw8N8C18WJurdfwrex+Dkecqkf9+4Yt8IxylUNty4H6rVHDTYrq1udIV2vEIZyMpXBMoa9lWLkgdmHNFOjKSGXmkb4TmbVyf9MhzA9ujcMyvC4UitvptrbPw+TydxioAjpuKLFzoPjxngMp0UpiVNGRh7d37DszrBzuLVGCR6yTCXQaw4luGvcwACN19dpOr8pJb3U3Vsd7z/PUjADAxPrJ1/gsFvbN/SG4l09QfO1d9TjnyFJYeNXLZMAaW3IzNIeRHvaRWCLcxkNvXRkFH8jVT0Q== 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 TY0PR06MB4982.apcprd06.prod.outlook.com (2603:1096:400:1ae::5) 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:40:16 +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:40:16 +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 , AngeloGioacchino Del Regno , Florian Fainelli , Andy Shevchenko , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , Lei Liu , Thomas Gleixner , John Ogness , Sebastian Andrzej Siewior , Jeff Johnson , Valentin Caron , Lino Sanfilippo , Amelie Delaunay , 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 2/8] tty: 8250_tegra: Use devm_clk_get_enabled() helpers Date: Thu, 22 Aug 2024 11:39:06 +0800 Message-Id: <20240822033924.32397-3-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_|TY0PR06MB4982:EE_ X-MS-Office365-Filtering-Correlation-Id: c131b6cb-d370-4ce6-2def-08dcc25c22e4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|7416014|376014|52116014|921020|38350700014; X-Microsoft-Antispam-Message-Info: 8BPbImClTiTfGKByfvMBUjdmwqGzTZephM3ILcfY9dOULHvihyLZWp2f9KNdXrZlKW3mEJ1H9cllGbl+O2rL2U7EAp1ZV664tmQUhOB65ziCF8GzPP1ATztc4KViGYcelVMo5PKblSj27NAbX7maDSocupt5cEJX8RDVJ6N4Sv5BnlhgJR0hdSa13I1cCXVwClvT3dHcRh/VFdvmYmPX0OdRe6J7aGfcqTy/EuyNqFq5PXA+NEX+Qc+3OMPMsj/+lJSmBP0Z5kdVu7puIpoGu01pxbf/r1LKnzd5kz6yzs4SDX18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BKt4oh+Y4SKn7guBedQ/d8AwIO2ACR7V8lkmfccdowWs1ga4p2WWnl1r2gF0G1vqm56Ds= 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)(1800799024)(366016)(7416014)(376014)(52116014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RoY9kpzTTbZqVktKwuKWn+8T3PbA98i9nkvRob9R8yaFQe1+h4oWs3uGOknfNDRIPG+sKdhEoVBqdeIbqja0MTYJCQOEoJHfVPbUq8tsbzDcQ0AycTdx6mr8HpYmyELDUgIEEJZYnzYMtKLhAnxAl+SxPMQ5nPt7oDkF6KpZPHPvwGUg+Mw2s45gO8hbewg4ulmuAfnly4Xc7XnZoX4n5papGM9CcaxhsCpk1IvrzVh+cluXed/MCgXVFVmMPiJkQNAR5a7egxuBhLqFtL8VyXyKfcgZYOrfzphA3ySYTbhykjvs/A8LnEjt0saO5LlXc33/owCY/rZ5OErUlvnKzxvU6p8p8jKHRSX0LY90YWEKHQrJppJU4lBKQpxOkqWLKlMwrpJ3kBq0ndPfuaaBuKB6vpLqCUVE6x+FaSBXXymhCi4+/WikqfpXmtZuIL2Y0t4Oa4PrnQ0GjaE1Av+mfKHiLOlw0bht2z7Uj4nntbEnYkNuZNaIN48jIw3s3cp6dwAYnx7GIY9BQFN9nidF/dWHtfJJIF8b/VFlQ1cwnLbWdQ3Ab8aKdsNBCOkbv0nb+zW0LX/sFeTpfDgcGNH69iPbt1um0i/Gqe7eP/MCmG7HMbUJq2Wzmn/dAgu96SDWGmJlV1CD8nVFwjubuHrdbwHQ4Q4yl+MX4832PhuYzyONPsVqIiD/BP34uFXfzO3yPdImwfgG9ah/P/RcROXSsPoxsb5yeVTbxMZdWEdu8iAumLZSkPW80vHnHB/kczQ8ygBuchBW0JPMh1ppjHTabBT4TeBCqNpMhlfyBkItY+4XfTTtanuirA/jJqu2TxX2xwf6k3bUNo/hiU40ZbG28WoLgxRr5W0+D4yIJRC+uiDnpZbO+JKqp9w6Js0hNGk4K48j1Wp2elzpxl0h8hy172wb8NO8UOFjDtE6XUSu4Mb1PTAqyuqDWrrk5wHODojsD2pxrYOe7G7plh5MhC33EK1erVgKI6M2CEoECti9zTWP+8bNmcQSjz0SJ8uc04AzxJL9yZMnBfzZ8ss4qHzBQY2IGYZcxNzl/YjkY9YbrSkb06DyfPOYQI1zEIBQqiVMmY6qnb9B2Dqkks4Tt9OmZrlNZwHGL6nVZQ33YfB9MPhfHMIMuJPC4yqU1Hu9877jG7nrePXWpiYpWHeInOwj13Q3nDXCEF95FKssN6ycI/shEoFSt85+rr4xQvpQHi+9UQTcE7eYVj7xLOH1zWAzDOz+fVSabZC4pOTuc6J2VaVvwHqZhD7x+d4VMLh8P9loiZAT0ZdpFT03N6y5tWp89bWhuKFfHY2NzlydVbQgKIWAl2PXYV7gJh02G3VByjPbYk/j/qmDcwt9bNESHHtr3zJeOixCrPmb9whu6VCxgL1HDefonYSqJC36n8Ky52egucn9e13L/J35CtdNJeR+V8Nzb1nIkUhxAvDdinj2pTuWCBlBrGNiw9wWoqHE3yUOG8lS8dYaEw3UWo8ZyBRxH347iM0qoid896jLpkUa0XYYUv0nwS+b5Jjl6HUzIPbY6hMXISYFWvbO0hUq+gKy1OozeT7s0mUkcaRFABzZLkDgZsvDpSrBd/MWFoRVdRvp X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: c131b6cb-d370-4ce6-2def-08dcc25c22e4 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:40:15.9677 (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: fLLQb96ugYAbmegAbSuPjryD6A1WTb7Zm6UQf2fEjCWVI7AQU3GooNbIBjsaib3D4EEos2Otdf99QcLFcbkz7A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY0PR06MB4982 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240821_204025_723260_55D4262E X-CRM114-Status: GOOD ( 11.82 ) 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/8250/8250_tegra.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/tty/serial/8250/8250_tegra.c b/drivers/tty/serial/8250/8250_tegra.c index 60a80d00d251..a38a4eb3235b 100644 --- a/drivers/tty/serial/8250/8250_tegra.c +++ b/drivers/tty/serial/8250/8250_tegra.c @@ -86,16 +86,12 @@ static int tegra_uart_probe(struct platform_device *pdev) return PTR_ERR(uart->rst); if (!port->uartclk) { - uart->clk = devm_clk_get(&pdev->dev, NULL); + uart->clk = devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(uart->clk)) { dev_err(&pdev->dev, "failed to get clock!\n"); return -ENODEV; } - ret = clk_prepare_enable(uart->clk); - if (ret < 0) - return ret; - port->uartclk = clk_get_rate(uart->clk); } @@ -115,7 +111,6 @@ static int tegra_uart_probe(struct platform_device *pdev) err_ctrl_assert: reset_control_assert(uart->rst); err_clkdisable: - clk_disable_unprepare(uart->clk); return ret; } @@ -126,7 +121,6 @@ static void tegra_uart_remove(struct platform_device *pdev) serial8250_unregister_port(uart->line); reset_control_assert(uart->rst); - clk_disable_unprepare(uart->clk); } #ifdef CONFIG_PM_SLEEP From patchwork Thu Aug 22 03:39:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lei Liu X-Patchwork-Id: 13772610 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 BCD22C52D7C for ; Thu, 22 Aug 2024 03:43:05 +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=yFZLkl2G+2rwqoEAfBe7yjbpU8Ts4HtAr8hXYv56EuE=; b=UFOCV0HEQu+4yXwpll0b6KK75Q Gym+anLWNukOoPkME+hLNRPT10YyPYXcBnGSh+S4URaT/rFZXxOpaoowgOjat5w3SDWWb1VEe1p0d 1x9uG3f36F0QMYc5HZjA5SZp5f7qV0mEHdBq4sgl4k7q915M7dcBs6UrCmrdJqzKn5LoPVa/KbY8n OOvHucRQDV8fCB25NPrk+OkLRNGgRJj/9YVIKIQpsZaGs1cYImLXiGCxyhoOonDg65vUIFiPcUwQ6 v0t5raflznRtSJYtaKyCYbEzVvSJqnbqUsCLITdf66dFzdJ7jRCsH+ehmZFB3f9h2z6WKsm9eOK59 tu37xnzw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgyir-0000000BFjF-1qrQ; Thu, 22 Aug 2024 03:42:53 +0000 Received: from mail-sgaapc01on2062a.outbound.protection.outlook.com ([2a01:111:f400:feab::62a] helo=APC01-SG2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgygj-0000000BF1W-1Qcy; Thu, 22 Aug 2024 03:40:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kPtHFRAwr39B5oZgDtRPo06eilLVw4SX7d/atzwo9WyWyW9IqESuK5dIvfy/LsX4okhbGHN6+YZgJkG4z6F1hacQJSDiUnYMfDXnh2A8v5tQF9YGv+/egXCwUemnPcaX7Ri5Wh7mCUAJ4ieRpssoN+a2CVHCeNGYcw/brTULkfzaGAN0y/ScOgdNsgO2jncvVsgHJK12rM1z5CyGzPXuDFvJPOZA9RYuBF2fnh8EmZO6ZwJLtBpz9oc7kjj4luXciMHIVgSMtQmQUe930L2bkUyd3ykN08Lph7rQq8RHNlD5CgP4J3i1HEPjs7wtKGeIacq93d8SAlVrW3NaJVFVwA== 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=yFZLkl2G+2rwqoEAfBe7yjbpU8Ts4HtAr8hXYv56EuE=; b=L17sVS9Evg95XbDmb/EONaNFucXCWcHc+tJ+r8S+fePleefLHQSfhIZ95JpOHDgfFdW4s6YnJfpDMQLEcEwi1N72ezts2T5ai9LFPS9mSib63PDvWGFtLamancMIyCInL0YADNLkazaVxSA4mbl9D1UJgnVUweQHOLHjgM4FadOy9ReITuIcKljUYh87RVkeaLXhXt4nnWyw6uU+cZiYI2oThaQstMeo3kMYuQyHmtno0AWMOKcUpww7eydR+axeYQancuR2yTz6PnB80QfJe2AnjxInJAsDB5DsqcSaQvqq9GUuIBDTKGX2QOKwwSKmDLaTVi4IIuEdlbfoOrnB1Q== 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=yFZLkl2G+2rwqoEAfBe7yjbpU8Ts4HtAr8hXYv56EuE=; b=beo/RBYVkh4WPIXTw9HpBdLP1A9vl0CzyfHwrae7sXk+b/v5PX9QZ7qwanO6ByLDBZVQi7uVcBQcBxQeqgpVwYkfrwnRNKXGCLuapwH6KXucQ1A78HYLnI4qxD7Wqx2BzkduTOtGpl0aaWr7wzlJWE5uNG2hOqvqiyu13Yu+hXGFVZ6Xhf/dwqG58syvOS/XqBdc90oh2MQGyjNHO34iT30t6+zEp44HQFK1Ai5pOW0nohp9iSIkIs1Sm19zz2nyOfo5P2e3dpbcuKQp3jAAbM7V16eQwuVlevHPgKG84sEoBCt7c7B4sYe5MjoB/Nbgu9DMgK6zF5MZMr2o7tcWDg== 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 TYZPR06MB6565.apcprd06.prod.outlook.com (2603:1096:400:452::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Thu, 22 Aug 2024 03:40:32 +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:40:32 +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?= , AngeloGioacchino Del Regno , Andi Shyti , Florian Fainelli , Andy Shevchenko , Lei Liu , Thomas Gleixner , John Ogness , Sebastian Andrzej Siewior , Jeff Johnson , Valentin Caron , Lino Sanfilippo , 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 3/8] tty: 8250_uniphier: Use devm_clk_get_enabled() helpers Date: Thu, 22 Aug 2024 11:39:07 +0800 Message-Id: <20240822033924.32397-4-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_|TYZPR06MB6565:EE_ X-MS-Office365-Filtering-Correlation-Id: 8ea68a87-5e89-4b5c-e9d8-08dcc25c2cc7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|52116014|7416014|376014|921020|38350700014; X-Microsoft-Antispam-Message-Info: oZcpsSCMLrNPa4++5BH7nnGidGDjds3r1LeQwSgMxjxfYSEwDfdKUNWMZeDYFdD1uDgGSz8DTq1Ylpf99wOA49JV14qlNTwjZ08QvAVNcua8Eknr2u5ZEsrwmGB0UQlDoVPO2WwLphNJDyY7MioZbSlwDPHS3gI1fTvE0y/eWOmeXouumZkiV5hPJspbpX7eoIKigvE1/d2t2fni+fc2sOTu2xkjllUEfpArHpZTTsVJgF3uGMasXWr3qni4wwqoGYZ8NTQ0GEBB2ir8Fa59uBEzu7qwgVxIfC80wYI5adbbVU/16npcVrhI7ZaWt6w+RjyF7VP4G+ozfiTASLno5Qg5ewOyyEQGMR+jnFqfb+DxB9op2uPws9UQI/4+Dh2Zvbmd7ND1SyRXJNI+17B/odCbh9zSDWHmwP+ta2nYZWjX1+SayKaZZgIEZRlPlkes5o5lad//AsNXpCxv5xTqzcQXGkEI0D2ds2F56iJiJ1g9dLM9TvoZPNBN3Ahul6TZ4jAhV1dUUR/ltiXrTUhtTQgdGsh1VkKGUjZfdz/PaLeEALqMjHGOtnfPeQVpPlFoJaJbohbz9294URRBH8LDOSnj16W5Clpyt/Fe7ED9wIF1UBvkDDS1x76CqeMdQR6sgzmwa7vgVUL4ZRshXRxp6elPkhrbvq0wekRjD2EP/+jHzuRWp8W3yQ5QGQWiYal7xdCoqnwh4VFJZElJgUVO9d++kHRpALMaJ9HZqN7Ew3RUAJN3hpnUAKtHjNzJ6Ehqqv9NRYJBqKamS8NIutKACq3y0WtXSkAmXIR5Y5aLplqMccdX0WTaSSFqNXWIBGKiKKAoS8v4ZaPL5pa+SGzMiq88l0KmY18aPZL5VFil2ai/WUFvA0b9EKBRapbdg0Za6GyrYKzEzDSWbB1Gd1KRPbxlu7f0Y4A54l0zeRUGE55gMcI5OmECxByjC2FC1FM/zTntgQ3qr1b75zy+h6gyzy10PynmL2CiakczaAj8TktS2zefn/+of+HUCjl/vKd+1Pgo6+Crx6Y/xKWxxkE1cD/jqEZmSu05xkyeYJxDbUbv5vLVKjZ1a/w0pw4F8JnY182x3+C2A48RwuND74jkaXyOaqkSVIeEnF8XqmLiqk9X9XrjgNgyN2hAC1ZBMOLwJwVkFomb51aJs/vtlDiKfvP49HC7diQHe2GMMLL0XkV/x29JrFmLjQS1br2aEs+jqTT/ex5NNeaajR4I1UcH2ctczWuxjzTzbvsRwVXwlBw9QCYJQgVa0DjM8PLHsHXACQmwptJfkrmooLX4RkGxGcQf8QlVwkoj/vCnMxeL7VWddqy8YI59Wr2MbfjpX7mIKiKkul3vAuHg+QIuChnSVGL44IIjj4mpvaiztSFb/AeeUSSYh6yR12DWMrfKku4Am72LCnXtGps6XiPpZO/7NXpjfYYNXIH1YPFs3fqWqXw= 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)(1800799024)(366016)(52116014)(7416014)(376014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: IzKN/3b7svSe+PpxFcK6vkTTSiYXpLYwwhazNd0e6qfAt5faJEKR7C/7AeHz+4AYOdhcWWOk/bBo67aNny56XU2ssbXbVdL9LWxqqwcYezRwnjWH9P//9Lx5+RJfEH3E+ZG3haFQuzCOzZCMhDS5naZSVVIl9jGYz/DQpW5fltbZvSkDZYpryQFtv0uca2G5uABFIAj5POSkJiTzHUTThgYLp/fVaETaBm//OfnIqiyMQLS4J6PKt7YL+y84LpEaH3U6WZniA5eXKCZJafJLq6KKBVMq8YMGVuaoyuqIHYbQ3gg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r/p6etjpdZsDdu5CvQMeSwUZbE7lBtg8C1V+vjEck8SglH/5C8nmGr2A0lxfuD5CZMqcsYbYhkQ5DGLkwS3P6c3FT1sBvR0CrXQ4cNGaDw0008Rfok0gpbhwyvOCMVX41cuGvPS7h5etQGtPfQVFnvkjfCKY7n3mPsVwoPjhRWjpiLjSZGdTrshkvllSc7Nl+MlQoELBmU9rlev2BuPBp0G8VFgVs9Al X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8ea68a87-5e89-4b5c-e9d8-08dcc25c2cc7 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:40:32.5345 (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: 6FcgWWaN4vCk6CEBlJBtTRwuBf38YcctL1rS2aaxTsRm6dglKTBbZR/FnFUynH1kG+b5DIFCU0e0rllYqgWsmQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6565 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240821_204041_404027_5E608F7F X-CRM114-Status: GOOD ( 12.00 ) 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/8250/8250_uniphier.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/tty/serial/8250/8250_uniphier.c b/drivers/tty/serial/8250/8250_uniphier.c index 670d2ca0f757..6ddc4262d22b 100644 --- a/drivers/tty/serial/8250/8250_uniphier.c +++ b/drivers/tty/serial/8250/8250_uniphier.c @@ -180,16 +180,12 @@ static int uniphier_uart_probe(struct platform_device *pdev) memset(&up, 0, sizeof(up)); - priv->clk = devm_clk_get(dev, NULL); + priv->clk = devm_clk_get_enabled(dev, NULL); if (IS_ERR(priv->clk)) { dev_err(dev, "failed to get clock\n"); return PTR_ERR(priv->clk); } - ret = clk_prepare_enable(priv->clk); - if (ret) - return ret; - up.port.uartclk = clk_get_rate(priv->clk); spin_lock_init(&priv->atomic_write_lock); @@ -222,7 +218,6 @@ static int uniphier_uart_probe(struct platform_device *pdev) ret = serial8250_register_8250_port(&up); if (ret < 0) { dev_err(dev, "failed to register 8250 port\n"); - clk_disable_unprepare(priv->clk); return ret; } priv->line = ret; @@ -237,7 +232,6 @@ static void uniphier_uart_remove(struct platform_device *pdev) struct uniphier8250_priv *priv = platform_get_drvdata(pdev); serial8250_unregister_port(priv->line); - clk_disable_unprepare(priv->clk); } static int __maybe_unused uniphier_uart_suspend(struct device *dev) From patchwork Thu Aug 22 03:39:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lei Liu X-Patchwork-Id: 13772611 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 51AFBC3DA4A for ; Thu, 22 Aug 2024 03:43:51 +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=kGVFJ6j7VvGl76/0BQtiLrQS1eP9sDog5mlt9fbvc4A=; b=WdrCYclPWo5fhRcTAZHZB/ApRZ 0eXXDFiWe/m90PhJPea7vUIkbLsszvuujEOybZtM3Ak8yOZdzhIa9yUlXdMUFccTJ6e1D2iIZHcIT Qxnz3rnl91q9Peq7xYbkV2pheLcJkQtLa97zXihS19z6Q6A3HBwGHazsP8XTq50uqpzkigWwBfxDE AoVfNcVTra3cuc2JK93swRozZT9aKYsYZ59e49YojExxyKYHJ9cw3hOJS6FYFQ7/kBS3+j3TKOLh9 Q741J+Ews30ZsuVjtydcu2XJMxRJ/ugvPUy++ziB65/WbO6+ikjxV5FTo7MEbyFP396xKSBwY3bfZ qJkd8rQA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgyjZ-0000000BG1K-0hCu; Thu, 22 Aug 2024 03:43:37 +0000 Received: from mail-psaapc01on20600.outbound.protection.outlook.com ([2a01:111:f400:feae::600] helo=APC01-PSA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgygz-0000000BF87-0IU2; Thu, 22 Aug 2024 03:40:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DacGC7QqnLr2EmFCeu4Q+3ZUzw4QlgI5nwzsAEZF/rPoG56lSEsof+s/u5nBJ0xt6cPjhRK258WSZ9hfP6xCdiKETwg5o5qSMAVi78ACpfzjhXCFkEPYLbgdy6oaQEpDdWwp6QyVmri5OId3W8Q/aRZ7BYHvr84THJwAwrD81Nv4YCJgC6aqoHu9U0QKymxcivj2mEYqdTfrjG70mX0SQwvmk+zls5fvegldluj/Yiln3rRA5/Rpnw77djiygzZrXOvPuSHXkr4DFZGqHcI+d9ABDZyWNvDh3GnqYDNMNG0mxO031FijoozmNW3W2WgK14sJTYRaFBbpHig7fDl53g== 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=kGVFJ6j7VvGl76/0BQtiLrQS1eP9sDog5mlt9fbvc4A=; b=NUzM50E2wYO520ItDqj5MOQ7Iz3DgKhZ8CGZox72dGMDBg1caONX4gmArjzk4IV8lNKnGDvQ4HKhUoKRJlh3hXXZ1uXXn/Rhl++OOOF1PEesBJsLTcQYNZ2dpC+w8HlnFSrLmMPNhKhrvy17iI0pmxmwTpdIX4M7Nz9b4hNzp8sPRKjWMg208WvTnwja9fGE+ST2cg3Wo96fJobo2eRBqU+PllkbLhBhYhR4ou8prkxE9kAFvIhM5vLRT5mpD+bpNE9M3XCbatUqTc8FXNEVa/Fs5Yc3zqHN/B4p+/ZO/1k8aawW1Q5BsCx/V51JuHh1GkDDTq7lzJkXWUBEWbb49w== 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=kGVFJ6j7VvGl76/0BQtiLrQS1eP9sDog5mlt9fbvc4A=; b=B/ZWYSg2NPOHlna/9LY07edUX5KBRvoYhNVt6IgV9FkYmgqZAx8FGpShreDiK1GzZxJN4E78Txow2hjuJe1wD6t9ox17IUuZHTl7NxAO7u0pIZXdYG/p2j6dLZRZEABk05JAztEJAAPx7qwXYmLXzQT3kYkPRwVXagESEb7eKwJ26H9hpL5oAvvAzs0wqsVvMvpohQd0ECAXmX4zwjTFqijT7+74PPcrLDRdiw7R/XWixL0ZL5DgX2BcxrnsEAJOCYa2UBcEC1hihaGeLSQcyW7jkFVRZlXt+Me03eSH3kWh1o5y1a7UuoU0kn4KonuXdivG5lC7Xq4hWuDfnEgXyA== 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 TYZPR06MB6565.apcprd06.prod.outlook.com (2603:1096:400:452::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Thu, 22 Aug 2024 03:40:49 +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:40:49 +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 , Andy Shevchenko , Andi Shyti , Florian Fainelli , Lei Liu , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , John Ogness , Thomas Gleixner , Jeff Johnson , Sebastian Andrzej Siewior , 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 4/8] tty: atmel_serial: Use devm_clk_get_enabled() helpers Date: Thu, 22 Aug 2024 11:39:08 +0800 Message-Id: <20240822033924.32397-5-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_|TYZPR06MB6565:EE_ X-MS-Office365-Filtering-Correlation-Id: b04d88e9-88cd-4564-98d5-08dcc25c368f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|52116014|7416014|376014|921020|38350700014; X-Microsoft-Antispam-Message-Info: x1IovNe46QwJN8FA62+4TkYtTq+TzZMm/y7VKfZolO5l9Jq9l/2ivX+TKs/5UsF3XkKnIGfANabSxdChbTTdfodiaROwO6jwujKvLToplkECT/L7FtxWgN0Z0kThfBmOIbRrEWIY0df52kD0hcCMz/FB821oL84cioiYHaVWd6yyojZgArUPWQ30IgYwLpR+A4hEI3unggIjRvZS+TbYBWB6qSQanlH7BrNSEgRhQQSVau+ZEpLsHRRBko9lYJ8eMjSKTY2ur8C7nQlycq9rW0TVWAU9PKQWYXZc5AkTLGhR0vM6jjtQK0EEcZXblAv+YanLk9MIrYRJ+Hry3RjLvTyMn8GkB1KDPtDGal112YuNhhm1Ueo8FtuMFuKJUMg1eJLaTEE3p9ElxtveQ4wb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Y:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PUZPR06MB5620.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(52116014)(7416014)(376014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: nkLN/DgxAImADRtAP4TAn6JKf/liJsbq5Z8IHmqZvs7cEsjnuxHsQuMEzx+G44ChA2JC9JsB4gng2MT0wqr2d+Hc9cSrNxyFeWoki77YxjyoQfeuwBRdvwlQGBPXDjhAtH3JLj+FLGagvnJNL/6ZLevSCjfKPHKXC2/sklwyBpUYq7w8rU1kxQYtwf7IojH6c6FX/UxMv5Wu+FITJBeXinGDGzAZkqcMuqhROcothNymO/KYGkR7I8OU+Ul5FudJ7AHoNrqccdkxHg0z/Kt3p71wWgPmvL15sFIHz1fvOcPGHKDbRLn8MZyUSGKUKA7fr9Wf6Ii3gdI9jhInC/3gInQeK+qmLgbwT/BWhVJB30UHb4SkbcWb1iqvavEyidCPVp+bwML6lLXXfMNjGicD/bFRYtRL2hU4FWRacqMAJ35U4yJk5v8FmN515pNGzN5R1wq9OJIflBxEk9Tx8NBopGqqjkBXlveP7qriOF0woR44tv4sffvuK45HIR9X8IZQxtQkqYdndqVuutBW7NFDoPdnERCxPXX4FSrB476dC/u7XzSvShoptrL4MU8KKWs1pMN/7o7RvQk46isfgx3Kw1yQXjyuQb6yaw1Zi8p+9OR32vwuF10+0wBw8/4oQb0kpPjXVl545GyzBw3Te+C1OIW5SoKUSzaXMghSDPE45pBpdnh3cM1Fy4bDAQJTiqA+2EyUxa2oeqhGSCBQqnXad0iHsZ67Uoz1BOXjyotG6dvFzvtgeBZ1rAxLkFvez9mHMA2pX/KyVyFqZhHX0pYXGa8k8hLDQ7GVJW2rVAFZrjzZiHeS7+tXvGS22mGDcx3FYxQZQzvJLHnApsJTqqT8CsrpT9SnMc+n/gDtna1lPHlkKvOd5HZsZ3JFcbUb5S+KjSrsslhdG8mCt+5EkBXYHumxIjnWgnjtJXsMBT9einDauinksgbnutBIQByJ8+FKa9V0EO1HwDkqgWGu8hdFBEDo1PVViPHW6ehww3eg6Iad6fSbIQpFibciSMzF4aJ4x9Us8nUjFKKyDthiItpq/aQMgbOIKNYRSugku5Lfhtj/NIbshYZ4UmuJvIWi52pwl1YLK/Fe16kG24e/CqewIO7c1wr/lSVhLuiZtglovl4F5e5Tji05KVBG7CDy6ndvOV5WjKiCeYNjzY9wYrGYNJL3UaHeMQp1gk9ZcwDhcrx9SqAjz/Wl34G9jBHUxWkD+mUqjwNfaKCVxci+oDT0QNItBvhdeOJvYYWtyA56g8hwZfJOI8vFVAThGD2yu/fr9bGd5rSDCwiHLHLT+keEBmfcfKqK+6ZV52+ctXdNVC4sGowlxEbEpW2Hln8uhF+ifo7gT3xbJUbMrotlFTvy3/xDkxQkVnK+gVpLTSF6iGoCnhBNkq3cxhWYEl6H9K25N71BSLuhyvzUtKtwFMz05P709XNsNM7pHbyFSTDNUEDBhaAc4H4doaBSmaIacoPc3s7vuY1iKVkgZbAh77zEUW/7N5VBxAKB+obZMRwaLAVvZXHDW7CJEBHB8+c7b0xP5N5Gg4WHCUXn0Qry0plRHjgY63PWdGwSrdUdCiEAIkbt5NmMBpLGfUwwBsc/qefa X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: b04d88e9-88cd-4564-98d5-08dcc25c368f 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:40:48.9815 (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: /5takiTZWaj+4/DJu7CulBPrkuIgM8b48Xma3xK5tUfy7kYEHobF8VlUcPdJtY/ArNZ/VcLaxOQHIOMV7m+/oQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6565 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240821_204057_143366_4435AFE2 X-CRM114-Status: GOOD ( 12.88 ) 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/atmel_serial.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c index 09b246c9e389..209f3d41a17c 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c @@ -2910,14 +2910,11 @@ static int atmel_serial_probe(struct platform_device *pdev) atomic_set(&atmel_port->tasklet_shutdown, 0); spin_lock_init(&atmel_port->lock_suspended); - atmel_port->clk = devm_clk_get(&pdev->dev, "usart"); + atmel_port->clk = devm_clk_get_enabled(&pdev->dev, "usart"); if (IS_ERR(atmel_port->clk)) { ret = PTR_ERR(atmel_port->clk); goto err; } - ret = clk_prepare_enable(atmel_port->clk); - if (ret) - goto err; atmel_port->gclk = devm_clk_get_optional(&pdev->dev, "gclk"); if (IS_ERR(atmel_port->gclk)) { @@ -2968,15 +2965,12 @@ static int atmel_serial_probe(struct platform_device *pdev) * The peripheral clock can now safely be disabled till the port * is used */ - clk_disable_unprepare(atmel_port->clk); - return 0; err_add_port: kfree(atmel_port->rx_ring.buf); atmel_port->rx_ring.buf = NULL; err_clk_disable_unprepare: - clk_disable_unprepare(atmel_port->clk); clear_bit(atmel_port->uart.line, atmel_ports_in_use); err: return ret; From patchwork Thu Aug 22 03:39:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lei Liu X-Patchwork-Id: 13772614 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 78FF7C52D7C for ; Thu, 22 Aug 2024 03:45:54 +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=TuVPlrCnGOACyppIwzEZUACeNu4uBImXg2pp/U8N9Us=; b=Oiy3SMccrleDb6RFnLDX4KZ84S b3c22jfZzHaRV4jwBgBxBbENlOEIzzhGCpQ+1q3La8ExVmhOUUS8pT6M124DGCuPc0s77xy/+cGXP 8FIFQ6xFwWLdwXmQGyBCn12jdNHiJ8fdK5kFPqIm+e2eC4/gh1XqMONGGEyrQEpUFKvApme+IZ4ef 4ubzzFb9u+tJX6+sie6EvaciCQdAISowqlmxXoQWV4mTvImddSJgD/d5/SJHb36/0VP4mpdf7T3C9 vVgoBAjts8dIL435r3cxiklXWkXMmxb1x/WHntPXHQiS7uHRuad4Lankw0mmbkrm5Vu/9hYlFUQUI mxjWOqzA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgylZ-0000000BGJK-39BY; Thu, 22 Aug 2024 03:45:41 +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 1sgyhM-0000000BFF7-0of9; Thu, 22 Aug 2024 03:41:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=v5Q2P/rH5AjYvsT2uqRL1ZOHOvP4IRr9uV/r1jLkIdAsFighwPyB/pgcMx8CiLs/ufAwr2AjOyG6ptMJo+y9WxDg2NmHEy1OUqp1e/lqB3ERVpxvQDbb2ja9texL2fVq90FFPhYKT141/HZd0RhrpbGIZdnTar2bV/guL1xXXgesg2kS6jCsiSeDX32CmEHxWSIbCJyp/akZ2G5eXD5n2NWno7/hbnJVBfGtyIiAAV/rKt+U3N7+2J4BnRFapix+jG6PBHWthgFnPuy1in5pS13xoEzPpCUCW5OOKIjotl3fYcOD6cs6KQEY/1uFtNs0e32xEaWCLEpdb9Hx71eMsw== 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=TuVPlrCnGOACyppIwzEZUACeNu4uBImXg2pp/U8N9Us=; b=OKRUm8nmHqBMGp3qNVCdzxy1NuZSNNn/dYbnzOdlyW+qQ2XZb71tDtR1Q0dA/qDFeAjVau5hyoS7ouc5GWBSTAtFqp3YGfa7cQh3xYdUbwO1j+K0r6B7i73qv+lZn8PwjKqQCDVrc/Au/Eutgi5s7B7VHhNMdereakmdAr8uZbd5dBAisq2clKuG58ivGu22gXuGj223oIm4QIqj8heWPia55krPwECbNbp0u1c+Frc/Auf6XxvlFUmzGJ0tZCeDeriag8KkU4xBa1StDbCV87dd+PjEEx9A/TtmG0hpIXFSCAgamSL0tSiQMC7+V9nsl6VxTbnSPApIJOqMlUcaTg== 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=TuVPlrCnGOACyppIwzEZUACeNu4uBImXg2pp/U8N9Us=; b=ZYXB6hUHbnG5p5k1oMotEq5EeUBrSmmk5fYyxMXDJ6oMRY67myJHWuHgAErsc65B/eVlcSy5Utn3z7iq++ZUzS8zdo1LaaUpouQB7zULAFMZ5haeoCHws5y8jBxnROu++9PuQC/8QsV5gEsO3KUsBl0QpbPEbs6hA6dQbo30SQRelm+lMN6aDQBkdWJ97u/jKaLa+MV4SuKceAaUCz6ukPJbMCHsuDNF57mW/pg6B6ho9yYK9mlJgnamvU8+0EH2mqckI1l1O2Ds+zMkXG08UOgeO2VxvK3IGaK0AZcaGQLqT5wHNYfMHqT8xkiujKPdZif/P38anF8rYd7YiCqNYw== 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:06 +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:06 +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 , Lei Liu , AngeloGioacchino Del Regno , Andy Shevchenko , Geert Uytterhoeven , =?utf-8?q?Uwe_Kleine-K=C3=B6n?= =?utf-8?q?ig?= , John Ogness , Thomas Gleixner , Sebastian Andrzej Siewior , Jeff Johnson , Valentin Caron , Lino Sanfilippo , Amelie Delaunay , 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 5/8] tty: mps2-uart: Use devm_clk_get_enabled() helpers Date: Thu, 22 Aug 2024 11:39:09 +0800 Message-Id: <20240822033924.32397-6-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: 552164c2-1af2-4950-022c-08dcc25c40a7 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: iIFecgyzDXSXkOV3e4eGwobLGy99JhYYzbKFEzUf8ftlludx7AEO6o1pz35u7BwV74oL9tdN3hgSOXjKVZ1BCeypbcPN81HqzX0TevPuEHgV4b0sz7T0xqx4YIy6ie8X1tTB3kRkNDdy3B91fDwdr85k6o+6b/xibprtGbt2PjSsGhXn81q3/Azeb63mAjMGzTbj93YP/DzvBGyj09xxZy0jGV46RuovdNqtWmCf8zgqmrcffolCoqIErErFdOXNl3xusVF7Jff/VAkr3ukzACxIfUE4AkN5SAbv3X7P87DMFpxxDfzo65oc6Tna+x5wnDlPlG9jPewCT7Bhx/9nuYqVLQBF8M+HVQt9W5HM2MMMdiR7WU1PIxGbLmMzdKWjovJL4P0klNSAE5j2GJWtogVLpNwwWQ/488rEARL9BMNHXOVCzO85siOsI0gGMFXvHjHTu6mwDPueiNdD3Y+jdCcEmfgPr0LlSpQWAMJneJIOD60jZdqW0oHKVkR1Kvd/rHJE7lDpyn7Mu+IuphZYOww7uesAWDTPpiMHmgZeBCgbs9WxShi4qCK/+GZZI3pKV6OqV3a+/JHXo3jfbni0QelTDUILb6KyGd1w+oZUJXW5idwMZ9jji8PDwLhDVmXsnEi4uLGmEFr7Xw9rC5rJr5ufdS1AYPrkWTqH72ozIbFXTzt1MjuVtRJHKON8iqTcVcaePXYTsTDWwu90+C33NX05sqLrUENCYIUrWEGrmnzWs6/4XJVsIzp7KBFUmIKFxv87pgQrS7yo9FZTaxkyqRJGIdFyPsIMu5T4z12EFTSfFqCiMH8FR0bWzEES6MYW3xAS8PV3X+jlseSWyv/nRhVRJ6c8KBFHkvRbVC38QQJHJ9ujwI0JCnU1apvJ/VZDWmWXUiCvvXC0MCvaqjNTLBQnI8G1p6B6+wkiixfzxPDq1XwR2I3DFwlJ3NIfw0eN7g5YOQ9ifU9MOgNxx+NFs0s3BE652vUcXjo6fmgJy1Sfpem3DW16ckZDWnzm3mFsNx8CwZHIbGlue5qU/3rX3Z0s5PmZn+0RkK/Fzpu+kDH/iI+KclaKJNUqZ6RolWCUVtD5gebYNJUHvhDSl79DEoMUE/KpPs4pfUbrU3fFi8YrXQh2oaTeV2qPRBq30kMPk/WCqYcSkgvMqH6C8r1oiNk5DvfPTxdBF8YQGps+P/4YVj/HWHt3P3+gY7ucPJztK2u9qFh8XWCQuIaxh0rBp7vzw3WJEoB+wjcK0uhigxBxVi//4a2J5p7p7A4pZuYCZ48TK88kY+dKjL5kQvDXO2LkWI2BRbbjL6vXUUSYZJoaLQG1Xk7+1JOK8cXzOEw/IUrf34WMLsq0Qbl+++La+bcOoSfLQ/lTcoV0tdjvQC+1YwVy9ROqaaNPbTVKSCLmytCBdd4jH+uBtIUXmPaUfwMZ2KJezHpq+edhCCjbztA= 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: MFcSmUPqHCNMQgcPH/Pe/aQ9LoQWdeXuX0v3t6e2AOPbUmkS6DlWr0yFMqZxW9ZEwQ4aUD/jrpw3lmiWx0AqvsAV7quuapuzb8to1ZZL0tu+iHtNgPsjBhZ8y1AfknXsULlJ6p1Na/gEIabf+8X0ls9rVB/fEf66XeoCSnA3gzfUypFSuOLHkGYnHwX3NM8RlGmeq+kvu+TGIPYKABpNr7czk3luCosxJ2uIdJGl10er5PLaVQuvWQHWUKi1ria/IwYQFKi2fvEN1rsmLZJviEWpFYVwuOjWvyGbRQza9uiiHTEZeoahfl7UvatM7t5O10AqTkPcVun3zvLajKDRA1OrL16ftWpJbD5+4qZHRr9OXNP4MrgR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Z3epxYV4Ro3Fgj1Cm2eNIP/gxamf/6SrltI+WdoxAKXtjre7OO/xoTqwvYNnQfFjMFV7R+JSYrhuRa8fK2Z8rrg5WPNSebli0P2xUCs5vMpt4RqACWslCPBrOX3TdAuUyIUiKbJWH1cZeTejHOswIKrq08JWgWMihf X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 552164c2-1af2-4950-022c-08dcc25c40a7 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:05.9052 (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: 7vZGft7/0eMr3U3Q5bwnfpeg0mQE/FyoMvLYB7c31Ixzmrv2/Fnr9r5D71LBZSV95IH5TUOTOBqrBbOUPe9yEQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB5892 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240821_204120_261100_13CA54E8 X-CRM114-Status: GOOD ( 11.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 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/mps2-uart.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/tty/serial/mps2-uart.c b/drivers/tty/serial/mps2-uart.c index 2a4c09f3a834..e582fd6c4632 100644 --- a/drivers/tty/serial/mps2-uart.c +++ b/drivers/tty/serial/mps2-uart.c @@ -550,19 +550,12 @@ static int mps2_init_port(struct platform_device *pdev, mps_port->port.ops = &mps2_uart_pops; mps_port->port.dev = &pdev->dev; - mps_port->clk = devm_clk_get(&pdev->dev, NULL); + mps_port->clk = devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(mps_port->clk)) return PTR_ERR(mps_port->clk); - ret = clk_prepare_enable(mps_port->clk); - if (ret) - return ret; - mps_port->port.uartclk = clk_get_rate(mps_port->clk); - clk_disable_unprepare(mps_port->clk); - - if (mps_port->flags & UART_PORT_COMBINED_IRQ) { mps_port->port.irq = platform_get_irq(pdev, 0); } else { From patchwork Thu Aug 22 03:39:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lei Liu X-Patchwork-Id: 13772615 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 E6E68C3DA4A for ; Thu, 22 Aug 2024 03:46:39 +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=4FduZwRbGFdsrTuhDrcO3YE1cb0Lmi2b0mP+4DyzV/g=; b=eONWcl/XTpp0zJv9STVamZ8Ca6 2MGROeXCgO0lCSwm6fzBf0yUTPagTJFKTmFSqXNnFc6HmfYOVpVUvPCdcjGOH7p6nh+3u67sEz0Nt /Un+wkDG8KyXhHXUlIcdE7fh5jiRlJN/Lxj5SIU6SuX02avMk6eicPq+6wb1LptNCPeg06eJECmS6 jGcFd1lkOuHX9Kj3aRpbN/1jmxT/A9edQuRhNb+1XkDpyNTVOFqB0adc+2f1fqccgFZf9BZrZeJO6 N4CwJetLLso6fuAr0PvTtcoH9jv/KFZ+wGuKxeLQIt2VnYn8Bu7tEahXadzFphTrZfuN9Jhn2yxvx k0+OFMaA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgymH-0000000BGYs-3oOi; Thu, 22 Aug 2024 03:46:25 +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 1sgyhV-0000000BFHb-0PTB; Thu, 22 Aug 2024 03:41:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ij9KEjG20TELXtoqSiCwL+6mQoih5ded4CZjX18UC6euAZ+LxPDE+ZzLT5T2UHau/czEUNc+v6lXlJm5H7OkR31so6be/FO1M+vx6TgoNMAFHgBDu/oXzXPF2roR7Ng+K1nhi4p08ZaLlziAzOi8VLmRtu1/+XZ87vfqh+1pr2Z8X3cU8/Izq9pgYAT6PFZ9Uz4XGhL6ZqOwhFEva1w5m0KC3Cev4a47Zb80UJsNcK2ykrm1d1v1JlBDIvjp/0oNHAfY5le1KbXL9mUg4BA+e1x43rCpaBHGSb5E/DWjQ99EgBR7uX8x1wwAQOTDH9REaU+hZrReUIxcFTZC5fPX5w== 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=4FduZwRbGFdsrTuhDrcO3YE1cb0Lmi2b0mP+4DyzV/g=; b=qgtM3ZjSMEeB+WsHFPu8PsfLTleAOAXNGPajd/153/Bzy/WZ/+aSarCdVTuJ9CwkYmIPArNP/HutnJUv6algthOkinZyAEuN5gsFpzfh35peVfdJzEf1tB74WAlS6NWeNpUQUFfDT54Kv+JT68d+g3jDx8Sibx8NIq37knbVL31dIHKmGYYFgXFU4HXF0EOsVfxPYJDu8b/XslfLJMmXOS+dKNMWf9Em8Q6xOcjUk5hJRKZCzhhEPSytn6pTRG7Frui67mJMuXwZ9D06P+SO1abnRcb23HPg49brzxb/hkd39CtGjbiq+qdMroZ07Wluu6WsCs+UDt778ToxEH0B0Q== 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=4FduZwRbGFdsrTuhDrcO3YE1cb0Lmi2b0mP+4DyzV/g=; b=UMFiVX+xSOeWBtiLz0U4o44M2C0e6IVTBnL0GyuJbhWWge8s6O/UBH3N3n3uHLSYvEp/REJUdVHhc14V8aqKMPCsdkFajN9wMm0DrQC9pGQL2ATWWNM7ddhMeXWJOQZiLNsNZ65ytNfyi/me10gLlxNOB3fjXVgUsHflf03eregnfe7/rkSVZbn2lXlGhCHvANmJEw0Z40JWkCdTBFI3OG+Hgj2FEDbQ+Rnmvjg20ntrbgL9bMBHz5OiNRy/0nhegjLWKBbDbZpYFekf8biBWi/ZUZ5O/3wrcoX5LMLodiLKBpi8csh50oMIyszH46o70SCdnoDMIYUHoxguP8h3pQ== 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:23 +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:23 +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 , Andi Shyti , Andy Shevchenko , Florian Fainelli , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , Lei Liu , John Ogness , Thomas Gleixner , Jeff Johnson , Sebastian Andrzej Siewior , Valentin Caron , Lino Sanfilippo , Amelie Delaunay , 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 6/8] tty: owl-uart: Use devm_clk_get_enabled() helpers Date: Thu, 22 Aug 2024 11:39:10 +0800 Message-Id: <20240822033924.32397-7-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: 8bd5340a-ba8d-4bef-1ec9-08dcc25c4acc 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: zVXKE4wSpkg7KMtKhuscWZkc5yCUeW2IV12GPgJ5i7sGuf8uJ7cfZVNIEJs1itdHdJCB5sYpIZYPg2hRqJuktlu711CwVwry788DSWFirBbOwMs401QTa9MsUCRqdQnjEj8OFXBonVG7QUE4t7P5MKmLOFEGSp2gAFeLk+b4pNIaz6ztrIKi5CpAXrxizwNPQVMlQa9937uO0PIvZE0ygUGLXmG6rCFUIu+9afDS2UACMh4jVcbxBPetx9kzoI1Z3Dy3lcnpK/IobPcMgR2esW60fnUbAu0jaVN3zS5uSUsDue6WbdlqtZEO6BT54dkdqr5k0n8vRcM4gopNPoiaucg7eSYpTD2NWLpzBPOlc+WeExFi+AlFCv6SIJZCQY1w3BzrL/EE5JEtOTBXkqFcIomvFWprEp6/dxiarryzNivbIYECiHPedXcymEkEnSVHh7obbxmN5aeTkp+El3KHsASGKkd6wnnNpIpzspwOg4Q2+TYf5k/piPKSxa9un+q0+sOd8ZHK4M8RoxecCg2BlVbtIxfK11ceEKgvT2BtN4wmOyR7QX6moqwvNDYzse8uB4OJeCf78CfA4R3y5fOjZI+rEnCPpDxhL3VKpCelrnK3b1q1I3AtumcMYNDPJzPyUK9i9Tq8c3ovVBlf6KBya8Z/qz1lebBgUIlTvJkzuG1YppLJXmt179UNC9b3k//xsd/NjwdHoF4x0K5ClM1ZoyuIS4b8irdKNMEibKDdRv+81K8il28RhZZbDHXIuV3CRZo/E2F3RmtGHlla/0I9BKdbJQNULl45zDKliLgiSxEFRUuF6qvLhhNEX/jD5shPlL8+w1zUPULgMtq9k6IAxQY98l7Ox0CYjx1WOcWl0FrfB9BZeNLdOZG8Ena9qSwGTW+bno/v23iDFJjjoBO6UIgizLV4zOlZUknj/gkKfip6uEdYK+/Da2C7pFU3hKvSkOR27tgCz2g+AhS5tsK7y2ud3cwDgHDNnRnKMA5mZFRKyneYH3513PjTrgGT3COR2N17NVkPaQVGeFE3mqsE4B+Tzahy4zzkLnCnCJ9DlRhulyWRGXjSvSBJj6v6JCGLSnjCU/CWINjtb15WVIAOZJ9BrbWWg60c4IHiQbq7ZUNwwMT0lmUIuvSsnGG5WfUeKvcMQMyVBvq/QQh40QJaCf6nYeBOaeBy1FiOmlVQuePHWGC0KLDBIdWUD/gpPFaCmDe7ly0Lsas8oIvnJyO8U0lruC/+cEhyFNMZzuqcsKXRrcCkp/pFd8hQfwAKmvBM83+PgNDRi7AIQQnQj03nbW21hxff6Ks5EnIPYK8QszuWwL4+k9XlyMZSqNeo5p/xgIdnl6koNzUalmaNvKex1yrEvUcUjbUb7cdl4yZYASd3fm+VCO/RKwL8Vakx3+TVhT5RzGI+Do+CU7hO/EmUWSFZj5xGkkEdeKzicQB+1ak= 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: +O0YOgWRN+2rIR5ezJpVmLFPLHTlmNMnJMGAkq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EHy4B8n9/iuhacHsCx/uYG3tsplq0fvIIdo/LGh8FOH566g1NVDvW7vfoHUbzd/uUI20LAxs5akLmDoXnxegDYGu7YdKvuoRMnoD7ZlFHBonzfT08NuGShWwJRBA0zS8wUYq+X2FgHaHCLeU71PIomJCh1xIQNq+cy056Is5Q2Y4JIIcGOgmwE5PNtyHCWnEh2BcY3Gxleexm6uf3/OHqgLFNNDcom2PD0XUpNBy/5ReEDey3tPw0mKveiwcrZ7Nu+sW9WMIcO6Fpk8V+y6HYXqwVerC/NiFMbgo2uHbbwQbvwHQ/1pIYdYVCKVM3sTiYqrQ+tYmjFQVHsFrlwVTyuEOSAf3nH8z/Wsbae1wK89UqjlQ+VGLGGZL8hA/MmbI0DXVdjVpk2N7wE0w7HJQW8Qi0SO4V9ieFDeuzkPP8vSNujNw0mcxuw+8dq2thUUQT978VQvTmDpqnRctx/J80K9850m7eWpU X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8bd5340a-ba8d-4bef-1ec9-08dcc25c4acc 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:22.9359 (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: lvxgUFeiHHfbtkN+XtafHuzf6clAsbFjLunFRLJtyy+T4yjQcPKJKgSNY9AB7yJZoBvX8wRsbzQGOGy4U3MMZQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB5892 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240821_204129_168159_45840B22 X-CRM114-Status: GOOD ( 13.95 ) 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/owl-uart.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/tty/serial/owl-uart.c b/drivers/tty/serial/owl-uart.c index ecec483d4d59..28c33cea6b41 100644 --- a/drivers/tty/serial/owl-uart.c +++ b/drivers/tty/serial/owl-uart.c @@ -680,18 +680,12 @@ static int owl_uart_probe(struct platform_device *pdev) if (!owl_port) return -ENOMEM; - owl_port->clk = devm_clk_get(&pdev->dev, NULL); + owl_port->clk = devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(owl_port->clk)) { dev_err(&pdev->dev, "could not get clk\n"); return PTR_ERR(owl_port->clk); } - ret = clk_prepare_enable(owl_port->clk); - if (ret) { - dev_err(&pdev->dev, "could not enable clk\n"); - return ret; - } - owl_port->port.dev = &pdev->dev; owl_port->port.line = pdev->id; owl_port->port.type = PORT_OWL; @@ -701,7 +695,6 @@ static int owl_uart_probe(struct platform_device *pdev) owl_port->port.uartclk = clk_get_rate(owl_port->clk); if (owl_port->port.uartclk == 0) { dev_err(&pdev->dev, "clock rate is zero\n"); - clk_disable_unprepare(owl_port->clk); return -EINVAL; } owl_port->port.flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP | UPF_LOW_LATENCY; @@ -725,7 +718,6 @@ static void owl_uart_remove(struct platform_device *pdev) uart_remove_one_port(&owl_uart_driver, &owl_port->port); owl_uart_ports[pdev->id] = NULL; - clk_disable_unprepare(owl_port->clk); } static struct platform_driver owl_uart_platform_driver = { 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+MCzHjF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FrwSHMYqeasanlfFcSWsq24q67W4GCKXnk4H0QIn91s16sbUUUQknG5rcTj0kKixcslQ3jBXw0c4x12a7jUbjUbnOkWQDLaBjXS+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/E29xfFToiJOVebBpLMi18N8K4EhG91V06o2u5XneCHiimPiohj7LqHWf2ICN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qQZ390ixGIJCqp 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)) { From patchwork Thu Aug 22 03:39:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lei Liu X-Patchwork-Id: 13772613 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 13B85C3DA4A for ; Thu, 22 Aug 2024 03:45:14 +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=gCneuIT6Rq2rxHSyitUkMuaEIU4QSMLzF/kfR0v556c=; b=DKkwcZQ2szAvGApFKORD87s2Zd xd1Hi1Cdal3QZjdRnGch+U9Mi5Q+/Ywq/ETvo6RfxZXoL5vLsU1Y34ya0aLcwdldqTfo5/FLNAxNP ePrq++qXxlP5JxxrYYqNvxZbTUUYaziuRWF2lh26wHvuGEmjEbYlsUdhwxF1gboQLuBX3U1j+oBEa LoES2gbMOHFIOQlacy4i2EXwTb38QChFDSWnhCsMKQOor5Cbs7grSN4cJN11oHWYbkexV0pClmmuV 7JM/xVVzISiWg3qJNfc6BNdbA7MJi/7KPd/V8wxAX0EjyZHdSpgJQwfxYcshCDJspIQiLZ5KtAnv1 Yyu7d98A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgykt-0000000BGCi-0ruT; Thu, 22 Aug 2024 03:44:59 +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 1sgyi0-0000000BFRl-2di2; Thu, 22 Aug 2024 03:42:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=r9mWNQkmUI0LVbteOZ9plxey1ngUcmWyDa6Sj+jWPYUNncK6I4K772S0P9Hh6qwR0fTbkyBAJzJtbMa/RPAfIiR3Vr953f9me3tZQ3X1BO0zDDSqdy0atzt5HQMco8cds95gnENCoyRHni+Jm9kCa2bTyj/xYI7Sq8gFXzN77ikWWVzYWIaGJonCzALzaQeJyKsT8c4YfimdXfwD6+tlouDVD2Z2I6kFcpsfP3+K7ik0WoRVX4kTBcZQnO0JljUzLJ1Abl/tlHxUKIyFlyeCLrrbN2mxzD2I9K7emn7c9XAAkDLi84PzxlIGNUp2JeB4nmj0Bhrz88R3ricsF6c02Q== 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=gCneuIT6Rq2rxHSyitUkMuaEIU4QSMLzF/kfR0v556c=; b=j6L6OOslpsMYq6SDyqdag2JD21tyjF8VhaophQzTbNa4dLh3rwZyKI0vIQqZ78eNy9hYoZYxGaRbZqn170XtYMtbk1zE0wc7JHQTlNSvVE7hUJnmaI6s1n6ifgmmeviyJD6TA0erPigNGxWN1SxWM8yrUvZ2GH0fTTVSM2rpdUPKl5VJ7cgOn/N+Q+XoocmDG8BjgupJwjTZmsY/7WhgW0kvO5XryHEA4fQ90zl8wfZyZ4p/zdUVGF2RgHzQ7Uuyd+YgV9ipXeX+Zn3e0qhfxDK5FEhM3zE8jVDBn2b2Ef9zvJwZH+IShEBZmcSrcxFFzfN26avXDxOnNocwgBSAOg== 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=gCneuIT6Rq2rxHSyitUkMuaEIU4QSMLzF/kfR0v556c=; b=cLHV8t2EcDVR0YedssRXWAe7FaRtm/q+IlywdojjJtgdPxRhuTpSymmJeJCd6ivIczubYBG7W5+/fI+QmZM4q03JC3k+WeQbQh6a/qtQiWvpYnSb7U+pspMgld3ZS9dWDfLcILVZs7jk/0AZneHC6H3z3hSQQl+av9oOx+9twxiVF10lw6UFypah/77YBIKOyGQMs3tvg1rFRxGYWvpbBpvkFRngC8EnwN22g8Oh4uxcfnezax9oPnPMXHcGgUPzWQ48paxwqWkqJit3lRlH5qoF/nO635MunI4sylqwFPlb9loNXk7mPHe1Wa8mI2HeEhlCPJZZ9UIqbk11jdeLaA== 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:57 +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:57 +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 , Lei Liu , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Andi Shyti , Geert Uytterhoeven , Andy Shevchenko , Thomas Gleixner , John Ogness , Jeff Johnson , Sebastian Andrzej Siewior , Valentin Caron , Lino Sanfilippo , Amelie Delaunay , 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 8/8] tty: stm32-usart: Use devm_clk_get_enabled() helpers Date: Thu, 22 Aug 2024 11:39:12 +0800 Message-Id: <20240822033924.32397-9-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: 700f359a-aafb-4e5f-3b73-08dcc25c5f50 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: rzUc3M9XlvkWLMPt27YHNaosZznXUxIf4mfY9wcgda4Xy4NhC04Wb3eQhDSE43mzBQxMewUGYGJIJKN8ChG/qLbwRHpeZyujlbYXvAMaj72mW7QFHE7KEEB7rkuyK2PfwUT2QhDxrgD6B2hJeZKAW0u6of+cVxw+Wu2vYYWm3MLjDhPQQGGR6GNPP6K0bIQYSUC1mqW+aHpkSGVkomNK8KfsyInnNVig735n6HfaZXd5SjtkyPSC4IFYbJaFB5kcM4TvNGmirKHYp6xgY6cBYHNj3XXNPH+kFHxBqBjny6LoPFAbGe1bNE++PPtczEDHeaTqWgyCka1aXGMxsd3AG+ZpVZR7zswlSWlVxnvMF9tNu68SVaCbYnk791mgGSdCPxseiLy9VYyKFuI383O4HGHtqLa9pE/gL2He0h1NGxSorTpx96Qf/dhsMi92cTukzjTyEDKI2dwc5+WdNkOaDqc8Ec5ZYYQLDgiU06ZcGOdx2Mju8Nxqch0lLAzWkC3WIQWyR4TXFychUCN5A7glNmBTZLpkwdg6fnG1yDwDMokVmWMUWI52B8Ftd1GZrNl6yYDUsOhwVNvD+Q4/97SUEs9lBAqzccYb6HsrnGke8JiZT5MwG7CExGqI1GLoXDU2bNKe6Xn+OVW+0IIqdQ1myc54vBr4d7/KINtKakvtenN32OY6VTy/DLsErnbeMs19IWuXzZlb7QVcrUTiiJpfVUc0n3hMua/GUDPvXJyjuuDfznyAPG1XJmk6y6xrMfTcsGPOtAWvZ21YtFzVCSeh6l2h/KGcWok02uf98nnXN4g8aSOW+ti6ogpo4zQrV6AL6s8/Ag2OfXNOnC6aalAHOVu0gNutgJVZDCvqIrEncT1VT++yxsfqd1BVzoJYuPugvBdg/ulaHbOR/TRHMQCtsWirdIShX+TICVnP9aAP5zCrm5C9/wjHBzu4kkN/6SD2PIacb5L/o67VlOihNy71SDfnfCUZGFHbEl2MPgjb205ccgHpQ+sbXFw6kM2702nAOqbZKqomxaG9Wk2d1kf3F9U5D44KnMiFvT/mSwGuzaaHEjP4e3THIkT8W1ttfNV8EKSdzvbDGrb730bMZS9lYvivXq3L/Esft2uC1O4/i8aIzILlOUxI3HDf7Q4EFs+o8gPi3T5p6nW30y1aafgWk+f3lbi+0hju2EbLaSkmUVZjlgClg8dypPebHTCXgI8NUV8GeZWc8lIRJwcCZuFA4NDwZqjsNtheNDeMvmSy3l+zE8le4rR8NEvyGZ6jq5XT4yI7mtdWbYv3qA8Ad5m4V4wFzlT87udDR4csqgQThg+xdeM1Tm9Xyk4G7TWxgNTPlI0D+LKXS8/s+fFjMprlQB4wCuHfXsxZEtONIB2RW+twVsVPBc+OAJBEhR9CAo8rcEc5biFkGXK/P9bderKanwkK+ToVePslyhECKced3ZY= 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: yE+y/D5FQBq31sbVrqbrxZlDIWE9mOgmH8X683ABTMRrcvMAcecqW7LQDHGR8nzoIu5puPB9BQP8XAPLqlTSqbu4Od7IsmBUTIGef6+kMGsNzTTcNkmkjJ4xGqWlIk8HAtnA6npRlmn2mpxLgDAFf8RJKKowy4om+F0FEE5JSDnupBvNNoJiv/N1XrsuYUKZkDgWBhtqF9hL9xXhsvMTiqpGrIWBm1P8HQBno9fpHBm2v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AVucOQ7O11ra9cpU8Fw+vq+O5SYLWEkS2JQbmk8aBRuXt09V3krvdKlxxDBKSkD3YuZkTBDt0jp1sJafWkBURPKq2+O2fsa/ZQJ2wajUxmT/JXM9NxlNeWQuYXIoo8oYzi2sMgPnFlqTj6ZEyQNECs+9r3w8DxyOOxPChMVlvQxTba/Dcoa4Bn4LvB8BWhgfzVxUQjzODZDPDT1Y6Csk4xj6uIG+WCXj7Buy9F7wpv+t8KZ2yGIcZmnUoGxbdIsSpT1v223gabJD X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 700f359a-aafb-4e5f-3b73-08dcc25c5f50 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:57.3446 (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: ruINW/oRR7brO+2/d3lL4uKUES2hNu1ENIn8SyXLK7rmqqY3Pd3KlnyN98vJsE4Jql33OreXv/bYREIYEzbRQg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB5892 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240821_204201_137759_7BB342C2 X-CRM114-Status: GOOD ( 12.99 ) 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/stm32-usart.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c index e1e7bc04c579..9bce3159165a 100644 --- a/drivers/tty/serial/stm32-usart.c +++ b/drivers/tty/serial/stm32-usart.c @@ -1550,11 +1550,6 @@ static int stm32_usart_get_ftcfg(struct platform_device *pdev, struct stm32_port return fifo_size; } -static void stm32_usart_deinit_port(struct stm32_port *stm32port) -{ - clk_disable_unprepare(stm32port->clk); -} - static const struct serial_rs485 stm32_rs485_supported = { .flags = SER_RS485_ENABLED | SER_RS485_RTS_ON_SEND | SER_RS485_RTS_AFTER_SEND | SER_RS485_RX_DURING_TX, @@ -1599,15 +1594,10 @@ static int stm32_usart_init_port(struct stm32_port *stm32port, spin_lock_init(&port->lock); - stm32port->clk = devm_clk_get(&pdev->dev, NULL); + stm32port->clk = devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(stm32port->clk)) return PTR_ERR(stm32port->clk); - /* Ensure that clk rate is correct by enabling the clk */ - ret = clk_prepare_enable(stm32port->clk); - if (ret) - return ret; - stm32port->port.uartclk = clk_get_rate(stm32port->clk); if (!stm32port->port.uartclk) { ret = -EINVAL; @@ -1645,7 +1635,6 @@ static int stm32_usart_init_port(struct stm32_port *stm32port, return ret; err_clk: - clk_disable_unprepare(stm32port->clk); return ret; } @@ -1853,8 +1842,6 @@ static int stm32_usart_serial_probe(struct platform_device *pdev) if (stm32port->wakeup_src) device_set_wakeup_capable(&pdev->dev, false); - stm32_usart_deinit_port(stm32port); - err_dma_tx: if (stm32port->tx_ch) dma_release_channel(stm32port->tx_ch); @@ -1904,7 +1891,6 @@ static void stm32_usart_serial_remove(struct platform_device *pdev) device_init_wakeup(&pdev->dev, false); } - stm32_usart_deinit_port(stm32_port); } static void __maybe_unused stm32_usart_console_putchar(struct uart_port *port, unsigned char ch)