From patchwork Mon Aug 21 11:47:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinjie Ruan X-Patchwork-Id: 13359350 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 B5D9CEE4996 for ; Mon, 21 Aug 2023 11:50:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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:In-Reply-To:References: List-Owner; bh=ojWhkzV7JZlFa7CqfwtUBA9namB9KL1rI9dzp9ch1+k=; b=Do0VroYT4bTvzt j28b4JcTUG0aApH9k/IqTfAWL4smeX9Hg1DhYeRQMer6XcQoFqLrvtd8p0dovSD7Pz9gmP6pFY9ed iuQTElmHLterH7mF1ke6ag8OcYNAJZx61NkMkiOK2lVAsWSx2JvTuaTXasIIcZCBVsByKm8MtP5ac DXzAowuawU7HIaxebFQznDCr3r+THU87gndG0R+bf3LN+BttxrDTKs0xjrvqLfdOhGvCz+s+BxUnA Mvzs69P/kSONGQ56yzGX3H6QtnLnwYJOMkTh1wSqur6wlapr2b7dvC9ngn5uZbLdScolBSLsdL3ih 8P6AIrpvQS+2j9XYeGPw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qY3Pp-00DuL3-37; Mon, 21 Aug 2023 11:49:49 +0000 Received: from szxga01-in.huawei.com ([45.249.212.187]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qY3Pm-00DuKW-1J for linux-arm-kernel@lists.infradead.org; Mon, 21 Aug 2023 11:49:47 +0000 Received: from kwepemi500008.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RTrK53B00ztS4R; Mon, 21 Aug 2023 19:46:01 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemi500008.china.huawei.com (7.221.188.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Mon, 21 Aug 2023 19:49:43 +0800 From: Jinjie Ruan To: , Lee Jones , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team CC: Subject: [PATCH -next RESEND] mfd: mxs-lradc: Use the devm_clk_get_enabled() helper function Date: Mon, 21 Aug 2023 19:47:19 +0800 Message-ID: <20230821114719.3002483-1-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemi500008.china.huawei.com (7.221.188.139) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230821_044946_707088_3D376056 X-CRM114-Status: GOOD ( 12.55 ) 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 With devm_clk_get_enabled() the call to clk_disable_unprepare() can be dropped from the error path and the remove callback. Signed-off-by: Jinjie Ruan --- drivers/mfd/mxs-lradc.c | 35 ++++++++--------------------------- 1 file changed, 8 insertions(+), 27 deletions(-) diff --git a/drivers/mfd/mxs-lradc.c b/drivers/mfd/mxs-lradc.c index 21f3033d6eb5..62d669ce1f7f 100644 --- a/drivers/mfd/mxs-lradc.c +++ b/drivers/mfd/mxs-lradc.c @@ -144,16 +144,10 @@ static int mxs_lradc_probe(struct platform_device *pdev) lradc->soc = (uintptr_t)of_id->data; - lradc->clk = devm_clk_get(&pdev->dev, NULL); + lradc->clk = devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(lradc->clk)) { - dev_err(dev, "Failed to get the delay unit clock\n"); - return PTR_ERR(lradc->clk); - } - - ret = clk_prepare_enable(lradc->clk); - if (ret) { dev_err(dev, "Failed to enable the delay unit clock\n"); - return ret; + return PTR_ERR(lradc->clk); } ret = of_property_read_u32(node, "fsl,lradc-touchscreen-wires", @@ -177,8 +171,7 @@ static int mxs_lradc_probe(struct platform_device *pdev) dev_err(&pdev->dev, "Unsupported number of touchscreen wires (%d)\n" , ts_wires); - ret = -EINVAL; - goto err_clk; + return -EINVAL; } } else { lradc->buffer_vchans = BUFFER_VCHANS_ALL; @@ -187,10 +180,8 @@ static int mxs_lradc_probe(struct platform_device *pdev) platform_set_drvdata(pdev, lradc); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - ret = -ENOMEM; - goto err_clk; - } + if (!res) + return -ENOMEM; switch (lradc->soc) { case IMX23_LRADC: @@ -205,15 +196,14 @@ static int mxs_lradc_probe(struct platform_device *pdev) break; default: dev_err(dev, "Unsupported SoC\n"); - ret = -ENODEV; - goto err_clk; + return -ENODEV; } ret = devm_mfd_add_devices(&pdev->dev, PLATFORM_DEVID_NONE, &cells[ADC_CELL], 1, NULL, 0, NULL); if (ret) { dev_err(&pdev->dev, "Failed to add the ADC subdevice\n"); - goto err_clk; + return ret; } if (!lradc->touchscreen_wire) @@ -224,23 +214,14 @@ static int mxs_lradc_probe(struct platform_device *pdev) if (ret) { dev_err(&pdev->dev, "Failed to add the touchscreen subdevice\n"); - goto err_clk; + return ret; } return 0; - -err_clk: - clk_disable_unprepare(lradc->clk); - - return ret; } static int mxs_lradc_remove(struct platform_device *pdev) { - struct mxs_lradc *lradc = platform_get_drvdata(pdev); - - clk_disable_unprepare(lradc->clk); - return 0; }