From patchwork Fri Aug 30 09:41:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liao Yuanhong X-Patchwork-Id: 13784813 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2078.outbound.protection.outlook.com [40.107.117.78]) (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 9336B17BB1E; Fri, 30 Aug 2024 09:41:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.117.78 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725010907; cv=fail; b=o2o5wDG6G6gdo2AQkjr+VoUrDTpJOiETbNl9YrLj3kHZV6At5Dmxqi6Ewt99sT5hK2QfJfjgMW4HoI4PKUo9r3VtDuzJ6BPoNcnQiArzttC8rZW2ldTqN7zwedb4iDOzeqx6k5nHttR4v8XO3bguIsKHYWZ7D2TdYJFc4SK1YyM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725010907; c=relaxed/simple; bh=aUZ0Z3ianJXDx1xT9J25RFLohoDAnhiAthSlqVT654c=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=lQ2RBM+iGUo4OT9jDFEt/nH83CgXgQ5QcpSylD4SqFXHotuNy3UqrgiSAQsvurx5E52LqZHFYsF9l9haIqM0BaloDas7OuHhCVJXOllIR6bpq/BZuzn6QzZmOsov5PHHk0omOVu6XP55YZ2Ws/EnSnyV8y7ujLhgXVmyt3PJQ3Y= 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=bkksAvBE; arc=fail smtp.client-ip=40.107.117.78 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="bkksAvBE" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=M1IBMwc/nNWA2l8IkDk6tGQTwREqXajHWYT5SR/jEPTSu5Ka2mJl4WJsbmCjCKoID7RlL3gBP//YxIMmLvU/JI1XcyUjpYec3V7I/UKnQ768tU6Hzu0+QUbPUxWYu9VM9uLjOB2We+2ZilkhHPG/tTtYoxkdP4pRqepzoK3WydsLhth3WVw0hd/XnSZEBJHHuFa5jh1PxmMw0Z8QPpZxBKTuY5X4l/HfTYBRzqdmdBtopO0WPuNT53ha6T4gQZUsoXqqlnYohomcW2ZciWe1ll2cz2cQruXrp/h5/66Dm+7n030DdEhlWkw2kjpMFnjuEH68XRVL0It3PcOwfM2K7A== 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=P4zfr71ATHpl8x4CGvq5JmbNUkA7OrAKFkK1TBg1Ys4=; b=hvexd5XoMV1thPhiRiiN4d0xDQcS404Vpa2D6JVlprojuIyI6wdQMvSh9UpHZl2zsTBsUAtpSWIwUoYYzf6w+hlyTnpNKfHt90MdVDvfRzlSxWVmGVC87XkFDBPQ9vxYpQH+l/f0SMXpVh1CujZAdlruBcYvgK1fk3uQphVIsUQ8D/h0zbqdELseWzXzHS9W73d11adUkynqLUpIYXotMEozhiDeTEtfMqG0b6kp7M8sTJ1qXOnZfy1VCe+dQJOHm9p02pQxNSuDisxDzeantkpeDk+Ybubo0csvczRj4CtT7dPUQZ1/d/VtpmyhmyUNmMIQj6Hb19o3IIfSBIWdLA== 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=P4zfr71ATHpl8x4CGvq5JmbNUkA7OrAKFkK1TBg1Ys4=; b=bkksAvBE9v6lv0pPxXdBNXAUnSuhFee5XpPqt8oGVff1dhuzSFmgcAk37dcZ4Tsw5qIaDAywX8PqWyHloD2oM4R2NHeSvgpzD25nIkjaDkyGFMQ3J5KLwx1D3m1RlsttJ9It7jzPWoFqwTF0UNVo+ijKJiSnQRcMTvHKupz2Fp/kFvO1oJ3D5bB46sg2kXWAOyq/laU22FimSrFYRU206xgjC7zgFpe35vlvwlvtZHEH/52lui17KnT2zm00imLYZTrVeW1r0HmMSr8djz4ZZJLWiVZ+/kmrAKbVvvadyB/8FxSWCg4E3ro4ZDLuO/t+OUBpTMQ/i1FJAip1r1LioA== 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 TYZPR06MB5203.apcprd06.prod.outlook.com (2603:1096:400:1f9::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.25; Fri, 30 Aug 2024 09:41:43 +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.7918.019; Fri, 30 Aug 2024 09:41:43 +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 5/7] dmaengine:imx-sdma:Use devm_clk_get_prepared() helpers Date: Fri, 30 Aug 2024 17:41:16 +0800 Message-Id: <20240830094118.15458-6-liaoyuanhong@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240830094118.15458-1-liaoyuanhong@vivo.com> References: <20240830094118.15458-1-liaoyuanhong@vivo.com> X-ClientProxiedBy: SG2P153CA0020.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c7::7) To SEZPR06MB5576.apcprd06.prod.outlook.com (2603:1096:101:c9::14) Precedence: bulk X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5576:EE_|TYZPR06MB5203:EE_ X-MS-Office365-Filtering-Correlation-Id: 63a66b08-fc85-4cc5-bdbe-08dcc8d7f507 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|52116014|366016|38350700014; X-Microsoft-Antispam-Message-Info: 75XUrXbdkZyXDHcYrfJcr4SMg4A1C++RGrMBFXEPEEnQyYBggp/F0/d22lmCvTn5CkBdk85oJy7eA4mi51Th+XG2uN/0g/2Sv2irA0AO9jGQLIIX0a3eP4rVde/QXvsjMSyNCyktcNwl/KBCwwgZm5BcEMU4jCBMZi/O1Qf4TYVZBQ2Mybtg6bBGkvQXPj29b5NqsLr5oUBHRI4Ey8OVIjDVbjR6z+bbrNjjXovheAvOcC1jFmyX1n0VCdvqAMExgYHXygcEzEjDeo1mF2JMAKV+NfMvDfXUPtn49QjsI8p3zpPAqEVFLB8Dh2phmEEkSjn4LR9HeCxvbEE8mEk3gBXaFpAKNKoZ0YX+vC//rXliLWEXej1KnZiofYcgptWE20s7dArR4UBLAY7PCVeolk6kf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ZPR06MB5576.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(52116014)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: nEuurZeAnjHSpPhqHqcYbPH467obSjE00RBATTXomRcAQxah57kkVLytYLTmUjdS3XetE9UOrnmj0ZPIfKNdn7WIMo2E1dV20e4qw6cu9tNVkLKrM0MraQ0qCZSUtildm8wybZvwUmCeWFlWMxJwDaBvzpLiH2axbaouEtLyu9M1+9q15wwEfw/HOUPnqPqFeyiNo/LbsvRur9n1WOc1RrM73v2M9zh8HGlYoHTZm//eYWWdO1tFHDEn10tDSk9SQce9QcPLi9bnNUls3pUcWLoZzpJiXLWpB3fZJC7wxIfwXay87y4lAJBGF9XMVMylFRA1BGLsFvmsF3yljeGlBBCDg5HLDFLRsBydL9jDpI4tBmulOcygKVE5zUIgHrD6ELN2J+n6TpU8F8hd9dA0iBTGyLo4aQahuyJdrXY+MKyKoySJsoDFhI3RfKYkVFXiYXCGzhx2GsU2mshH67P1kvrOo2OPoYaDQSOl6ESN/24pn1Imfp1CPL/CFFebn5+aaaCy07SKWVd88DosA2ecIF1Ey1xSnXVlY+OVD3fwEc+0WBwzvjxyNTAxAsx0q6sdrcyOgc2IuCIZ188uQnYiinGNMpEmwWtXH94yU7XkjZw/xJhHJN1GV34TpL9H4LVw0l1c5U/hR77izE0GuyxDv7MQTnYN1GtKOfhTmMkDjGavNeJQTWb2fYnfgMrE9xVVFXzna+fgdPivD15THxvSEaqKg79KIJ1rpRlP/ktwdUNbF/ivv4va9sIsql3ljjhy4jQc9K4Nh8mBpLG2kdA5k6be9nCJOMhNL3bk9cBqYaCeRlPB0QhknFUeHfvUNfD+oYtwr3AarxjZt6KUGzcrF8RJICakCgwqIxMwKDOylO+INCR1GkbROCJ94/OsntuP84eDnAp0MUqmUmSMP624f1sJXbnPCKaFyoKtjV4fWrzqDqOFFK1gmOnmJgUJVJbkBmuBXm+RwzLdCrUM2J/Zbws0dPPzNRiEkz1y6lEjlQYaBsfJdJUBAdqwmsXznlt7x+tfPvk6kraE5UxAVmBbyWRU6qPx/92wo1EyrbInb6vuNRx5oNECuZuUm5lnnpUaj3yaeETaMxZ8YiQELBm3Lpv/ZbxokrYdw2TiYGrjUb3Dz6BTwrC6cyGUoriIwFSvs2+grhOUrTbvFEL1LH7wkSbs+KP7TiTUWgTAfiiZqkS9EpNL7s3j4jSku0f28xrKW/oKH0u0NrHQMaxOcjfqiuJGvACLn46tlUJ+LjCkvB12If+jEMQ5SJUGGfineecaWrwNmriAOLUC6xCpFK177Zm9V9rTDhAxfqPL/zfzKQ2JeWpV14Jwy2mvLJYnWa9bcypw39BBJETIQnCetvuYChIWvzL0rfNfhclSCPRQyw5AhF3/EHsddPe5Oh/AAH1fQdvj3rtagFnR+VGWm9ZbxlEBo70O6AMagBquerdBG13pKb/UrWovOKJTPjTfPiDH0kOvO9dzUfzdB0H1jpxs07t6Ev6MA/hYHSZma0ChkfW9AVOfX21br1QTVCW/B42WKnd6sZHKxc1PDURGe3orzdSHelMYKIM+hktSuuajWoRblOYr/0mQbbBsh76p9G+d X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 63a66b08-fc85-4cc5-bdbe-08dcc8d7f507 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5576.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Aug 2024 09:41:43.5851 (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: Vr0XbRRIkgVE2iJ13fLu3BsjYv6I66AwweQhaVEtLWLVUL0EZm8R+Ir2omqgr7y9hlE8cwoM3EiJCkfIfCJVyw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB5203 Use devm_clk_get_prepared() instead of clk functions in imx-sdma. Signed-off-by: Liao Yuanhong Reviewed-by: Frank Li --- v2:remove all enable related modifications, replace clk_prepare() with devm_clk_get_prepared() --- drivers/dma/imx-sdma.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) 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];