From patchwork Tue Aug 20 12:34:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rong Qianfeng X-Patchwork-Id: 13770076 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 D2230C531DC for ; Tue, 20 Aug 2024 12:37:09 +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: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:In-Reply-To:References:List-Owner; bh=p1QoCnJp5CI97oSdNLoMGPxC/GIgRAcgi/5ggtL1yvc=; b=uQ2CPaYgJeRrnDOUFsF4bfjjrQ 5HR01S/idjC5JFuujdVPYrDC6FmPbbQQaNs6etjnRHcrkS7/esOlExDvJmmxaYsqVSy+mfYKkOooT PDIp+bHoQpNBgnle+LVtpIayvOxXBTImMmL4ke7cQbG/VLtmUC6a0n3utLXxgze6OXq2sCwvk14fD xtb4XDPXy82ShknvK7paghbnaLEUKR7sUOe5KmaOC8hAsowe0Wzl/5FiZiebkhF1eJp+TV0dk0XI9 Tc5P9wQwsQNV1LySrCiWQ3NcKE7satQO5Rq9QspPwvbCbOs0tg0FjKCyMQVj7F9NaBXdVTltsXhLd aiKTS1MA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgO6e-00000005E72-0BMb; Tue, 20 Aug 2024 12:37:00 +0000 Received: from mail-tyzapc01on20613.outbound.protection.outlook.com ([2a01:111:f403:2011::613] helo=APC01-TYZ-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgO4a-00000005DcT-2tuW; Tue, 20 Aug 2024 12:34:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=g+s0JSjk89eOlV2gUAwiOqcjEsUXWCDcSCvgfQOngDV0gOexBxMiuKj0yaLvurtNIZRRFoWwjMGG3o6i2S0gQF6DbysFAGSsTwC5DIcKXOxnH0xHZn/OWNlUHI2dkq4FUPeJB+kEtuNEUKSgO6fFhwbhRvdAiNuMXJbJPOS1jnqJO89o/JhHjKFfqHpgDyHhxrKCnhNzKkrihckSvim2TJdJyfJtG8gGmXWPh5dcBAMt9xYGCOH5cNnCdvGdi4tzQ9a8a1ywoupOlq12R4TQc+FQVnF+w7ve/ayMLcH15rQT5wJ+MgiM8q1i2xiiTXkcjCjcwa+B8cSBHHSU9qyDmg== 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=p1QoCnJp5CI97oSdNLoMGPxC/GIgRAcgi/5ggtL1yvc=; b=EHrdk6u3w6FRYAlK8K9bNozPxohY6WO6bvZOL+UNZqNPJego13en893+yNxwj72Hbic83NyfOB+aqkSFGqBXhyOOalyF94lAoWUNv3LuD8o5OpvvMibOb/WCLLXSLbJN+bKUqu3RF4EVAIVEjHyWkP84jUgg5VXaJn/LgtjHoUXDwecuMYscA1Zx2W4gnx1bIRX4QSEGSVp1aXWCCrfrliE6vRI0KZBbwH4D08B8f9OIYB6jBo9poQfTAkw9qa7rhWEv3YOmrhqYdDWld8vYI3JDvTYR/gkxsQw1jP1ZdykeX5d8Rg6RyrXw8jbEcFA8s8APSPuPHxZD5oOh3r/XYg== 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=p1QoCnJp5CI97oSdNLoMGPxC/GIgRAcgi/5ggtL1yvc=; b=mk15cGLnbSg9WayGcWpSDslVy9lRUu3ukmTKFIyOiEaNJmPwYkHCQi2rnEoq8I20LU72GuQeAY/onR9zI9TfS8NFXbbf3MQPY+dkad69MbBcb0kIPzJKqhcYvlsxIS7pkcnOEp/sSVps4pKn/RH5VRH0uAUHx0EsRnR9fB5fzMfY2Sb0rla5SBjTURdV1wygsfQQ4u5iBCyhS5rdlP3AQfD161InU6v5cWLuJHhm4ljnDhSUrNAfHSkqwIX6bi5HcseRkH6DasS4cPBBUb9z7v9FKE4QoqyFq6oOtVQUu0gRD+hGUctrNlQkARI0K6mGxHgrfDhXIdu5CX1sCP1eag== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SI2PR06MB5140.apcprd06.prod.outlook.com (2603:1096:4:1af::9) by TY0PR06MB5730.apcprd06.prod.outlook.com (2603:1096:400:272::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Tue, 20 Aug 2024 12:34:38 +0000 Received: from SI2PR06MB5140.apcprd06.prod.outlook.com ([fe80::468a:88be:bec:666]) by SI2PR06MB5140.apcprd06.prod.outlook.com ([fe80::468a:88be:bec:666%6]) with mapi id 15.20.7875.019; Tue, 20 Aug 2024 12:34:38 +0000 From: Rong Qianfeng To: Yong Wu , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: opensource.kernel@vivo.com, Rong Qianfeng Subject: [PATCH] memory: mtk-smi: Simplify using devm_clk_get_enabled() Date: Tue, 20 Aug 2024 20:34:26 +0800 Message-Id: <20240820123426.48694-1-rongqianfeng@vivo.com> X-Mailer: git-send-email 2.39.0 X-ClientProxiedBy: TYCP301CA0088.JPNP301.PROD.OUTLOOK.COM (2603:1096:405:7b::16) To SI2PR06MB5140.apcprd06.prod.outlook.com (2603:1096:4:1af::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SI2PR06MB5140:EE_|TY0PR06MB5730:EE_ X-MS-Office365-Filtering-Correlation-Id: 659e90cf-65e2-4ad7-df28-08dcc11474c9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|52116014|366016|38350700014; X-Microsoft-Antispam-Message-Info: dxtU2950kklcuY+5j0TZvNJKM/ujxpH4ePpxWTnr/p3dIqtSwHbs3/lkG+uY3WnTgaoGsXQizijoeZBlGYV356uLeGDC/8Lu/LCmbPCdyhu1LxLg1wN7ZCYHjQDD5XkHJvf3ddzAvoO+hiydNWvbTKTOk9fPeIPXE6MOGCKss7eDzlvqwnTSCtS+zHEv2k1mryUgmrixV+DkSBltVj79q6YUJoSvVwAttJV5pIQ6DSd1rIf45ZYogtLqsU4WEAVIgbGr5/1VY2P6c9W951FsjQmrKmdjKFO6MNrlmaMiKLK9lOuHAI+81whrUa28SWA+7LiQHP+HFFcLelWJQY6mPFTCKBLNDlTyrplMHmAanrUGyuNqjDO0kEfFHRisnp2k0rp4iaAYegSG1VlBiKxJDo30ns8AigddY1BchKwCpxiHJy/avHT1cKfiXxun61xC6aclhUkpsctfJ1mF7Fdn1b58wybaTCWsdTVNYJpPBJeSn3ANQVvy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CaVrlZ2RnNsKIONY2jCO+1ktCfkJNgUUXUbiLEoWwUVMgC1aCZzBnAxgaJVd4/xeI/WXLD0yb5ZvEVXKNXMoUjnjg2AKJxtgt7cZExJukAaIvNAWGCoiNEtWbLTEOL5HXV6CX/zbB6/8NF67w6JLwspRwS6eWz0MpFyz2wFBg5FHd7Rsrr2VkReCFb59Yq9SCR3TuoXRrw7TmT5YOfzpy7TsSE+VVdEA3BACPcn3enRe2aU7PBlL6zt+yJF9g1D3EprjyAUBfOJDd/S6jYAHJsoV0iM7lbEyJQgIwwtfmQ8+weRj+BL1R4qOLtkih/RwB7o5zl3wqWmNwYbeftsHI12DnSyr6EAPCYPZpnclPJ50U/e5NPjHmz5Yoj//qZ5iTG245MWzJd+5koEphNXTycgf5pdLKZWpmyMp5Kh6xCrFUoxG4wsvvu5TVSFgnEEqonNOB2CfgzhHXT7nKF0k274Rk1dbilx0zxwFZOJ/1Bue6DNHU0KP1afNmtmp09eGx32dIsYsox0kAfVLnmISIl6AHD6WrzwqzcwPrSEwfPlVU3/4ifL9xA7A859NgWJ/4gPOvZ/f1mP3eD/c1GaD3nUsE6gV1ZAwqT0UQgpyeO/K X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 659e90cf-65e2-4ad7-df28-08dcc11474c9 X-MS-Exchange-CrossTenant-AuthSource: SI2PR06MB5140.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Aug 2024 12:34:38.4633 (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: PJdyhNUx+bG5Voz6EGblt/YAGKTTAqrZ0QMVLJjk1Ere4Njcffb4kr4B+Nyx92kQ/MnT9Y+SL0FYaUSZ89nrvA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY0PR06MB5730 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240820_053452_766321_A5802DF9 X-CRM114-Status: UNSURE ( 9.30 ) X-CRM114-Notice: Please train this message. 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 devm_clk_get_enabled() will call devm_clk_get() + clk_prepare_enable() and the clock will automatically be disabled, unprepared and freed when the device is unbound from the bus. So simplify mtk_smi_common_probe() accordingly. Signed-off-by: Rong Qianfeng --- drivers/memory/mtk-smi.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c index fbe52ecc0eca..2bc034dff691 100644 --- a/drivers/memory/mtk-smi.c +++ b/drivers/memory/mtk-smi.c @@ -771,13 +771,9 @@ static int mtk_smi_common_probe(struct platform_device *pdev) if (IS_ERR(common->smi_ao_base)) return PTR_ERR(common->smi_ao_base); - common->clk_async = devm_clk_get(dev, "async"); + common->clk_async = devm_clk_get_enabled(dev, "async"); if (IS_ERR(common->clk_async)) return PTR_ERR(common->clk_async); - - ret = clk_prepare_enable(common->clk_async); - if (ret) - return ret; } else { common->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(common->base))