From patchwork Fri Aug 18 07:46:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Zetao X-Patchwork-Id: 13357426 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 8AFDEC001DE for ; Fri, 18 Aug 2023 07:47:46 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=f6WNP1Ubg8rFjQSbewiPa4U2fuFtV/sXAeAGETsUpAY=; b=TXmrx09vho/SsV xBi/WlgbEB9w7McwYy8L1Wm4zVZczyHudMDi6+fRDzVA3f1Gf9Gz3HOctZZeE3Jg39drcaFBC5dza RYM2pFUxds2BSx22fErFUHehNC8lZg+stt/ZGXag9DJyb1Ca4ykTeqOwqSaPL5NvKT4NfQUTmnMkk deNPIxBe/Yy9oiffAwZfoHYXqll/vyMnDOTn7nHHMUYvrmRIZb0P5UAtAH1Y8WE6x/hdJJyteelRP 6tWwf7LRd/mjOKnt1t4qip/jldzYksvqj4hpw6izzzdqkKfA9VjrR9AIy61c6rlN7QG8ISHVxZHBE e2acSDb5pc6zho7FEiHQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qWuCZ-007uGQ-1J; Fri, 18 Aug 2023 07:47:23 +0000 Received: from szxga02-in.huawei.com ([45.249.212.188]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qWuCS-007uCN-0B; Fri, 18 Aug 2023 07:47:19 +0000 Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4RRv4j52spzNmrs; Fri, 18 Aug 2023 15:43:33 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 18 Aug 2023 15:47:04 +0800 From: Li Zetao To: Subject: [PATCH -next v2 01/12] mtd: spear_smi: Use helper function devm_clk_get_enabled() Date: Fri, 18 Aug 2023 15:46:31 +0800 Message-ID: <20230818074642.308166-2-lizetao1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230818074642.308166-1-lizetao1@huawei.com> References: <20230817024509.3951629-1-lizetao1@huawei.com> <20230818074642.308166-1-lizetao1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230818_004716_619877_981DA0BF X-CRM114-Status: UNSURE ( 9.63 ) X-CRM114-Notice: Please train this message. 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: , Cc: heiko@sntech.de, geert+renesas@glider.be, alexandre.torgue@foss.st.com, stefan@agner.ch, paul@crapouillou.net, linux-mtd@lists.infradead.org, jernej.skrabec@gmail.com, miquel.raynal@bootlin.com, jinpu.wang@ionos.com, linux-stm32@st-md-mailman.stormreply.com, vigneshr@ti.com, robh@kernel.org, samuel@sholland.org, richard@nod.at, wens@csie.org, christophe.leroy@csgroup.eu, tudor.ambarus@linaro.org, u.kleine-koenig@pengutronix.de, linux-sunxi@lists.linux.dev, frank.li@vivo.com, martin.blumenstingl@googlemail.com, yangyingliang@huawei.com, vz@mleia.com, rogerq@kernel.org, linux-mediatek@lists.infradead.org, matthias.bgg@gmail.com, michal.simek@amd.com, linux-arm-kernel@lists.infradead.org, angelogioacchino.delregno@collabora.com, philmd@linaro.org, christophe.kerello@foss.st.com, dmitry.torokhov@gmail.com, michael@walle.cc, mcoquelin.stm32@gmail.com, pratyush@kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Since commit 7ef9651e9792 ("clk: Provide new devm_clk helpers for prepared and enabled clocks"), devm_clk_get() and clk_prepare_enable() can now be replaced by devm_clk_get_enabled() when driver enable (and possibly prepare) the clocks for the whole lifetime of the device. Moreover, it is no longer necessary to unprepare and disable the clock explicitly, so drop the label "err_irq". Signed-off-by: Li Zetao --- v1 -> v2: Modify commit message. v1: https://lore.kernel.org/all/20230817024509.3951629-2-lizetao1@huawei.com/ drivers/mtd/devices/spear_smi.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/mtd/devices/spear_smi.c b/drivers/mtd/devices/spear_smi.c index 93bca5225116..0a35e5236ae5 100644 --- a/drivers/mtd/devices/spear_smi.c +++ b/drivers/mtd/devices/spear_smi.c @@ -993,21 +993,17 @@ static int spear_smi_probe(struct platform_device *pdev) dev->num_flashes = MAX_NUM_FLASH_CHIP; } - dev->clk = devm_clk_get(&pdev->dev, NULL); + dev->clk = devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(dev->clk)) { ret = PTR_ERR(dev->clk); goto err; } - ret = clk_prepare_enable(dev->clk); - if (ret) - goto err; - ret = devm_request_irq(&pdev->dev, irq, spear_smi_int_handler, 0, pdev->name, dev); if (ret) { dev_err(&dev->pdev->dev, "SMI IRQ allocation failed\n"); - goto err_irq; + goto err; } mutex_init(&dev->lock); @@ -1020,14 +1016,11 @@ static int spear_smi_probe(struct platform_device *pdev) ret = spear_smi_setup_banks(pdev, i, pdata->np[i]); if (ret) { dev_err(&dev->pdev->dev, "bank setup failed\n"); - goto err_irq; + goto err; } } return 0; - -err_irq: - clk_disable_unprepare(dev->clk); err: return ret; } @@ -1056,8 +1049,6 @@ static int spear_smi_remove(struct platform_device *pdev) WARN_ON(mtd_device_unregister(&flash->mtd)); } - clk_disable_unprepare(dev->clk); - return 0; }