From patchwork Wed Aug 28 08:52:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liao Yuanhong X-Patchwork-Id: 13780930 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 8AB68C54753 for ; Wed, 28 Aug 2024 08:53:38 +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=UUPbvKAvk29hTfUC3ZC9LXRK8LifK4Gu3GMob5TERlw=; b=pDfA0FNwGHVqD2+w2FDcTiTpsD u1beLrcCf2+YKkEBKHJH3QN/t3p5IoE60sli/AfP9C1KvHHhc2lgRIO/8OdAD+jW/wVczRE11y53g eje/GuW80m1M7QmfaNO4DjieiwWmLSt+h4buS5IgRTlUEe3/yO8jH2Crw/xBSTE6keK0G6Iyz/Oxm C9z+Qtr5WF/QLOsc67oJl0PoohXt6pi8OsUAM7Sb4yiHgM+Q8+vgUf3k0imwMWXs6jHanftfC5oC4 wwsLaBxdVlpPBo7yrYKNVhG7qiW+lbx4xxsekozJ6vubJRFSVChNbifLYzIJC+XgMSekVALt4I2AB s7b36kFg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjEQi-0000000Ebd5-3dEf; Wed, 28 Aug 2024 08:53:28 +0000 Received: from mail-psaapc01on2062a.outbound.protection.outlook.com ([2a01:111:f400:feae::62a] helo=APC01-PSA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjEPs-0000000EbKQ-2avL for linux-arm-kernel@lists.infradead.org; Wed, 28 Aug 2024 08:52:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wo0O6x1U2skA+WDnhCW5Ix7pe+2B271bSKBSRHS3gqLrYw7jLZ8VfGbO0hVSFdy/CuYypB6Q/DEAtO/6Dxk6S4WweZkKBsbftn9GwvsDoqM5nlEhtLN0+lsnicQMXvWfuVY2pdohNwPy/s8BIqzT9ScO/9mOyBNbmkRBIg+ZjNuENSIuEuM9SgQw+K+93yO9S1HNq+Wo0d6I/s6MySrBCM32kwMEMBggCf53WvxRSCFNDmvn9bbStobO7E74eSh8bsilSqtMeDoscVQ1aNtkmBdVwo7qeZlo7l+urb0ue4Iskz/C0O1T92GN4lRUM7cSHagkUK2R6HEnP7GvIPsgLg== 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=UUPbvKAvk29hTfUC3ZC9LXRK8LifK4Gu3GMob5TERlw=; b=v+YwJ7iU/JrgrxXXRgoq1RLIjadyWhiWwldrrHcHdwmk2Ctq4HqxmLTPe3zV4ThutALQbscPQKr1xWA5cpB9sKAcpnSqLPdpo0PI+Z2osUGHh4zGy76tLTtBysCpJ/kvgvHtL6KHUou9HcMVXXDMb8zVKwvEe94Ep7rg7kjSuaG5wY2gzT17DW/tbweISYDp8+fSUdmyaVeAFHa/zQDyvhHctBra5PHnZ+ApX+mSHph2bYiHB52YHFB8WAoXIduUo5/HVU6JWOI0xQw3C9Gkwx/GQ6t37NfE+wKo4GmPZKRRAQ5VP3FKvwOjHX/edh4lbXIwzLEcoYVIrraErItU8g== 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=UUPbvKAvk29hTfUC3ZC9LXRK8LifK4Gu3GMob5TERlw=; b=UoYBTdNeKFU6UhNmhkjCxm73YXj6pzUdqmsURKmEu0/p0C2RzjmLdv91FrIiBYg7M1Id0SnE7w6jMAyarajWdjLb0j5uk1i0MusM3nnFyG//gL2r4+f4cO9QedepiD2DoHebxKJV+tGlHNXVsiTh4O+/hlaIoDnQ3uBXg2Qm8sx79DU1ev1JwCQuV2x1ehx+Vfk28DGNnn2WI+NAEUuhtv8m7rqKF5GRXko8nOiaRlZZLzTx6r13y5Wa3uixVVPFMsGrVF2orcIMhdpuGtkfOZNuwG0iKBUeLyuHBoqc3pYbrLxny5AttGPZYQ0oPJdbpjheaiVFucOnb3yyT43zDA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5576.apcprd06.prod.outlook.com (2603:1096:101:c9::14) by SEZPR06MB6013.apcprd06.prod.outlook.com (2603:1096:101:eb::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.24; Wed, 28 Aug 2024 08:52:20 +0000 Received: from SEZPR06MB5576.apcprd06.prod.outlook.com ([fe80::5c0a:2748:6a72:99b6]) by SEZPR06MB5576.apcprd06.prod.outlook.com ([fe80::5c0a:2748:6a72:99b6%4]) with mapi id 15.20.7897.027; Wed, 28 Aug 2024 08:52:20 +0000 From: Liao Yuanhong To: vkoul@kernel.org Cc: dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, Liao Yuanhong Subject: [PATCH v2 4/6] dma:imx-sdma:Use devm_clk_get_enabled() helpers Date: Wed, 28 Aug 2024 16:52:10 +0800 Message-Id: <20240828085210.7159-1-liaoyuanhong@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240823101933.9517-5-liaoyuanhong@vivo.com> References: <20240823101933.9517-5-liaoyuanhong@vivo.com> X-ClientProxiedBy: SGAP274CA0018.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b6::30) To SEZPR06MB5576.apcprd06.prod.outlook.com (2603:1096:101:c9::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5576:EE_|SEZPR06MB6013:EE_ X-MS-Office365-Filtering-Correlation-Id: 7f857ba3-dd0e-4481-3ca3-08dcc73eb9f9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|366016|1800799024|376014|38350700014; X-Microsoft-Antispam-Message-Info: xvZUAYfqKwk93ysN0JJUX0xNPaxFDJOxnrKzkwVb03P6BCfMfZjcrEs6TmfMaHVcd9gnxGD0PDFq6VzvJxIHcTUS5tQtnaI/tToI7a3K6ibHu+buJZ1H0WRepekIug6tgRrHCPMc+ezBOHnCKOOfv9mmkBRvEt8MDdn8lgL6U7CzNWOJvMzPmiirygxfd7QUli0VyMjcc6TQL9nzVLUHv6udXPQkbu5tFItcwuIU6ZJlFvxCKovZKfBzNfbKeNv9DrEDnOYc7kgquM5esMIXzdNt1yCVapi1lLcWO4Rrsd0744yT1yNaKW3TVbuHFDN7PFShHPi6h+TZKn9UHcdV7QbcA3k/ESTQ+tAOn+s5F2nqU4jzcgX992SSUhhEsW6TsqQ6QQCtiideJ5Fc1nLBrAmnCMd8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IPV:NLI;SFV:NSPM;H:SEZPR06MB5576.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(366016)(1800799024)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: k399aAAzLJiQTlJOxWuxYeujOH1iUv0HHXmwaHka0SEGpH0a/en3Rb9eEq0HOR+60ndVhzAO8gtGkXFKEXjty8Q/V6hBtqzFv+s//2Bt9kPauqiqoh5FU81M8LDrURSCjKx+JzwaxthQ+XuEhLn2bQj2S3uNHcLOCjctn2e9ikEJztcpkQQAR7hZ63T1x+N1rAs6Da9t5sNzyTV691juM3m/AuJilqyysSj4lp62OmyHvpo7adwL4F1gTIrLLuPt9BQiLY0IzQplBEylIQWUFX8UJfbFtbC8yDu9UgZklmkVxVNc244t5cq0eqo0lz5pcSwlHHy1b40goO6fAmi70ZlPJ9fHrlI79hTcSXzf1eK8a2TwmsRv+duHNQ0sgvKOTtlCqo471Mo8IxZrfh6s8/CtzCCrt20eOV/tJ6YbKEgop5LgicCN4bk9leW2AtNjw2A8OKv2rF3CU5NwqfwMWwJA64ukW4aMgXK/WNqjlk4DGjy0eLzEdtO2j9Skt6kl27+H2SohFrwwhjI6NRN61s5BDDg8kLQDKUfpfzll+c94NlQ2hrF0AdiMxXf4W4x+muR5ijlG1Pc9HCwEEtaiAN98UheqFcrECR8C5iFmpU8u6LkRvlFObkGZxY+ZblTGrocie+Zw3w1PQJNGf4k7+7EtyoPxvgzrZZiz1G/XCnbD1zSv/FaQPZ/7j4qx3nuqiXCgK1VVqdq/hf17YZut7mHs1CIH0xyWiaZE2LvGxCsrRk8Cw9kFtrSezsT8zvryVyFoXndW5+QZd9fbeRhcCNLKgO6RkESXGb1g6QVis5qcs4zqex56IF64Bld6wQOz1RmCbYcsm1Hle9lSjpJoHnIO7f3/2RKaCsZusLTcd1QMQm+WupkEetfcLvGg/tkWiO9g/pSuTEvphkaT6ra97489Q/iJgd3Aqa+5aQJxefgIycyzaK2RHkQWXORFFplONTjry6QAnzdesDBm1vD41x2QkFCaxRKhnPGVvS3mkeoYEF62mMMJoAiXTypXxKAtsWmQK13/a6/3f/XZh1TSqjx0VoE1J+qGtuLroAETc0d9u2giJf0ar4SKrcbqKkd3Nc64tw0il2pMamfuMj1Ec3xpsKMVSVNO3B0uXdICxDAdAhQSri33DKwy5wxKlXtBAP9gbycMcVzHje+yhMASXLZp7Ht+wSn16XzwTrF3UI1HucJ58XhPKpuo0ipPGUQc5+tuAi3aOjFtCJHRLAKprL2L4Owj19zbOG79mGa4jd5fzZDhk1EXp/IcxtfuvCDN98w9JmECqOPLGiGLa+xIz5+sS8CFnh8YoxwoQL6wwRLnf66C9h+CT4akLVpnhGcoL5Tqdfb2RIX5VrkZnEKTf6SBHwtAOof2kGegUBB0QbVPFt6uVCF9yeEnAigmUIxc3JFnHdCLexey7iR8jsDZhPXI+SnDt5JYLTUdaaLWsTcK8tX31rvzPbVaMxyYUHAk+3YpIkBdY+Lu6cRUD5eXK4ocKR5L1IG7h80gq+5g538/6P1cqtpC7dGY/c4NMVkcpGCMkHPSF/mgFCyh63IAspGt1A9xj3lUiJELGkJfp+Di7bvCwGrYw9vbGXb2yjQ7 X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7f857ba3-dd0e-4481-3ca3-08dcc73eb9f9 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5576.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2024 08:52:20.3515 (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: Y+EWlXlPQ05lE6avzjSpKHFVxQChtQ1p4w3ruONRqMTbNbu8IEdktzF/lS8asCntfuLIk+7EhH3vHlFLClgSfA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR06MB6013 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240828_015236_683916_1580852C X-CRM114-Status: GOOD ( 15.16 ) 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 Use devm_clk_get_enabled() instead of clk functions in imx-sdma. Signed-off-by: Liao Yuanhong --- v2:Remove all enable related modifications, replace clk_prepare() with devm_clk_get_prepared(), and configure COMPILE_TEST on the corresponding node in Kconfig for easy compilation and debugging. --- drivers/dma/Kconfig | 4 ++-- drivers/dma/imx-sdma.c | 22 ++++------------------ 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index cc0a62c34861..c4ffb5d3e321 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig @@ -264,7 +264,7 @@ config IMG_MDC_DMA config IMX_DMA tristate "i.MX DMA support" - depends on ARCH_MXC + depends on ARCH_MXC || COMPILE_TEST select DMA_ENGINE help Support the i.MX DMA engine. This engine is integrated into @@ -272,7 +272,7 @@ config IMX_DMA config IMX_SDMA tristate "i.MX SDMA support" - depends on ARCH_MXC + depends on ARCH_MXC || COMPILE_TEST select DMA_ENGINE select DMA_VIRTUAL_CHANNELS help diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index 72299a08af44..07a017c40a82 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c @@ -2266,33 +2266,25 @@ static int sdma_probe(struct platform_device *pdev) if (IS_ERR(sdma->regs)) return PTR_ERR(sdma->regs); - sdma->clk_ipg = devm_clk_get(&pdev->dev, "ipg"); + sdma->clk_ipg = devm_clk_get_prepared(&pdev->dev, "ipg"); if (IS_ERR(sdma->clk_ipg)) return PTR_ERR(sdma->clk_ipg); - sdma->clk_ahb = devm_clk_get(&pdev->dev, "ahb"); + sdma->clk_ahb = devm_clk_get_prepared(&pdev->dev, "ahb"); if (IS_ERR(sdma->clk_ahb)) return PTR_ERR(sdma->clk_ahb); - ret = clk_prepare(sdma->clk_ipg); - if (ret) - return ret; - - ret = clk_prepare(sdma->clk_ahb); - if (ret) - goto err_clk; - ret = devm_request_irq(&pdev->dev, irq, sdma_int_handler, 0, dev_name(&pdev->dev), sdma); if (ret) - goto err_irq; + return ret; sdma->irq = irq; sdma->script_addrs = kzalloc(sizeof(*sdma->script_addrs), GFP_KERNEL); if (!sdma->script_addrs) { ret = -ENOMEM; - goto err_irq; + return ret; } /* initially no scripts available */ @@ -2407,10 +2399,6 @@ static int sdma_probe(struct platform_device *pdev) dma_async_device_unregister(&sdma->dma_device); err_init: kfree(sdma->script_addrs); -err_irq: - clk_unprepare(sdma->clk_ahb); -err_clk: - clk_unprepare(sdma->clk_ipg); return ret; } @@ -2422,8 +2410,6 @@ static void sdma_remove(struct platform_device *pdev) devm_free_irq(&pdev->dev, sdma->irq, sdma); dma_async_device_unregister(&sdma->dma_device); kfree(sdma->script_addrs); - clk_unprepare(sdma->clk_ahb); - clk_unprepare(sdma->clk_ipg); /* Kill the tasklet */ for (i = 0; i < MAX_DMA_CHANNELS; i++) { struct sdma_channel *sdmac = &sdma->channel[i];