From patchwork Fri Aug 18 07:46:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Zetao X-Patchwork-Id: 13357427 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 BEDE0C05052 for ; Fri, 18 Aug 2023 07:47:59 +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=x9D/ouoG4okTExrC9DCrc3x/XCByqRCYQSM+EtK0gZo=; b=eqDDaR/t+xgwAN Qje212gv/gfebAEi9tHH+NT+PcFoFDE/AOKUE8Uz6N2C9/8jXpzBFoO19wSMkzyXJCbQKJoqQujsP tJb0+nN6piXfE5mfKlds/1f3LDeW7hHkpGEAwGsUdSb1vHBVpH9KxCsjpxKeUE6nCLbSy6kxfPrfx 51Urmaypxizvc6TIGOeZsIO388czcUMMsTf//Mmpm5OUbv+X0UM0N9Vy4E+5wfDBecDrwmUJ7VNqL QpFVEGqSyNT+2f7Pzj+sky9m0qyIqgHc4/ZVe1tT3bvkSdO/GhYn1ph6pPtQ0Ka49qYncNyXn46an kywMN7C2LU87fmaHVAJg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qWuCn-007uKf-12; Fri, 18 Aug 2023 07:47:37 +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 1qWuCT-007uCy-1d; Fri, 18 Aug 2023 07:47:21 +0000 Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4RRv6V3bYMzVkJ0; Fri, 18 Aug 2023 15:45:06 +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:13 +0800 From: Li Zetao To: Subject: [PATCH -next v2 08/12] mtd: rawnand: stm32_fmc2: Use helper function devm_clk_get_enabled() Date: Fri, 18 Aug 2023 15:46:38 +0800 Message-ID: <20230818074642.308166-9-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_004718_007508_D355FEE7 X-CRM114-Status: GOOD ( 10.47 ) 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_clk_disable". Signed-off-by: Li Zetao --- v1 -> v2: Modify commit message. v1: https://lore.kernel.org/all/20230817024509.3951629-9-lizetao1@huawei.com/ drivers/mtd/nand/raw/stm32_fmc2_nand.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/drivers/mtd/nand/raw/stm32_fmc2_nand.c b/drivers/mtd/nand/raw/stm32_fmc2_nand.c index 2f9e43f64dd7..88811139aaf5 100644 --- a/drivers/mtd/nand/raw/stm32_fmc2_nand.c +++ b/drivers/mtd/nand/raw/stm32_fmc2_nand.c @@ -1951,21 +1951,17 @@ static int stm32_fmc2_nfc_probe(struct platform_device *pdev) init_completion(&nfc->complete); - nfc->clk = devm_clk_get(nfc->cdev, NULL); - if (IS_ERR(nfc->clk)) + nfc->clk = devm_clk_get_enabled(nfc->cdev, NULL); + if (IS_ERR(nfc->clk)) { + dev_err(dev, "can not get and enable the clock\n"); return PTR_ERR(nfc->clk); - - ret = clk_prepare_enable(nfc->clk); - if (ret) { - dev_err(dev, "can not enable the clock\n"); - return ret; } rstc = devm_reset_control_get(dev, NULL); if (IS_ERR(rstc)) { ret = PTR_ERR(rstc); if (ret == -EPROBE_DEFER) - goto err_clk_disable; + return ret; } else { reset_control_assert(rstc); reset_control_deassert(rstc); @@ -2018,9 +2014,6 @@ static int stm32_fmc2_nfc_probe(struct platform_device *pdev) sg_free_table(&nfc->dma_data_sg); sg_free_table(&nfc->dma_ecc_sg); -err_clk_disable: - clk_disable_unprepare(nfc->clk); - return ret; } @@ -2045,8 +2038,6 @@ static void stm32_fmc2_nfc_remove(struct platform_device *pdev) sg_free_table(&nfc->dma_data_sg); sg_free_table(&nfc->dma_ecc_sg); - clk_disable_unprepare(nfc->clk); - stm32_fmc2_nfc_wp_enable(nand); }