From patchwork Mon Jun 12 20:34:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 692278 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 487FFC88CBB for ; Mon, 12 Jun 2023 20:35:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237509AbjFLUfM (ORCPT ); Mon, 12 Jun 2023 16:35:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237752AbjFLUfB (ORCPT ); Mon, 12 Jun 2023 16:35:01 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2075.outbound.protection.outlook.com [40.107.8.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4A40E56; Mon, 12 Jun 2023 13:35:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VEn5NzTS1YbhYgXXw4KfLHzogXRB/Fg2rLbJFFgx3G6aNfOoo3RXaf8EqrRLC2yZh/zE2Hm2v8HHxrbtffO2PML/4ohQyQry/6byUM36LTVKYBz4OR2PBSrWQe52x1F+BLVPw9ZFaH0O0t4BrtR+PNxSJIU2HHO+nNCzqID6zDwX+YsMB/IInk1xDDRROe1J6lNP4NN5kNXGfU2tY7SjKPOs6RyZwDrcMxyNCGbqavjTIj/rVm0v9Cz78f2pnNWadl7IoBe7VS2dJjylKdat1ElEIX7vKWLndajXjy7DcIIiScdxtyrWDPG4fL3L7zuh/VP6alQrBFGLs5ic1iJMYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=EWGw4Zf+HBff2ktpvDNTKgNM3Qy6tvNMDZ1fjELGovU=; b=MzRPRo/wYWMPs6adYK+8xn6sNcvuwD7iGMce30jWblPskT0nv1y9cLPXpnO1d3h6gXwP2gKPp1xnT/SVzbI4h2N/Gkn/oHvPjI2nJBSn+aKSF3+UvYKB9icaowz5yp5IQgyPewabjT6/Tz0ybnZ674JRdpFcKqV3M1F5W32hXtgPHYFJRsZHTiOIjNfszCH2WpUNiZq2H7YgGtHbq5XN+Vc8iOKcttCmWnAdIvFhivKRl5K92Zac5vqcA8qoUHLgD5c04WHy1JhzkXMxUJGuB1YtC4pxZqIBnLccOnPQKu2bRPmiKYt/FoMW5cjIy3x1WCSa3M0JFCTL4R6XlIDdIA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EWGw4Zf+HBff2ktpvDNTKgNM3Qy6tvNMDZ1fjELGovU=; b=Ppl7KbBp+e8TGj19XKqOhi0DppdtNtxhX1orlaU4qL78GOsMD4dddqlLo43ZymAVrmzOf/qQe1cTSIohG92Lb8jCosAlNaeVZLU7fFM8HK6qV/porcEI2iXlnugYSuUH51oDDBgJJTVLCjULxvTsl2OLq79RW9ZqRbaDITyIWR8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB4845.eurprd04.prod.outlook.com (2603:10a6:803:51::30) by AS8PR04MB7975.eurprd04.prod.outlook.com (2603:10a6:20b:2a4::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.36; Mon, 12 Jun 2023 20:34:58 +0000 Received: from VI1PR04MB4845.eurprd04.prod.outlook.com ([fe80::602f:42ad:882a:5ca7]) by VI1PR04MB4845.eurprd04.prod.outlook.com ([fe80::602f:42ad:882a:5ca7%3]) with mapi id 15.20.6455.045; Mon, 12 Jun 2023 20:34:58 +0000 From: Frank Li To: vkoul@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, peng.fan@nxp.com, joy.zou@nxp.com, shenwei.wang@nxp.com, imx@lists.linux.dev Subject: [PATCH v4 07/12] dmaengine: fsl-edma: refactor using devm_clk_get_enabled Date: Mon, 12 Jun 2023 16:34:13 -0400 Message-Id: <20230612203418.2017769-8-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230612203418.2017769-1-Frank.Li@nxp.com> References: <20230612203418.2017769-1-Frank.Li@nxp.com> X-ClientProxiedBy: SJ2PR07CA0016.namprd07.prod.outlook.com (2603:10b6:a03:505::16) To VI1PR04MB4845.eurprd04.prod.outlook.com (2603:10a6:803:51::30) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB4845:EE_|AS8PR04MB7975:EE_ X-MS-Office365-Filtering-Correlation-Id: 09837582-3fa4-43df-834c-08db6b847d20 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zrcRWFv5q8d2ue7EdxQ/jZo4ybwANvN+aRT/WUVIal7q1CsL8/K6fAVvBQgM2hJP7V9Haz3im9SN+8YLhM+qtfbhAnmUwUEW32D5zFy7HJrAQXEOgjB+n/FPflmGDVAmNGqlE/IPM8ars9RVTwLtfMtvDZAI4eY7JZzE97MvWuFsTrfU4rWA37Q12DN8iccmg3lScbmVmpcHCCKwi3vYoGePYJ8pZgDqflDvZuWILqGFJKrK4qrApNaNr0I5uhBTSlSgmdGi3l8IUAY9D/DWbeH1EabDfFDKeGU4lEqSPcsJHzj9MyGxvgbFlCO+qXz3D2C0UjT5woiSIPSlloxKrW3xmXN9/xyGLGx2oRECBNS3ocvm+Eatr/q9HcyB6JpDRL/ZAQm8Lcq1gdOFrdDpg6Tq0b6CeJ4Xner4UX2A1fgbZcUGlZMcyGFJhSOiUh+iaERVhgyHGk+l15oZPvftYmvh3L+rlX6DyD9KWh1tlodkQUVsKZBE7broDdbSCYkBd7p0T6kLD2U3oVEBThMWM5lHylyOPt8Io3vbMV9j+Gfe4Q1aWPp7nisWqLjR4lGorf0jPDjiMohoUBhd3oPOSnAVLKhQGQhx9u+pAhtFFe4GKMOppCFkx016mIaInuXko8vAf6Kmy4j9sZ3iwKjGpQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB4845.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(39860400002)(376002)(366004)(136003)(346002)(396003)(451199021)(36756003)(1076003)(26005)(6512007)(186003)(5660300002)(41300700001)(6506007)(478600001)(8676002)(2616005)(66556008)(66946007)(83380400001)(66476007)(6666004)(8936002)(2906002)(6486002)(38350700002)(38100700002)(316002)(86362001)(52116002)(921005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qTVRyC8t2oDZQ15vy0O4JyUPXjvs+LrorpwI9o8zQm9yHFQ4EMbVOTomMWfzYjinqwNwWJjQa5nICA4N7KWYPZCog8Rk5XXtABlYZzu1du6+zQOjStG+2r0Oj0pegntc4wQSXO6jl/SQa+2/i45pNAOrdQy6wl7QyB2VOnTWOlLlHJb4A1BNUOUEBjTWGkrOEeHHhcnHNvscFeG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Zmnt0sCLrz+UEsGHwAtIf6uJkdz1VgesfoprHW2HHhZ50ktsMMTRkZUY5uoBJRL480VfJPA+vGQd4Caqo4Xi0j6CzqTf+6zGRT+SB/fcUu8h0WYADo4/N0ek6t4eR8giwKf5WBuU+3N5Kr/6gtuM7svr3ygxNZv/Gb7B2b3dctBZorY7RNyDP0RzuZiRSzYgctBOlaxXmntaaGqw6kVnqX6+/PLnkYpCMzQhLNdfYQEMJe6oFFfvx1anUfZHF1WssPuDAUyMxaD3PzM6ZgM2J/McG8d2o541ppdvIm6wzZYkv+vnubleIGJaHIKoIja0t X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 09837582-3fa4-43df-834c-08db6b847d20 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB4845.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2023 20:34:58.3962 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: jP3wmOH51E12Jgk8FfRMPQ/1OgVqnP2MrCWAehfhZfg6AyjToyzEBe3X31pKRpGeTvUzKDfn0NqQqu4/Qx7Rfg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7975 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Use devm_clk_get_enabled in probe code to reduce error checks, thereby enhancing readability Signed-off-by: Frank Li --- drivers/dma/fsl-edma-main.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c index a0e54ca4893c..503e5ad5a8dd 100644 --- a/drivers/dma/fsl-edma-main.c +++ b/drivers/dma/fsl-edma-main.c @@ -266,17 +266,11 @@ static int fsl_edma_probe(struct platform_device *pdev) regs = &fsl_edma->regs; if (drvdata->flags & FSL_EDMA_DRV_HAS_DMACLK) { - fsl_edma->dmaclk = devm_clk_get(&pdev->dev, "dma"); + fsl_edma->dmaclk = devm_clk_get_enabled(&pdev->dev, "dma"); if (IS_ERR(fsl_edma->dmaclk)) { dev_err(&pdev->dev, "Missing DMA block clock.\n"); return PTR_ERR(fsl_edma->dmaclk); } - - ret = clk_prepare_enable(fsl_edma->dmaclk); - if (ret) { - dev_err(&pdev->dev, "DMA clk block failed.\n"); - return ret; - } } for (i = 0; i < fsl_edma->drvdata->dmamuxs; i++) { @@ -291,19 +285,12 @@ static int fsl_edma_probe(struct platform_device *pdev) } sprintf(clkname, "dmamux%d", i); - fsl_edma->muxclk[i] = devm_clk_get(&pdev->dev, clkname); + fsl_edma->muxclk[i] = devm_clk_get_enabled(&pdev->dev, clkname); if (IS_ERR(fsl_edma->muxclk[i])) { dev_err(&pdev->dev, "Missing DMAMUX block clock.\n"); /* on error: disable all previously enabled clks */ - fsl_disable_clocks(fsl_edma, i); return PTR_ERR(fsl_edma->muxclk[i]); } - - ret = clk_prepare_enable(fsl_edma->muxclk[i]); - if (ret) - /* on error: disable all previously enabled clks */ - fsl_disable_clocks(fsl_edma, i); - } fsl_edma->big_endian = of_property_read_bool(np, "big-endian"); @@ -364,7 +351,6 @@ static int fsl_edma_probe(struct platform_device *pdev) if (ret) { dev_err(&pdev->dev, "Can't register Freescale eDMA engine. (%d)\n", ret); - fsl_disable_clocks(fsl_edma, fsl_edma->drvdata->dmamuxs); return ret; } @@ -373,7 +359,6 @@ static int fsl_edma_probe(struct platform_device *pdev) dev_err(&pdev->dev, "Can't register Freescale eDMA of_dma. (%d)\n", ret); dma_async_device_unregister(&fsl_edma->dma_dev); - fsl_disable_clocks(fsl_edma, fsl_edma->drvdata->dmamuxs); return ret; }