From patchwork Mon Aug 21 16:16:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13359652 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 3244DEE4993 for ; Mon, 21 Aug 2023 16:18:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236526AbjHUQSI (ORCPT ); Mon, 21 Aug 2023 12:18:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236523AbjHUQSH (ORCPT ); Mon, 21 Aug 2023 12:18:07 -0400 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2052.outbound.protection.outlook.com [40.107.7.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 264DC132; Mon, 21 Aug 2023 09:17:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c/b9MOne2HyZyzmb7Q01JZAriUULp3BBeGjf3hzBiXloGJeIGvJIMjzy2GDsIwhwWNZb/VRrJ2EP1N0irDtuujSEDZ4Bl7jcPEGCygdBAQwAnSsUv1DcfKryvBE35ZnN9Dp/hFhobebm/YQTc/+JxMVKrbBLqf1B7DaXg+9LPwmtq1GV91kBPZ6NioO+VVgxXQEgf6F7jg2uM98aw1RjkBgJvyJNjsUPaS7CGjkdIxMUgVm7WCpBSyOj0ZKkV/LaqzsMJtosjFa4qiIkXpkXHTROayYjzXmftFC1PgT3ntyWAgaEsXU+Ye6QfQ8bKZOePZUlq6ON/rpSmJMYXfuPyQ== 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=D1QZvP1Qd2YtDLfQYwlU1EH3Jm+4a1h3jZaVBdFog2M=; b=CLXxxdXswryDBCqGpjQu535trPRyOGopQUJOkwafX1yVKUHRE5PU/VUi5CaKNgBwI1THeHDafREad/z8top/sku766qXtZc+P8gSJjd0cQKW4iA/DKFIxSM7mz4CYC7//EVe5DR2z+gKYinrYWNzMl8ibe0B5RlTKpJSHpVk1vznZQZfWOZtyGNLqUoIR/jpYWbA83GZT9SKLN/YAtMdKuDtxDEfaWYJL+pwnJ0e5kgif4AEGwHe1WJBYXVm9Bpf1hTbFWApwQ8zdBLr/W65dg8mYqP3ERuwxTJ1AqSRgMBsNhjAVkgV6lUkipK096EAiIDrP5ZJ1jo3H9y4bilbdA== 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=D1QZvP1Qd2YtDLfQYwlU1EH3Jm+4a1h3jZaVBdFog2M=; b=sI7VqZn6sjWBw2CWhMK9lI/k0aeWnf4aNrSbHMGMZhBxONVX86+LebviegU50yCUmc4pwDsSb2WzJJQKfIcTo1yUZdoFwYO84v781DVRw7ynJVfQ4quajybMv6ilL0kWuwz9oPRHqiZ3YuG86+9Y36Wfo69PNPeg6lUGqRzak34= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by AS5PR04MB10042.eurprd04.prod.outlook.com (2603:10a6:20b:67e::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.24; Mon, 21 Aug 2023 16:16:57 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::a680:2943:82d1:6aa8]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::a680:2943:82d1:6aa8%3]) with mapi id 15.20.6699.022; Mon, 21 Aug 2023 16:16:57 +0000 From: Frank Li To: frank.li@nxp.com, vkoul@kernel.org Cc: devicetree@vger.kernel.org, dmaengine@vger.kernel.org, imx@lists.linux.dev, joy.zou@nxp.com, krzysztof.kozlowski+dt@linaro.org, linux-kernel@vger.kernel.org, peng.fan@nxp.com, robh+dt@kernel.org, shenwei.wang@nxp.com Subject: [PATCH v11 07/12] dmaengine: fsl-edma: refactor using devm_clk_get_enabled Date: Mon, 21 Aug 2023 12:16:12 -0400 Message-Id: <20230821161617.2142561-8-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230821161617.2142561-1-Frank.Li@nxp.com> References: <20230821161617.2142561-1-Frank.Li@nxp.com> X-ClientProxiedBy: BYAPR05CA0053.namprd05.prod.outlook.com (2603:10b6:a03:74::30) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AS5PR04MB10042:EE_ X-MS-Office365-Filtering-Correlation-Id: 4e77aab6-eedf-4514-5759-08dba2620a76 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +dAvC4FtvYEdqftDcHYT31XP7UB+iEUt2QMfc363J3hA3jsVJguP6wr9R50qS2v1psFlIH/lvj62COfPulO295GPERRdOgxU6NkQFAg5lxWv3khmTvkK+D+9rdtLiUTDlvaAkjWcse/G4UuP2geG3JY5cX8gIaQfu+9RqMK35JNfT9yGZYwZ7WHdCuuSBk2Ow8IPCib1fB6K5jFxJ1eRlZhxlWso1Ul7gzaUWABEq6VUKbpnctCXDg695IC8+FvgE/O9k6CWoGMFgQ1uyQogFbYwjM00DfDebWE6+4WoxDZUU1XKZLu0sXUXTKLvilYCBz7Lvf3yo1mJIYaPz8JQO7FH+vtHaVnkM76eK303EiSaHmahS1M31HSgQ7M4Z2PmXq2xhs4HBhwL0Z+40RRR5w0xe4QqNsoPrhSc2/x1s+Kz08ZFnI3QLVzTCL8bFonO5gfIx2HCLb+8HlTCH1rOaAzCRYBrlQa/LiN7AXabGCkMGqOiYcIbsvteOTJqScejdcoBy2r3tcjnEkGGkVkB9ohfqTCrE7A8qnKZMqM1l6OM/SF+xBzlYoMYNF0sZp3TGJXSp+YjRa9hn814k3EyBls0lIOdKiMt2L5gU2A++Ie7Gvv3X7cxMO4yL+4z8Otu X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB4838.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(39860400002)(346002)(396003)(136003)(376002)(451199024)(1800799009)(186009)(2906002)(52116002)(38350700002)(38100700002)(6486002)(6506007)(83380400001)(5660300002)(26005)(86362001)(8676002)(2616005)(8936002)(4326008)(316002)(6512007)(66946007)(66556008)(66476007)(478600001)(6666004)(36756003)(41300700001)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lLp7qFSpXy/ew/ADzeJuIqmdtrWwXqNzYNP6ihQRzv+OfxUKJrlJD6LLw9D6JN0o62bRueegHYG36BYqhFXI6hiKFqnXvS+EpIkvTp3hhaw5zJ+8CROogzF9Mevc6ynUlMWqXcCqUOS4709XG1lt4DvAbzYhn9jmWFVnATEFG27raDqv8vEuc8r4eyG3Yfg95Ex9cgvOuwVbTP/oeIixpSnX/Ky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9fYBoItRnom2ZO6H4nZ9HbK60LogfgnL7gv9bn81vM43ZFiE8K0wAkLy6gRKAQoEgWkJ/9oVNR58z1H/tbcoW8wsDRW9JVK4XX8lFY6Nyuh8sdthBIGrRM0VFbo9LrRm7feDDP26a9xWFcDy6JU3+L64P9puYGhkYAiBXwbZ+yXcz4aw+OjaV6NLCyiuaYn6Rh/+aCYhk3QLU/IJqK06eBcJXEm+iHDXK4428IG55g7BtqhAUVoOOM3XG4T/9i3xIPzNOIl8u8y9QWQpnWWtbg3f+EN6+DDqaSF1jhubPr9Laz4tU4vdK X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4e77aab6-eedf-4514-5759-08dba2620a76 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2023 16:16:57.1215 (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: FtaS3Xn2uD/f/iFpYtAuxh7r8qMGUnOVWMnob9d86dOhL9Iqj2eW2cn9KlL0bc5A3Yi4iAOn16VAzajBCSnkEw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS5PR04MB10042 Precedence: bulk List-ID: X-Mailing-List: dmaengine@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 c8b9f2eff111..7dfbdc89051a 100644 --- a/drivers/dma/fsl-edma-main.c +++ b/drivers/dma/fsl-edma-main.c @@ -276,17 +276,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++) { @@ -301,19 +295,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"); @@ -374,7 +361,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; } @@ -383,7 +369,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; }