From patchwork Fri Aug 23 10:19:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liao Yuanhong X-Patchwork-Id: 13774932 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 DE0FBC531DC for ; Fri, 23 Aug 2024 10:27:51 +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=iD0/H4MaXwi5m6Lep224sF/IcLmCoO8d9kwLMxcXtPg=; b=WZbvpMHkT+w0JzY188cvmTeCeP YLwSA5b5LxOcfS7g0h/hDUijpxJfylTW3nrhtQzjodeJkHFOKzx1tH2BfRk1FKqCvLNRhwNsWBr6v mxFa9kAJDNs7FS2TgVuygxyo9wK/HNRhgruDrSHMfxdH7I6Zk3NEZLaf/Zmr5lrJWfZuqBSLtGG0o VWTcuQprzCYMkm1Es4xFEtlAeHffSo1BK+34EJ8HraP4SF5bwXZPyKWqQo9/F4w7Z4OBYqXwhsIrD A+4qsZjS3flr9mp4YJUHUwfhZedBzK3FXJ4xj0DUiW401G7kfiLzeMCv3+tDe3IUXnLERhRSGkzu+ RZfL++ng==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1shRWB-0000000GKhd-026b; Fri, 23 Aug 2024 10:27:43 +0000 Received: from mail-sgaapc01on2061e.outbound.protection.outlook.com ([2a01:111:f400:feab::61e] helo=APC01-SG2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1shROm-0000000GJ3b-32jn for linux-arm-kernel@lists.infradead.org; Fri, 23 Aug 2024 10:20:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=WTy1U8PceOd6Is6gVcJ/pVpwS6G2RyFRDlwsxZSvSCemNJgqAfItU7l7bfVKnvzKScLNgRseX5zDaqmydOZ1Qta9LgbAqQkFg3zwz1ii2n/mr62pi9afQqih4fQ/edf+XdBJCLJdmL3C3y8LHIQWNk+07wJzlX+iP3cy1RNrf3+VvXXk2+uvxYSYLbGd6YCAKqM6zh6U7qin7mVCNm53s4Kgqal1yJ72tnF1Crh8gOlCaWwb7gEj5YVwSQ0yfvUInb1GlebgMDPZ3+Fwxwgz6EQuXeWhmW7bAProvhfki+gLZ8AGw30XTv9voZYwnwLvogyTm7twrfZv0fpkMsvDIg== 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=iD0/H4MaXwi5m6Lep224sF/IcLmCoO8d9kwLMxcXtPg=; b=QJkG6nOLyfXCr4Nkox0wdYntLIPAzg/4Rvntto6H3AYSfO3JwMwWwwhwWNKPbyVYjeM1z/cj+jNL8H0M8hxKkdGT9jdChxO9HsCvEPeeH+j8L+UMPLGPAxzvmOpcjpP+0Lc7zmCizhZ5nY2r+XtshjUS4vn/ZgGksYjzjln156cg9qN4+w5dqqZPXG4KnPbV2HpsV+yqJV5rVoxnhnaMnPmvyiwyNIENeMERsfV3QR2ZvM8EQBdV+1nL2BC6VP01Q03YtisDpuaBi1oR/F+Y3KsYJnyUJK9ceuH5XuFkvYm+Ebyl9uxZC/DOR8aw6O8otnAcTJVjWdDQe8K7J0wOvQ== 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=iD0/H4MaXwi5m6Lep224sF/IcLmCoO8d9kwLMxcXtPg=; b=LHHc0G5f5kgn0hDrqrgQfx6vTGfytvAA5RaB2Q2xlRwimj6dVcWrccSnuIY7lGBqtPDXrKQFFdXHV6SD332qZRo4UjPygA08mi3IMFs7GHJ0Ie8XrGtEvRt/gIK4iW0PvqMCDE0NXrKW4HNbtB8f01ySioakuboaJ6SL9daS0ufsNqwNfrySIGVL04GtN2N9NclzyayjL7Z5f6Y6Ve//EQ8dUPxHzIKtZww3hlasoWXlWCteFjBWFHJj4yNywXMDnntSrQ8U7kczEzYKyNZDfrvxnMKCURJo7Z+U9ZTqH9c97PPLO98P1E9zyBIp3eMr7Hfogt6mX2ykr3ACGKz0SA== 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 TYUPR06MB5873.apcprd06.prod.outlook.com (2603:1096:400:345::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Fri, 23 Aug 2024 10:19:58 +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.7875.023; Fri, 23 Aug 2024 10:19:58 +0000 From: Liao Yuanhong To: vkoul@kernel.org Cc: linux-arm-kernel@lists.infradead.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, Liao Yuanhong Subject: [PATCH 3/6] dma:imx-dma:Use devm_clk_get_enabled() helpers Date: Fri, 23 Aug 2024 18:19:30 +0800 Message-Id: <20240823101933.9517-4-liaoyuanhong@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240823101933.9517-1-liaoyuanhong@vivo.com> References: <20240823101933.9517-1-liaoyuanhong@vivo.com> X-ClientProxiedBy: TYAPR01CA0024.jpnprd01.prod.outlook.com (2603:1096:404::36) To SEZPR06MB5576.apcprd06.prod.outlook.com (2603:1096:101:c9::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5576:EE_|TYUPR06MB5873:EE_ X-MS-Office365-Filtering-Correlation-Id: 515ebd5c-3e2e-4a03-2d06-08dcc35d2436 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: 5AfOI8C+y9itBALuJNZnai2Rtu7bUvRcMmVq4tbqEBTO5Pxcp3B/0wxYcYpuUF3Pcmwxj8out6r7Z6sw+kHdVjf0j/iei5oyBQ+V/Y77mglGOaFi8Tf2a/sgKGNp88MIoAFizaVa/BWDMwPZjnEyHXb01lDmb8VgWb08eefMjYhn+uBX7tym5eZAlOJEu2gzk4scsuluEle7i+DNccMBCVbcbUAr8XgkU/Zs4WuCRPPptv/iD4gvgk/596B9+cOoEUFzlsa+vJgRZpZNTL5EIOO/ZfSHEpL7EZ+nG2cgV2zxdMFy1ftIMszGFFCEmfIuoGmmYQIWrcw2jW1GGeg3bs5ljG3RfReJIb1YZRf58r4rj2/jwSKqN0uXlbuu2zCrZFRX8NsuYReByHdbRWkZXTB9IokhDYnjHKkaWVEDFHzx681apM4e8OsLA/ZICimSVaEXtP1H2BErxXfhz1y+S3Vx0FNgiQ00Bt6rNyjPaUTOGnQOOy2MadGn4VYUP600oOWrgDBlfNDoJpICf8FyytB0pBzwrM9UYp8DQZ0xauL5o/MIKmJczw78Bqpq7QKSt/sG2datPOD50KPhsBfl6U37h6KNJUAuwdUfL3PRzbNUZ+BdRUJ8I5aNeijjTsk2MocO843yRLUixz+P11UfdoEI9C2oIV4j9psWVufF6i/RwC0OkxlrZfoCzgYvk8AlHGSZ8mAlN1022aF88w6NY3gFbIaXzVloNZlpBVQCGPDZs4PhjXPF/cV0bV4LSlYzocxqPclCBrYgKh2blivh7PqgOmPBMQV+qZJAoo4QUzhQnXPr10URStnF6VABy4VoKpVwy4tVhn5QUAshleQegpSkcVx1JofLaHWObGrSy16eln28S7Yt1digENYrBfhqP878sqBRwYdyScrPa+keyqypVub9R+2GKtTs2HQi1AAfEWFr3jck2W0hiiHldXOP2f8itlLyQSFv+VnB79/6wlLPM+G+gkTzLi66WPF/6V7sCPk8/6M2DuAeWULP3gUKv2eg8wvVvvIY4BYj5dCO4Spl+gfalAGtByFSZWc9/5VD43dL6B6w90GKOQ1g9M4GqgKTpGau6O29rsULLKUkyNKoMrUeIk5aPVgq1z6167+NGcEsaTPAcEsL4widQS732+tM0Gup2kV5ocw1NxOGBI/Cz2ErkOakolAyalIeZkO0f4umP/8MCnmLQC687+lp/0DXnySr5gWzxHave8Lg73lC5cfj5l6msjX8MwPESHPFgj6/Gz3wfFlwTVlDhw4M/9DnOheskIy8lK0NLgFJhliUWvZnhO9esD0GF94JKg2kvhsocl0Q6knZWKz6+TELZNuHRIDmqkrzHT3UXoeIn3AZKLVuORP3G2UTUinaDxRi7o0Y6ZKj2ncKKJHqs12gGeNrT2XIL6SKmnk8jWnyyg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR06MB5576.apcprd06.prod.outlook.com;PTR:;CAT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XozDNnI/l0+h8mGHbc5EHbo1TOdetKptc2QpafXjP/FOcgyjuogQNLt0uXR6/7lc4J8zFysHf6bVNOhlekFz4Oq+R3U0Usum3KxykcmiWccT7YTUj03k4Ip2wcRP5Um9PVCalfE0yCAF4vW/QDuKdx/zA/nSE58Myots8TmKYVgazjuOSDlDbAvDhn3Yncrpa7WKBatj6R2UofSOfFtlPJYJyCzLyRBTCeRWRGMDisaxv+FY+ookMetQdIpyu1eB53Qmo1zr0I4Er139VMaUmUoDRNPxBJyMNIROjMqb2ZyJhKZlRwgWYl02V11zJjk391w99jvYpLGbYumEUdiSOp2fcpfuO55CvuYMN+WgPfhUOWbw2zSDfxZQkTvhi6bOjDTxFI4mU6e12dTwFbxbKeG2SyrUKz7cxbVgP6490E8VVzzHJ2szBqMR+SFv4DAFqQDhDLYCA7nW5NqtA1/2mto/HfezBDCnNXAxJiGKfdbc4H5sPiWaaFVf93LNJ7IbhnUvmK03voNnu4fOUMudRbdjn+Ki0YkWXyB5QaZVG7rrhHUgkdYpgtPAjvr9B2HyYnYUtkeQIgcgSOlSDVsu0LaYbCaY9Bu9l64j5/PwtE2obQhdAFhTSU8v3QH4yOyTIPSbmpICcywOU X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 515ebd5c-3e2e-4a03-2d06-08dcc35d2436 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5576.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2024 10:19:58.8353 (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: /mnFax6UgzTXQotG6eIVwO3urDE2lp5U5zkBE7I9d7sNgfbT+ykKfJESyw1Xuz9NB2TU0mPcRUU0eX+Bor237Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYUPR06MB5873 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240823_032004_797707_2DDA3F32 X-CRM114-Status: GOOD ( 13.51 ) 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-dma. Signed-off-by: Liao Yuanhong --- drivers/dma/imx-dma.c | 38 +++++++++++++------------------------- 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c index ebf7c115d553..1ef926304d0e 100644 --- a/drivers/dma/imx-dma.c +++ b/drivers/dma/imx-dma.c @@ -1039,6 +1039,8 @@ static int __init imxdma_probe(struct platform_device *pdev) struct imxdma_engine *imxdma; int ret, i; int irq, irq_err; + struct clk *dma_ahb; + struct clk *dma_ipg; imxdma = devm_kzalloc(&pdev->dev, sizeof(*imxdma), GFP_KERNEL); if (!imxdma) @@ -1055,20 +1057,13 @@ static int __init imxdma_probe(struct platform_device *pdev) if (irq < 0) return irq; - imxdma->dma_ipg = devm_clk_get(&pdev->dev, "ipg"); - if (IS_ERR(imxdma->dma_ipg)) - return PTR_ERR(imxdma->dma_ipg); + dma_ipg = devm_clk_get_enabled(&pdev->dev, "ipg"); + if (IS_ERR(dma_ipg)) + return PTR_ERR(dma_ipg); - imxdma->dma_ahb = devm_clk_get(&pdev->dev, "ahb"); - if (IS_ERR(imxdma->dma_ahb)) - return PTR_ERR(imxdma->dma_ahb); - - ret = clk_prepare_enable(imxdma->dma_ipg); - if (ret) - return ret; - ret = clk_prepare_enable(imxdma->dma_ahb); - if (ret) - goto disable_dma_ipg_clk; + dma_ahb = devm_clk_get_enabled(&pdev->dev, "ahb"); + if (IS_ERR(dma_ahb)) + return PTR_ERR(dma_ahb); /* reset DMA module */ imx_dmav1_writel(imxdma, DCR_DRST, DMA_DCR); @@ -1078,21 +1073,21 @@ static int __init imxdma_probe(struct platform_device *pdev) dma_irq_handler, 0, "DMA", imxdma); if (ret) { dev_warn(imxdma->dev, "Can't register IRQ for DMA\n"); - goto disable_dma_ahb_clk; + return ret; } imxdma->irq = irq; irq_err = platform_get_irq(pdev, 1); if (irq_err < 0) { ret = irq_err; - goto disable_dma_ahb_clk; + return ret; } ret = devm_request_irq(&pdev->dev, irq_err, imxdma_err_handler, 0, "DMA", imxdma); if (ret) { dev_warn(imxdma->dev, "Can't register ERRIRQ for DMA\n"); - goto disable_dma_ahb_clk; + return ret; } imxdma->irq_err = irq_err; } @@ -1130,7 +1125,7 @@ static int __init imxdma_probe(struct platform_device *pdev) dev_warn(imxdma->dev, "Can't register IRQ %d " "for DMA channel %d\n", irq + i, i); - goto disable_dma_ahb_clk; + return ret; } imxdmac->irq = irq + i; @@ -1174,7 +1169,7 @@ static int __init imxdma_probe(struct platform_device *pdev) ret = dma_async_device_register(&imxdma->dma_device); if (ret) { dev_err(&pdev->dev, "unable to register\n"); - goto disable_dma_ahb_clk; + return ret; } if (pdev->dev.of_node) { @@ -1190,10 +1185,6 @@ static int __init imxdma_probe(struct platform_device *pdev) err_of_dma_controller: dma_async_device_unregister(&imxdma->dma_device); -disable_dma_ahb_clk: - clk_disable_unprepare(imxdma->dma_ahb); -disable_dma_ipg_clk: - clk_disable_unprepare(imxdma->dma_ipg); return ret; } @@ -1226,9 +1217,6 @@ static void imxdma_remove(struct platform_device *pdev) if (pdev->dev.of_node) of_dma_controller_free(pdev->dev.of_node); - - clk_disable_unprepare(imxdma->dma_ipg); - clk_disable_unprepare(imxdma->dma_ahb); } static struct platform_driver imxdma_driver = {