From patchwork Tue Aug 27 07:48:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhangxirui X-Patchwork-Id: 13779026 Received: from HK2PR02CU002.outbound.protection.outlook.com (mail-eastasiaazon11010064.outbound.protection.outlook.com [52.101.128.64]) (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 A59CE172BDF for ; Tue, 27 Aug 2024 07:35:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.128.64 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724744136; cv=fail; b=sULS/uDEAGawSnJkTW3ahKBLrsoi5UVSmyZSyBFjkDWmItJjNfFCWM6JxqvjkyHC43lGUIh9joQDA7NkOhgL5fJRx1N1HVsSU+WONN8gaTWLzuiEH9ao9qxuPt97X9+6tPeObhGrwCbDqnuopqzWukzMaSctoMSNGxR9xs7dFx4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724744136; c=relaxed/simple; bh=OkQxT9mPY3rNO9CDFPe1k6aR99ktH+v6Vctu/6S16aI=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=tuKxaoEWM8wA5OMkk4Qssy80vf8+MwUKx+y4vUnmkt6kHwsiJ32+kAxe5SjZlD/jt3UpVu5NFFJqjNSsWHFsx3aH03YAEYfkhYSPD0Gn+5pthj/MR9FM/pbaGXw/AiE8qgKRI1a79Oq2+9D7RPUTIGIpcDrw1gWOfTxzKHqYnQY= 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=XBBxW4At; arc=fail smtp.client-ip=52.101.128.64 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="XBBxW4At" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Md+XJxA/2JgnI89xASuVXB+nud5SUsfYXfHu4UEQVIo1YmS0ghU98F2gX6zUXv2s7dr7KKUTfTr4fWWksd2L6NKuiFCf4rb5zAjtJPW52wrbiKBVVNRVCgCuAD4X3vA5uD+Gdorgbx1ulxLZxMxkfFs73tHz1HMn9DEV0BwUWI71Xbo5oY0+M6u8OPJSaKx/YfkCUF4ZhRFVBFgsITGN1CaBiZjhL6CMGLQMvxFqOB5Af2oqJfuw/HC4Bac2zqyjQ6/ENTfRTSvrJvKWbZPbEBus4ISyA/NO2i0GDfr8/e+2+JBtHkRFEa74E8b4XxNyGLulTvIwEIaedc1jnPKygw== 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=YbQUafBp9d0BR4mWRArTDewOj3yjWNb8GALNlegDChA=; b=kn2zKflT/nrVOAanmStwEDIqXUr2wS5Pe6gJWNMdscYTXi5JDedhrg/xA7VGWkyKDmtkvPafUSXw9+9BS4jDTN/uTJyzyPzvSalpUGce+LJQGaYrAP+htH3SLct6xdTjp6GJlmMbUU6KnKhfLwCLdxnmxrhk2XjgZkMJzPa3pom1gJC2zqCu8Cnr98f+K3Wm6IZUNC4UXsSaqUdQewnHijSSlbO+4IDj4kbIwh/nU1SZNUKmPv72X36dYAePM8Ovzuwclk//+V//QkF3vx1wkaGQ/x5qa03o99/iXCbJgoP4OhRUwzCV2PKMhjn70Vohgo76KMM68c6djBtbni12hw== 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=YbQUafBp9d0BR4mWRArTDewOj3yjWNb8GALNlegDChA=; b=XBBxW4At0hbHFGqXvB7rrcBVwlZx9Q9TAXpUYqopxIo2dUpwnZNUYjJT7uEwoVK13GxHq9M/Kis1+42XWeVzTlVh7CkQGWmn25aoKI4hJUSDr+IJ7WbKTFM7tmaR/exE2cNbgDNd3W6ihjgwEFO3ZSO/Lm83Ml2n8AjTpduTguixEDJPCeU+5gV3iDrqHdSp9nkYzR3erNOG+CxhRMR29tbIzV0nZeuV0LM4J9r+6VFpfcfaXFJ1BxyT6FrMGhcjPyFfirm/4JYbp6O6/Wafazm15xhL8ar4dzcuIMVCSUn3fPEFYzBTxK0KUYOzi94FEYHtlG72oV6USmi6VkK2mQ== 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 SI6PR06MB7102.apcprd06.prod.outlook.com (2603:1096:4:244::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.24; Tue, 27 Aug 2024 07:35:30 +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:30 +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 , Linus Walleij , Bastien Curutchet , Bartosz Golaszewski , =?utf-8?q?Uwe_Kleine-?= =?utf-8?q?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 5/9] mmc: mxcmmc: Use devm_clk_get_enabled() helpers Date: Tue, 27 Aug 2024 01:48:43 -0600 Message-Id: <20240827074857.2671808-6-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_|SI6PR06MB7102:EE_ X-MS-Office365-Filtering-Correlation-Id: fdadd016-92f6-4e72-0535-08dcc66ad3d1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014|52116014|7416014|921020|38350700014|43062017; X-Microsoft-Antispam-Message-Info: 8VdGiYYltQBwo5uQVlaYYQ/ssIoW+3c3qOBAnA8jw2oWFy6eUTReAf3Ea2biBTwwks5hxzsc6CHw/Glo/xZ0LvL1uhloDnTqTlfBJYthERHYXEWAwgepdIgBQWbZNESjprObque5xVXd9Wl7C/L4A76EnHJ0bzz3SfivyjN5HgJntbPruy0rXwH+TwGnFXmynJg8zaj8yE20FURlSaJVQ9BWYFsOcFqlKMFEyKDfhKadN/Ai8zcEHpAfryRGx3KrvjpRzV8kCDldK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NmbRHJ46PWBTbT89WozFgieOLM5LaM0GvQlvi5sABgJW8oZm2e9vzDe14VFkHG8VrwgYOOtVuH9tAJcc6rDgLnB/d3sOj/0VtQ2PfqFkc0PqBvQ7erD+2BT9G8R/jluMKSTpv6 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)(366016)(1800799024)(376014)(52116014)(7416014)(921020)(38350700014)(43062017);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HeaUkb1NVxwFBHTwrcS+72XkFLDJCCd51Uazy4meuoieL1OwFGtzdvguHdlzwU6rxfE0om9TSoCyj1QVcsCjBsC2NkZ7rkLc8uLfyJxLqnU7sAQxF3JAfOOJCjBEUB/CS/4RhtC1fRc3KRIcEDm0xQajgS284Iu2kKFO2ds3tgyM+u3wRONtNLI5n4PtM1ozlPYGUd6eWB9nrnFxl5E5HsqNmJ8t52oJXhmh6qjSDZVQtBij51jGaCoOMrGZizlvdm+7oiHbY++szjAss5TM4jTIVeKg5aectXoaPJdWk7Dqn7hfh5wHMc9WElL/dUIyjmCvKU9q3RUf8ao2GeDbFmb/R2/Eaq80FkRIVRoJWa9o3RlfJ+tPxpxb9S1VhRoBoOmJgfc+pbXqN08Xvbav90JzF1Vs/mcwTIxEwgdJkQm8Zbcko9rpX8K26dS2vo5VhWWzfWIeUBIdYhAm59AnNmaSyD292TPLEVkqsOaZl0DAT2DURgaeyAq4jovmioI3iMdg0GB74VeEOTfs9IcuNMwARXkrvfaUftKn/k/C2iVUSMPtDfs6UKymC0+kbAUFWx3zTZPzI4rLZyJ1BqdnONwOOuPg2anZlaSP6v12ye75q6mKXalCtSmENgRrUdGLiX5bujRboUAc0GuIN2KTow8W7MA3eJdFcmrArRJglmXlBjD0NT1IbmanJIoBBP8zc83g2qaiF6L5f8ur2zam7izIPMFaVd0/L4UVexopKWDYG0ydLOAw2T411+OXs5we2R62jykgLl2SQ/tu+Aw07+AKaAgRDIdttPRAAjUx2S0zsUFL2W0Pb191np77YDj4ziyfzmfumVT4e0NzQcqQ0DVvO+slMH1FXxWVQn3VmcnX5Et0+2odz93QGXHqh99a3QdrAAOAxS18+toebY185uPaTZE6HB8aT6+87jwSGsPjxD5uaXJtu696SfCO+nEawofx4FEYEzfqp8Aykl4hsFe80QRJHBKkstl+1cDHN0NqqYG2B6qNOl8O//115Ql61l17LNYKJBDBwhwnkvA/YYnmGvNGroqD7zGjuZdSyjn9fKsHFUI8ZX8bGCwKFWCNIzbgj0P62cdCDDwHblTw1l6f9PLzbCuRo6tUlE1ocZHGAofH5b4SMKfF/WAvjXjJLFHfJF9onSmXBPxNGNOrGDBhu0B37bAX0qWs8NOF4my1NBE5Y+PggDBOPEbZ2qxmCZc0V53KMybEMoIJrVD9WARprBvHxbIbWprScetMdrtXUgei4w66FGDH3h4fEXgQCouSFCxlS1ArOww1z5KBbomaz3Gjy2rEuE0zVV7ElRm1aE5gKfy6BUFXexw4BVCD/wIqSiO+FoRR8xAHmQJVTFfokF7XqEjFxxwjQ3FUE1KWS5NFvjfrgqwinsk1Mdf11B2ey6W0vAtFpWoSFlIQrXaSeyzj0yyKat8vInIyGpvuFhYjjqSaZ5A1QmxUwZSsk3dPjCA6Z5h9x6HDEmnjm50q9bOUESrXeMd8BLTtQNfcisx6cVoQU5HcFE5AaNF4dOLi77W+ABNvNXt7sZn6jBg0waAVQPaVYS915wpmewvXOjgGhJqUNhNvsZ0i7S29 X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: fdadd016-92f6-4e72-0535-08dcc66ad3d1 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:30.3551 (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: svEVySu+fnOLINEkf2yiOsZl+zVdctDFb/wmV/KkkFLppL70TBVKYp+X2BRpnuyLMvIUTCRwxllQmZ94mqJBsg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SI6PR06MB7102 Use devm_clk_get_enabled() to simplify code and avoids the calls to clk_disable_unprepare(). Signed-off-by: zhangxirui --- drivers/mmc/host/mxcmmc.c | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c index 1edf65291354..171e1f6a5611 100644 --- a/drivers/mmc/host/mxcmmc.c +++ b/drivers/mmc/host/mxcmmc.c @@ -1069,26 +1069,18 @@ static int mxcmci_probe(struct platform_device *pdev) else host->default_irq_mask = 0; - host->clk_ipg = devm_clk_get(&pdev->dev, "ipg"); + host->clk_ipg = devm_clk_get_enabled(&pdev->dev, "ipg"); if (IS_ERR(host->clk_ipg)) { ret = PTR_ERR(host->clk_ipg); goto out_free; } - host->clk_per = devm_clk_get(&pdev->dev, "per"); + host->clk_per = devm_clk_get_enabled(&pdev->dev, "per"); if (IS_ERR(host->clk_per)) { ret = PTR_ERR(host->clk_per); goto out_free; } - ret = clk_prepare_enable(host->clk_per); - if (ret) - goto out_free; - - ret = clk_prepare_enable(host->clk_ipg); - if (ret) - goto out_clk_per_put; - mxcmci_softreset(host); host->rev_no = mxcmci_readw(host, MMC_REG_REV_NO); @@ -1096,7 +1088,7 @@ static int mxcmci_probe(struct platform_device *pdev) ret = -ENODEV; dev_err(mmc_dev(host->mmc), "wrong rev.no. 0x%08x. aborting.\n", host->rev_no); - goto out_clk_put; + goto out_free; } mmc->f_min = clk_get_rate(host->clk_per) >> 16; @@ -1112,7 +1104,7 @@ static int mxcmci_probe(struct platform_device *pdev) if (IS_ERR(host->dma)) { if (PTR_ERR(host->dma) == -EPROBE_DEFER) { ret = -EPROBE_DEFER; - goto out_clk_put; + goto out_free; } /* Ignore errors to fall back to PIO mode */ @@ -1163,12 +1155,6 @@ static int mxcmci_probe(struct platform_device *pdev) out_free_dma: if (host->dma) dma_release_channel(host->dma); - -out_clk_put: - clk_disable_unprepare(host->clk_ipg); -out_clk_per_put: - clk_disable_unprepare(host->clk_per); - out_free: mmc_free_host(mmc); @@ -1188,9 +1174,6 @@ static void mxcmci_remove(struct platform_device *pdev) if (host->dma) dma_release_channel(host->dma); - clk_disable_unprepare(host->clk_per); - clk_disable_unprepare(host->clk_ipg); - mmc_free_host(mmc); }