From patchwork Mon Aug 26 12:21:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liao Yuanhong X-Patchwork-Id: 13777803 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 007A5C5321E for ; Mon, 26 Aug 2024 12:23:41 +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=B6FYtsFhEyMFGAEXQO/gNbqqqnQUPVCJE0i/0b/U9fk=; b=JytzC+Z/TABUcwlE/bqFWzYNQn UlRUkjj2Hjv9/fPMH7KFB3InTs5oM4hJ65W6p1GnGUwnh2IllLwiIa5KuJeps/psXWQ5HqZOGnY3q WxnB8HM1C/RVFWBakRdUkFC3FM07AYhL1W2Sl3QoMpflhY2f3g2rFUJGm1WnNlazoi+FRYMDeAenl Gxd54om07a9piBvSm2fw0tjXnXHilvcRceFditarfitT5frN3KcRsT6OuFl4EgZv3vOkvH+jX5JAO Jg4Df231L6RB6v/BIsvBCkU5yY+uuhvl2H3+Df5FuzmpZ49DJnBCOc/UTm691b3EP+xaJkX8wVjEi 5jOiqoyQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1siYkl-00000007IZ4-0Hrf; Mon, 26 Aug 2024 12:23:23 +0000 Received: from mail-sgaapc01on2060c.outbound.protection.outlook.com ([2a01:111:f400:feab::60c] helo=APC01-SG2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siYjx-00000007IMh-1vov for linux-arm-kernel@lists.infradead.org; Mon, 26 Aug 2024 12:22:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=TrQ0dDpxUxdZpbJ0Ti9aoZfBMIAbqK208epn9Gif5U/o26TNNMC/baMV7LVDSvkBXU/1StgKbOkBsL4C2cwuqARHY+S+o+DP4XbB/GyO768BZIsou+vCoPS71QIzj7VLNCzfOCxaEWK0VW63RZufiKemYMUvQ8tTusWR0A0pMFwKh7pz4MuRgOq3DfCj4uYGRQSyY65nG9ZeqwTYnl/r3XQJcg9xo7U1moniXXuqu2FgDbuzGga8zXxC/diVM1wMLXnOz/b3RJgI/bD448jM4LxZDqO9YIgVtUxO5jZg53cpjsgQd09CRekAov9pzDdI2Ydt4vZx+6hgpocchWCzhA== 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=B6FYtsFhEyMFGAEXQO/gNbqqqnQUPVCJE0i/0b/U9fk=; b=tiFvTv1eV6BjKoGAB/y/rWZFA4y1RoYR7ldh6kNOMeHOG/1qsNssF9/Jsz78fRUvXp3ioNQDr4PAI/Mz2lP9a+bfeRaORk+dwQTN7Cqr+mdbzO9lV5EVjXjGZU2qkjTXkbph9eld8wGXP27t0Fa4EJKzqHqxc1TXM3tHH7c1JBFQ+GUW0lnoL2GAGSk9p+MS8JylleKYzLTn7T5ROCNR5eQ3zKxh+d51+TnQqVPZXiIJQQWbksH2nHetcLA8C8Sr3eQmuNKsKk+Yd3lcFV6BQHD3Ke9algh5xlyNvNDHTPyXhLBnFf1DAL6Ff3sXawo4qfeBYcwMzJH8O/cuqJRi3A== 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=B6FYtsFhEyMFGAEXQO/gNbqqqnQUPVCJE0i/0b/U9fk=; b=R8O+D19T/IOoniWcrweNyBMnCpOGTvSlaUh+xzFjiSjvQtiaJqm9sFfQmgsmhjIZEytNToTkH4C/WXxm1m3WlSnr+jTL4Q3S5YpXG8DRcJf+YKgoYZdTEmthOwf8hAn1LBMAU+RX5ESM4WQTkfMVDob6vzpKUFeZvfzeQuyoGFBxoXF6EjdaiX+0iLs8SIe6yRHSDjDvBd1Q7hehqR6Mg1xG/oVi7zhBK0mG8xC+AIUqqRPrIXdpRB23N57r0a5tzR1mhqan0/R6wZ5yFEHEHq9EIQiu0CgU0CkV5ngIGMtlgYAMkA6b2hFFhvgehbBYbiTLMXkScavBHh71642u8g== 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 SEYPR06MB6904.apcprd06.prod.outlook.com (2603:1096:101:1e1::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.24; Mon, 26 Aug 2024 12:22:10 +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.021; Mon, 26 Aug 2024 12:22:09 +0000 From: Liao Yuanhong To: vkoul@kernel.org Cc: dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Liao Yuanhong Subject: [PATCH v2 3/6] dma:imx-dma:Use devm_clk_get_enabled() helpers Date: Mon, 26 Aug 2024 20:21:56 +0800 Message-Id: <20240826122156.27038-1-liaoyuanhong@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240823101933.9517-4-liaoyuanhong@vivo.com> References: <20240823101933.9517-4-liaoyuanhong@vivo.com> X-ClientProxiedBy: TYAPR01CA0168.jpnprd01.prod.outlook.com (2603:1096:404:7e::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_|SEYPR06MB6904:EE_ X-MS-Office365-Filtering-Correlation-Id: 5374b087-7d75-4f2b-eb4e-08dcc5c9b4e0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: n7DJd0wyBHJLXZVkzYpT7jpjNcsQzDQpO0cMr+ftoosPOcvtWxjkk6G+6oTLIvdnsrvxvuZ2swXccHjxiE82BmNAriYl1IF8Rq/Hu2lUI4+ZDfNEi/u0tbucr2KgdHpDwNFqjMcNPr9gXKX4S81YrOUAjYUPc2Zt7wi3+DEEgmD4Dj0/PWTBePix0Fz+MGNtwwSVm5ROur43SQ94vfHX2TJ094FiyqjtYLE/YJ9O1ngX2SLmVYB2nXT3ZZuG22nYF/RWO/YhokolOLfkBrb8UnGdv+GaXkiAJRpGKwgkSLR1ApxHZZ6wmVXFtcLPmoKRKmdk5Yio70ZiqKPWSgsAAGDObHn3+Sv7QhDL30KMwN3ziXjIE4wAgHINTy4Ap2mcxKR7rYHDfbpTyub81M7H6Hhi306DcHF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SFV:NSPM;H:SEZPR06MB5576.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QXVfpr+Q8oDmq+3gy7CSdT/ccPvcCbccIgCyHf/F5ShcNudjYNa7ntZBUX0wZ7x4sZCRwEyyj4gEYgtSHO4dN3ycEXDv/Ws0HMJ5W8rn3yWeuypEkKIFJx/7JLLv4X95ezj2aPp9ZVIefXFf02Qnx2fc7/gzw2HwA2MnTpBXvr82bC9nBfUlIYC3ReYRIA7mDEgeUvt5XRW977Q/3u675bqJ6sMOYhEfvLadUbEXeWYa+4sygYjUU3u4adUXbLK47dTRlgPfT7zw63tLZFyYae7CyZc/MkXaB/4M+GUAT0bJ/AfRU50cwYXsJLEDPN97TAtPHWbqr0qaTCPlOKxI1giHpJv+n25VZbMqukuFJOZod3eguUGnMMsFFAV0yPsyiwiWzOY5F56kIAC8TleeVAwSS8yl63Q9rc/WpAvVS4tOjllTIlDpNkyl0xWD1ftVRY0Yl5kBz8NyS/xta6demE2aE0IAOUbqSD3FswE5UintNNhb+rDQAkXVYVfVrMQoDQYvbs2PJv0UHpazBbu3E8TZxt5VoL4dzDR5+y71PfEMfMJ5SuYzkhQc8+67Cx/EFRTyFqSqJSrB24c8Y6+GsmznKhudHKWJLppuv7kXnbi/6yo1pepEXwl5WkCnbqxZVA49RlTPUZnFKtByOHuUTuWIk1fsaHqYyTeyKT+jCOJg0sGnwt8VZtUoLvcf/o7wrgD5gIsxgIBhPFTWUogc+N52u8m3UKO3+E/ett0wUlOFLuJuqRUIr30d6V1OpsfzJOB5s+1jWrJQqhIfRnlSOdJtQXjcnaVkyo0vXcs6+ZkXIYEYQGYm0bsq1oz8kT/zLdlKLCA8w2hfyEaqBEvkL4oatV0b18NrRnHAb/N/VtDHcp21Q0o45g2pHoQfS3pCP+Acp243rV5fO+8vXDuzHXt8NJ4BD2Tv+KFDklcmD8qYwn+yo0w2THj61ztCO1syilyv8vML6ZvnuFuNBYhruF9zwSJhloT9uiubhW/1BGJ6SqJAGX+ofERDIgS+gYu42JP589Yai0QmWJ5qKfHO1Dm6oSE03cnhxdsyiCO3G+evR431Fs9yGkKJluUNez46Zkred+Fe13zUoXCg2lNgftQbfeP24wGytiCzkYjJJz7yFJ0sdiDD/PWZ+PtWbfvXqGJ96olPQ7ygJCOtLcxJJiW8VHv7jc0kopVw7K4NFpqMt0PSsr1mn5lCVn7boPWzgoep5Ner+AUnnFEhltLHh8ZSi3nYFFQ/ph8uOeie4559fNf3Z1ICr9o2p02g5oi5x5KNGd9LLHIJN/TfPFjV9IheOYb0WhNf6YHabHk2je0LSd3LBZ5z+5DnhDiFtLwpZyq1jh1hTRstS96Abr6ji4bzJMeQ79DvV0Id349kV/KPZNM4+Rubaz+sCEOqRbucK4jutRk3E0qYutReAWRicFomnNOlNbi06Ib6+qkHMdt1OwxItuhNlC4043yhewwdINLCJohvQKcaEWAGHCOgnyXKILDBdwhqNPnbOghX17JFAONEf4sY6lcBnGgurK0Dhtz+Bzl8xXrGyyIcvHSEUfOgOlYbtMZ+qAHyPjKyuw4/t4//b9UTgmUSSCYQojm+ X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5374b087-7d75-4f2b-eb4e-08dcc5c9b4e0 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5576.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2024 12:22:09.5789 (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: TwzzV2SJcQyzuPRuh5dnAwVOkY5m+kmz3yrqJ8VwBjBgbx2Z77U10+tg6PjSHchb/abeVYeiUjEKzzOizqYv7A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB6904 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240826_052233_529230_B951C063 X-CRM114-Status: GOOD ( 13.46 ) 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 --- v2:use dev_err_probe() instead of warn msg and return value. --- drivers/dma/imx-dma.c | 59 +++++++++++++++---------------------------- 1 file changed, 20 insertions(+), 39 deletions(-) diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c index ebf7c115d553..a6ad50734f2a 100644 --- a/drivers/dma/imx-dma.c +++ b/drivers/dma/imx-dma.c @@ -1039,6 +1039,7 @@ static int __init imxdma_probe(struct platform_device *pdev) struct imxdma_engine *imxdma; int ret, i; int irq, irq_err; + struct clk *dma_ahb, *dma_ipg; imxdma = devm_kzalloc(&pdev->dev, sizeof(*imxdma), GFP_KERNEL); if (!imxdma) @@ -1055,20 +1056,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); @@ -1076,24 +1070,22 @@ static int __init imxdma_probe(struct platform_device *pdev) if (is_imx1_dma(imxdma)) { ret = devm_request_irq(&pdev->dev, irq, dma_irq_handler, 0, "DMA", imxdma); - if (ret) { - dev_warn(imxdma->dev, "Can't register IRQ for DMA\n"); - goto disable_dma_ahb_clk; - } + if (ret) + return dev_err_probe(imxdma->dev, ret, "Can't register IRQ for DMA\n"); + 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; - } + if (ret) + return dev_err_probe(imxdma->dev, ret, "Can't register ERRIRQ for DMA\n"); + imxdma->irq_err = irq_err; } @@ -1126,12 +1118,10 @@ static int __init imxdma_probe(struct platform_device *pdev) if (!is_imx1_dma(imxdma)) { ret = devm_request_irq(&pdev->dev, irq + i, dma_irq_handler, 0, "DMA", imxdma); - if (ret) { - dev_warn(imxdma->dev, "Can't register IRQ %d " - "for DMA channel %d\n", - irq + i, i); - goto disable_dma_ahb_clk; - } + if (ret) + return dev_err_probe(imxdma->dev, ret, + "Can't register IRQ %d for DMA channel %d\n", + irq + i, i); imxdmac->irq = irq + i; timer_setup(&imxdmac->watchdog, imxdma_watchdog, 0); @@ -1172,10 +1162,8 @@ static int __init imxdma_probe(struct platform_device *pdev) dma_set_max_seg_size(imxdma->dma_device.dev, 0xffffff); ret = dma_async_device_register(&imxdma->dma_device); - if (ret) { - dev_err(&pdev->dev, "unable to register\n"); - goto disable_dma_ahb_clk; - } + if (ret) + return dev_err_probe(&pdev->dev, ret, "unable to register\n"); if (pdev->dev.of_node) { ret = of_dma_controller_register(pdev->dev.of_node, @@ -1190,10 +1178,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 +1210,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 = {