From patchwork Tue Aug 27 07:48:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhangxirui X-Patchwork-Id: 13779027 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2051.outbound.protection.outlook.com [40.107.255.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8042F12F5B1 for ; Tue, 27 Aug 2024 07:35:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.255.51 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724744150; cv=fail; b=rqbHbOYY1HO0nhXUXdCqXLZgg9mBwjXBJV2Lj7VNfKotKELkAbk91Op4LLWYc/7Bg763CJ8Wz/GrYPGRpm9pDvzyMDAkEUxkuEcxDisFViooT8lY2ZrsU5/q+k8MvSD3O363rzhRdYoxA93Pvs2FBxnnaYXJ5hiNK1FHifXgHGY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724744150; c=relaxed/simple; bh=xDvCroMp0aDXU5rUbuguUFC85E8aiQVrM1RYvK6vjzo=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=sIx/ifTGdseqbHcFKpwTlQUJc7+6/9gvRE6tNjLpozgsCvzrrysLAvLmYfMplrl6aX7X2IhDmogkh9j6y+V1eJdhMsD0yTirV/P0O/PcbXj1iIJTskKNL75P9K+LXoRSg3gMMmt8IAuwEFjSkdeQs+eUpsUhT24vGoHMtWWjx5E= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=P2q+KYp1; arc=fail smtp.client-ip=40.107.255.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="P2q+KYp1" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=TkazcKgoOm/iaqwfmTxjJy3ELuBg1i3q8l7i19mFJ/jb1KcTzoumGxdugmvjF5dsgFePAMUFsd0cbyDdjrLJ6NyFvDfQ7tTIHzE7nodnqNSXH2hm4jqLuzdLlv+0jbdr66+pOExpNDaW/zeRgh+V2xlyauM/LKc7gHgtiBGWjUmDbUjNsT9JgB9kbY7GCe6qfV5fTM3ZV4AdiRt0cp7E8cqDd4X8ShVzj5elKUpmMomq0jHtnOWAQjizrdvBlpvXnVVV+PdS6+RwQuHeSkVJzDydesK6/qSd4fT+t19rVz4YNEEtXJWDmWEb97cFX7AhdYZz7hkE1MhFZjoXYa9x6g== 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=LltO6/GeL5VjOeZSLuuIVsg7yhtwm4dguIk0sohcj24=; b=dYyJPvsZUbrVEpP8tWdjo2LLyfL+GssOYCn2fJtODlcHRv1aqhgt0mBjkPeah//rPn4Gi4BKk1InryVbJx+VuYZLvldFBgAtCLdmVa1LMpLRRIsXeeoeGwJQVMtIFQD9FUIgnSkD8IsgXJKG4avrx3HT/IMg8EqHcQLs2qUy4oPAHukT4w3CdXZ62tuUF+IxaH+QIesaB1KR3Y0QRJoipnCtAJj++A4JZTa2IDRY7txBx6PJ0zcl+voPmPDEnqTBmqxUhFsN6tAz4HkD3E9vZqUnZxj3ShUMWuxcvJVyDCPrbwIYfkhfcfigprnJow+xDKbRr2kNviETVi3N4khDfQ== 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=LltO6/GeL5VjOeZSLuuIVsg7yhtwm4dguIk0sohcj24=; b=P2q+KYp1Xu9pR6sRWY+LaedBQKmGgjsySP2tgP8KkaRoeyxy2rSvDV7u3kr3cw0pLLwN+2DrLjVTDh85jjv31RLRKmtaqWHZ644J2djoUaoRWzsynb8V0GNsCs9mxHV2at3hEu4Hrv0Q7yXu8s5kMt0jKU6RXGxL7Msy1grhVzRxNdREXa4aWzflPYXYK50HHwZA0/jiZC9D1Tl6EusCoL4Cxeb+FXsvVBW7/sWUQIINeJc5wDeoZ5mQP6HW1TvPbbwTqVo0T/rRYm43jlEM/QkvvgLU0p8by251CWnfc/NySGE4LhwM1bw+7mhUMgKkNntnHe7gfdGVhlTHIkpmrw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from TYZPR06MB5178.apcprd06.prod.outlook.com (2603:1096:400:1f7::12) by JH0PR06MB6656.apcprd06.prod.outlook.com (2603:1096:990:2f::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.22; Tue, 27 Aug 2024 07:35:43 +0000 Received: from TYZPR06MB5178.apcprd06.prod.outlook.com ([fe80::f6de:c016:c33a:318]) by TYZPR06MB5178.apcprd06.prod.outlook.com ([fe80::f6de:c016:c33a:318%4]) with mapi id 15.20.7897.021; Tue, 27 Aug 2024 07:35:43 +0000 From: zhangxirui To: Robert Richter , Ulf Hansson , Jaehoon Chung , Nicolas Pitre , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Adrian Hunter , Taichi Sugaya , Takao Orito , Michal Simek , zhangxirui , Bastien Curutchet , Linus Walleij , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org Subject: [PATCH 6/9] mmc: mxs-mmc: Use devm_clk_get_enabled() helpers Date: Tue, 27 Aug 2024 01:48:44 -0600 Message-Id: <20240827074857.2671808-7-xirui.zhang@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240827074857.2671808-1-xirui.zhang@vivo.com> References: <20240827074857.2671808-1-xirui.zhang@vivo.com> X-ClientProxiedBy: SG2PR02CA0005.apcprd02.prod.outlook.com (2603:1096:3:17::17) To TYZPR06MB5178.apcprd06.prod.outlook.com (2603:1096:400:1f7::12) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR06MB5178:EE_|JH0PR06MB6656:EE_ X-MS-Office365-Filtering-Correlation-Id: 2b4d7a21-e3bc-4e46-429c-08dcc66adba9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014|52116014|7416014|921020|38350700014|43062017; X-Microsoft-Antispam-Message-Info: oUGHR69KcSfBZ9fXidkc0awaPTcbVjQ4ZT9lR0+gbW+3Jg8vz3qnhIMz5sE9+Jl4qsDX+10K9ysIiGgF727v+Ahgv3RiVOmGL9cY//S7RjlsoaA5LKqwM6y/pG0aiuTw+sPKgQh2Q9/LSst7ZWJDseTGxXVZiO0C3OmZ7P9R39Ga3xMjbAlKgygzjwPurC+5DEROmw0VtOORyQOFPEokv254tWqdxsnFC5Cwr+Uu2YIW/EsLio0LpGW1S1PBfo/re+tQehcjlATc1NbHDv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V9NvpQtXZHCrZUcVHmarnlifLMT0sINw4JfsduTZv7qYMs/5ldWkoQVF9sQ7gMGo9Drv8SxYR43t947QXfkkRoM/OBnkgQTiaXiQooGvAqAKahjDBpjZ+2O0yo/4/wHzc6tW3RW X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYZPR06MB5178.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(376014)(52116014)(7416014)(921020)(38350700014)(43062017);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: syvw0mq39mJfg7RPiKvR28aryT+BBtn2H/rz+eTqZgVHwc/9GWM6PHSs1BbihTKHrodRNpKMSQhbZzLakzJ9lD3E4w2SopEYZdYqqR87elsnFPhponEUe+IYr0KG5VJ6AvAcFp+rLOvq3QNvaqhevraRDwhsVGKVInsnabZ9udPZZBa4g2Yftt/dgy97jKnGzt05QZnQgcriDhjPCUayd8gvhlNbROUzCOsWGv/dCpZafTIwWtLMbaEzgSJTJrxnkadKRi2XOuajEg2kHf/3GhDo6Tm/lg8XDcIoGmRow0DUxyA8lTP7g4R2sU9gAZMeWof9QcFO7nIFGrNCTm4BN8+FVU3WF9c+Ir601x21dCY7y8mMxrtmS2TLGU7oa16VgsxlEQ4K3dvdtX7p7ssvmvXfMttMFL75Y69p7uo6V8W8OGnirdx4Hso3RK6EHhU3bktp+zoY3Kyt/hJ0o7antaBlGkBeO+j32FNnkqCioGd54hNQotWPpFz/k8gmnHLYCwfsfqiR2MiRVuCJzLcE6UT5xgIGlpHjtM/13jnquvc55yqVCugogU2+uZbohHGRZvxA+8doRVMgXSwBKr0AS0ClcIanYxGzL2mMhvc1twlXEcrtkQhmdNRPE9rUeiKPAz0sh9iCAt7N+7JLCYeAa75ZlsqJ9fq00w1QofxC2S8cMVYLGa5unDmgFHg5skMMP4QbkRzkkq0kViBzrLyWHwFsJVly0YfAOqZ6LCAm4++Jo7j8C6YBA4RS/sopqTTUl8Iu47340Axx28KqSgXpNUmcCAg8+/ILd+JYD9gRB0zP5f0vHqSszRZCLfRjl4UW+yRptg0FSkdG8MTcEApSufYdM6ZDTBfAPKbcqchYYuRE4RSxeHxM+PPGnzia+LApoyLhr4Q609DllVFEUK9U6UJFBIVvF/yuqIAggXc4EGTJxWGqJIbWxGxFvakcbOxtjx1bBVAjkZC5/tUUM0RmROTTIHWPy3YnqSig0HDd1XhVwjDJ2EovapMXYbEtm+dIjJXeyEdv6UiQEqloTXYvXLI7QYL+yIB4My++UzU94k9IowtiRUGA4EPyg9YEGNUxsVAN9HDiNjy0qL4jSlbVyo9grDOf9um7YDL/7lLVcmfnVfKzWDB8evy0WVYblKa8vTYDGSt2ELnvb3X53k78KDCpPmbZZnK6I/MrHvol0Y+nEypXTcazBz35ctwdJmpsyrMsalZFrsHCbrVal/Uopj6Pj/ozFkbNPhC9JY65AmmxSBfGDqry+C0RIc9xx064JEesfs1DN2PqObMxw6VydxgTIkEjOSpRDYsR+YqY74mBLK0LxGRd2gezfZQqR1SbXyPKWUqS5BohITLrzwVrk5GINGyLwlLTpHWU0DjS+kkKynisc4pGaDDFYPBX5Xyr07YBxk0OvwzRU8YH9ESPKAE9YVFYsLXicxZAN5SHPRCbUZ2CpTfNDMUBB27DXbJmaO4PYk9ij2LQBPpN0fjhZCKG2oAnXHvKkXF/dudwN/rVfUi5GThbmzKrjcVS3Wq76ByIdf+dAMN6tRMSzzlAygMJho5WojwssnY/re4pMN6F1iT49g7pdwT6QJxcI4R3 X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2b4d7a21-e3bc-4e46-429c-08dcc66adba9 X-MS-Exchange-CrossTenant-AuthSource: TYZPR06MB5178.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2024 07:35:43.5203 (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: IeW3m6Ev4ghgwZcpKHZ0CqKWU0S0AIbfqWSrEeh+cGoSmg4pwkqzVtnatpgiwUqeuCxXoRL7sjx3fEB8aT5Elw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB6656 Use devm_clk_get_enabled() to simplify code and avoids the calls to clk_disable_unprepare(). Signed-off-by: zhangxirui --- drivers/mmc/host/mxs-mmc.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c index 6751da9b60f9..591b5a3ad6dd 100644 --- a/drivers/mmc/host/mxs-mmc.c +++ b/drivers/mmc/host/mxs-mmc.c @@ -602,19 +602,16 @@ static int mxs_mmc_probe(struct platform_device *pdev) goto out_mmc_free; } - ssp->clk = devm_clk_get(&pdev->dev, NULL); + ssp->clk = devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(ssp->clk)) { ret = PTR_ERR(ssp->clk); goto out_mmc_free; } - ret = clk_prepare_enable(ssp->clk); - if (ret) - goto out_mmc_free; ret = mxs_mmc_reset(host); if (ret) { dev_err(&pdev->dev, "Failed to reset mmc: %d\n", ret); - goto out_clk_disable; + goto out_mmc_free; } ssp->dmach = dma_request_chan(&pdev->dev, "rx-tx"); @@ -622,7 +619,7 @@ static int mxs_mmc_probe(struct platform_device *pdev) dev_err(mmc_dev(host->mmc), "%s: failed to request dma\n", __func__); ret = PTR_ERR(ssp->dmach); - goto out_clk_disable; + goto out_mmc_free; } /* set mmc core parameters */ @@ -666,8 +663,6 @@ static int mxs_mmc_probe(struct platform_device *pdev) out_free_dma: dma_release_channel(ssp->dmach); -out_clk_disable: - clk_disable_unprepare(ssp->clk); out_mmc_free: mmc_free_host(mmc); return ret; @@ -684,8 +679,6 @@ static void mxs_mmc_remove(struct platform_device *pdev) if (ssp->dmach) dma_release_channel(ssp->dmach); - clk_disable_unprepare(ssp->clk); - mmc_free_host(mmc); }