From patchwork Wed Aug 21 03:25:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rong Qianfeng X-Patchwork-Id: 13770755 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 CEA17C3DA4A for ; Wed, 21 Aug 2024 03:26:24 +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=CvzD31dw3AB/vn89/L7KWDNEv58BtWPz9s7g3AZ20ho=; b=HtEflLV2GTDoZvz0h6Znp7Fv/c N1udjUGhSnwb/eWzvnZzTSgqeLss1zp+A7kBbe2J1zBv5W+cRNtCnIYG3jpM9OmfSKfUbvLcoirSM zLokvp/AgGWm1EUEed4AiQZU+Z08Qqzwv42Ze4YPsSOkG2Qs9FCvtFXwRfOdTQ6piFPE8UVqBjeix zx7bDRA5uuiLd3/B5R4mXuhNVuPqa6kAUQzgbic6ncorl/4v22zOg6gnZ6GlVl4EvycDcvOLmQwth P05uX7yKDc7Alh/mRpCwNn5oy7Vg2ADkIVXNabllR3ifJBbcA1rTRoZ0Ofx6+eettYNzyC/v7ao1Y 3MOY7hCQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgbzK-00000007O2z-3BDn; Wed, 21 Aug 2024 03:26:22 +0000 Received: from mail-sgaapc01on2062f.outbound.protection.outlook.com ([2a01:111:f400:feab::62f] helo=APC01-SG2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgbzH-00000007O1d-19qU; Wed, 21 Aug 2024 03:26:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=gWKDWWhspHlXIO/kwnPJNghpd5vyYZtRMjb4Tkid1Pj/o6FudwcZ3+cLnPlcJlO42bgylgYM+XHoSBnhLtRIyud60Q4TLZP7AUVzR1NVkkL7N6rouUP0ec9C0PSLwEhpl8W10Vx8cc6KDwJ9za3sArs9+OHkTKTf62OS5tmB5Cb3KvNfy1y3IJtavX0VcfJKX/JIfbFcuIrB+T4DzMizSkwl0JZbsEOQVtSaYndH9Y0JFkaaNBYr4lvxPH5G8iaku/L41oErK4n94ot6GTyo/jssbse97TT8oiw5/M/05RzEYeWjfdlMT1Ri0vVmHQtp8nG8Hk/sBNgkevhcyeB+8A== 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=CvzD31dw3AB/vn89/L7KWDNEv58BtWPz9s7g3AZ20ho=; b=fL2JkyORoYXEQObTcjroftO5KwKX2nK9dFj7UcBE96TI2kEWL+T4MM4SPxHp9YeqfyUa5JwpfYqoggxweSKVZznygxoQ43tYKNuKsgPNcb5htr21eG56gqfCEMeT4HWqRef2EWHLRBABGttq5/NY96nZ3R2rsLVmWJX29BuFFUMP2q8xhJygL/6bCSSLy7TwklzcDo2UCZxGQYQOk4MntBZgWyRxc+nbIlsDazXndFlbWknetSJ4DzM8uBBSshz8mYC0AIx3aeEUcHO7qgfrTKAdgH/eMxKq/r3BOQe31c5og8uqAVRR2EE5L34u01nHpXZS7Uer9i0l2XAINYiECg== 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=CvzD31dw3AB/vn89/L7KWDNEv58BtWPz9s7g3AZ20ho=; b=P3Faved7VHFudWndfUiOBAUgo/FOP34FxGbKuZjqHQ92Z7vRfmQh/iOf9z4VAQ8995cF2B+286X8Da5mb0/N7UwMZEBlae37/4vcAmir2tVD3CRJbu1KfWVTeZlwHk9Bj2lJ9CcWl7z90dLX4A3vBjoQpfJ3zLNidpoqbB1srOUiFgsp9DbpDtBGCf+qH6rrJXj7Kzokowry/gzuYxW45mrXNx91fJURKCJzaqW5NNpKoZenwGWVtxzcz/AEloEoDI54Z2TyJAmvyfQWwGWtrOwOS+upKeRvuM0GlwE2MN20QhXVcvFZudAdv1+y0qiDoyF2Exq6W52m4szxo6CKWw== 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 TYZPR06MB6618.apcprd06.prod.outlook.com (2603:1096:400:462::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Wed, 21 Aug 2024 03:26:09 +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; Wed, 21 Aug 2024 03:26:09 +0000 From: Rong Qianfeng To: Yong Wu , Krzysztof Kozlowski , Matthias Brugger , AngeloGioacchino Del Regno , Honghui Zhang , Joerg Roedel , 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 v2] memory: mtk-smi: Use devm_clk_get_enabled() Date: Wed, 21 Aug 2024 11:25:57 +0800 Message-Id: <20240821032558.43052-1-rongqianfeng@vivo.com> X-Mailer: git-send-email 2.39.0 X-ClientProxiedBy: TYCP301CA0011.JPNP301.PROD.OUTLOOK.COM (2603:1096:400:386::14) To SI2PR06MB5140.apcprd06.prod.outlook.com (2603:1096:4:1af::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SI2PR06MB5140:EE_|TYZPR06MB6618:EE_ X-MS-Office365-Filtering-Correlation-Id: 9948e6d9-fcb2-4c42-ad80-08dcc1910012 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: Pe43iyAts2u8zi0wCfGRoNAe/O723ZnvuUFt4zZl0Ay+Cpyff4RRu55rsjAoWuo1YWGzk5S2/Qu3AQ9oZjbw39VK7KxnhwCBaecFot+Cu5elUe7qFVF8rS8ctuT6LEHt/lfjumBeUv5TmBDV5Ya4hlWqENrLWOi9kjH091jpzxeu7RwTM4jtQ1JGr5jPRIQzGzaL6L3gsTdRCb1IyWp6FZel0HN+QlSrqkCwMKFI1EhzlQmnQhW942iQrVp5mtxXGPncio8u796Xki0Oy+3gruFgeHRkaOSspcZlR4fBltESZDGiDG2hkJHu6OgJhbsh8p/vzN4Pin9VzQMugQs3Dwme9AYGtsjwrLsWGFDEV4xYSiCXuwdmZ2wDODyim0hGrCs3unrwG6vlegEjGRC9qCqjPbIAcnmyXEyBHcpNnyIFG7JuJc7yOcmTRfAPejv0ZkNWt03vrHWWFLY57wTCG7s9kJnfUT/euFnc4PynKQYvVE+PjsQczdv/misqgjDfPtExMyhCyskkxm3WOZCzteiXb+uNhJyjlkIieynsnU1LJMw2wxdlslfQU/dIQaoi/cPymHlaczoQUUuzPGoV9db/NuLVf/S3bS1sIvbCw5k8ja8fqBr2X1qZmjuBeLGBsv9mo2ULijpTKU9W84RhB6oZ6sxlbBCfRcq50XPf9ZyBFx4PogcDA3vrus0RBoDC6elreY41rLTNjjfZtm/k43ZL6MIHGqM/EasFzDvUu5Zd2Keg89TgOI8cRkQN9vj2bfGV+igQ8AWd170U3D34SD+NQ+z2+BwLtC92r3Z4Yzb3novEhvRFAr3RvcUWhlQUjLNym7F/r0n/gTEA2ApGV/DC0Vvsza2ttKslU0I5hsMF9ocfYJoO5FkOJehuTUp41clmQiOEcYNWT8ezEM63706gII+BJrgwdXX16nkKFrvAXqtyzLpirBBFo6AW4zuLfYDwCLaJBLnx1ZDYmoB/UtSYkkx3G1gKu9Sy1jw8DS43rP4tDj5s4lwBBwlWgFONkuDljXVOrF1AlcXk+8/20xI7nHwvXevt9z6Z59WxcGnyE1tZ/zpJoaB3AaoaVpHg4muAQ081mEi8vXd47uk9x/AUWCnVcL/d+y5TM6D5IHLyT6riR+ESApbjic8FLNA1DRMa6nH0e088rf2RZ7ocVQfCut1Hj1vT7u1Pfq4NAfhhhiFxDqcFU/ICGVgQPBz5FimrSSbQWwEJXNUD2N2+Vtyjc+FZkX/ExfH+pxH+H0V2uKkB+iXafl+tKmpHOkLoV7vuQIEzL/LfnwTCDDpQShfOrDG/IL/rS36iucYngMk2V66yyRjd0c6lhxY/bVXiMhnygAxdcjPl1iBSk7P9RMs9xmA0ZoGJd0Ytb2dmAiTdl5jX3yrUVLqeyR9GYBnCG1HqxJO4/MzBW+87xvc0TA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SI2PR06MB5140.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(376014)(366016)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UaeoULaLHuh14EkNX/fR3K68hBFWpNnPlm8EmAfAgdyN1rYKZdlaJpc+VkFBZkvn1IPMnIbuZM9IYawPJ3x96ns26SwZMXwPk4BeZQmDZba992HlSBAGy78CkPkDBP00WFXlopg8eB+nEDbJkNxDcTW7LQxEkDLREP526xL5hwApL34/viGhmdIH6C9KS5KLNIuwOEz5SfIs2JuBcElsxvga4jRHq+9TmtM91uU7D12pAX3R4/Z70dPwyGUoY6LzWrIjp+QFZKut2X5KG6z7HeSyE6R3mnXCsYZesFF06pTWB2yanSpfxR41DW8B9r/lR7DZLVzE8cKeNV8xUYSXZ/LXbk207pKcCaddqNv2OjJbep3aLWQlrPTusZIj6Ij9VsqxjqnEf6YaeHUt/bhPDqzemxXHcq0QroO4QNzMwZEu5f6fsYZ5j2GmEItOURp1h5yGDniuOf7Vnu+gYRUNqW6LaiZkKhEUyz6/de2wi8phR5XNxAvUuhdGKp/vpTqgpn0GSkTobDilZB9pXXw7uArrr6ueW7mSHZORdFsGf94aIgJ2fSrops1VXSvhZnMPq9QC28lFb822IIm0vV88n/0NttitREhZZ7Fm4dj8tc+5irzwZapWRRsYlylW4366OewWrOzMb6Uhs9RbkgbOTZnpHVDC/PLFcmya1IL6SeY4M8TLM1OpsG99e5IP8o7Gb4v2mXYev6b3NWlZ9ZJuyfvu2Nygu+gRaH8spmrki9GT9wWuujg7e3EOJT0MolN5+pmAPAUJ3SUhuPoPniwe6AT3aRozn87sYVOHzA0o/psw9DnOZtTUQqxyLhLpTy+FesWga3w+djOcAeASZdvdZ7Ylos3M0ufftBxMdh8h/YcIT5jFxYVaWA7mh7A9ADQKYypmDHyqYslYz6/4RMp7r5/PgRKQlF8fwHtUIeOajJT2t4S+bXNMb1BZB67p1GZ+bG2tviIdpvJIqo/7AOR8lO8aszRIxBbqVOmb3Tm5gL4tuwWT5u0qgTt6/MZvIOqaUHae8a0KoOBM71suOlkMti02o0KtSpSpEehYqGUAcyNYsC06AMT0fNW3QeLG+jQKXSDjDBTFNHwJUDxEIpqZE7PEbpVLZmPVR+jCKoAJX8nq75Y2TSE6Abg2EfLzfaKCuan7QOMhZgwMJoU5HRsHEZCsRrSbXr0X23p6vDzwj3WwONun/dZHWauBk0KoHFA3bVDEqeNt4Jk9bcJdzqt1I9TfWDzT9T5NL+ORqOPZYev0Wuz0kKYc5K9tb7KUg5ncNL+vJGyYsDQ7Wz1/Kjnx4D9UtAhHVuPH9Qaqe5aOEcmgwCEP3tnTWGwiHPVHfrrLauhZXZgsNHSgbC3jYr1RyzqC+IDRQhNUVgvFI0vxwsWfF09sEWVZtkDlLMBcTtitZSaQ6GSIOemxcNFxH47q+lBIb9X0V+E4RMv+hSiEFjgLDwV+CwPBaSXffwCW703l2yAXDkP5O/qEwGOsc/Ddd0jI9XDoT1Xdiqs3b6jmcsoO35aMA9LR+r+no/a0Rct0KzZUe3fU9MNbPQGr0xLTMHmPUy/C+uL94oswz0KzU2+upOf3TO/pbRhUOSIhBtUr X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9948e6d9-fcb2-4c42-ad80-08dcc1910012 X-MS-Exchange-CrossTenant-AuthSource: SI2PR06MB5140.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2024 03:26:09.7421 (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: HFCCRrFGboN7zHtso18rpe6ryhyGyE+g+bwBX6wldVsIK0HJjEf5vZXpPrwzd5+bGyKuzVRTejOqxFq0pqyXig== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6618 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240820_202619_491931_83241590 X-CRM114-Status: GOOD ( 10.75 ) X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Replace devm_clk_get() and clk_prepare_enable() with devm_clk_get_enabled() in .probe(). Fix the bug of missing clk_disable_unprepare() in .remove() by using devm_clk_get_enabled() that can disables and unprepares it automatically on driver detach. Fixes: 3c8f4ad85c4b ("memory/mediatek: add support for mt2701") Cc: honghui.zhang@mediatek.com Signed-off-by: Rong Qianfeng Reviewed-by: Yong Wu --- Version 2 changes: 1. Modified the patch description as suggested by Krzysztof. 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))