From patchwork Thu Aug 17 02:45:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Zetao X-Patchwork-Id: 13355913 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 7296FC2FC15 for ; Thu, 17 Aug 2023 02:46:05 +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=EDm1DXQAX9nMaBrVDyEFghTzUPReie6QxdNhyAYi2YA=; b=PfVhjjOA9JZILW naufi5Jy0+S/LWcEx1JSgcWve98aUaBWRsAvrrb0Vr/syQZF9PNQbQCl68Kxb47x1XneRvVEWNYQU yW5SHmvTOtVdS6tL+MalTombbe76HgA+cPb2OIDtVlzd+E3rby7hr+Fs4GLZr2vFLKBxn4/B2ulUZ uL4QRReMABJVkeQ27OMPgWsD4linJFLHOpFhEndcZ8Gcnt0+5Jypjht2JznNPzXvEQXKNmbLdV6Pa N3ecfW/+Atw74ZX6YLap5lb7fvBAhs0n4UozxIY4BejJ84HTFYG+PqxTT0khmjXStorQb7MLkfUJ7 kiTekC4FOljVZZomWLoQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qWT12-005N1W-30; Thu, 17 Aug 2023 02:45:40 +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 1qWT0y-005Mxq-2Z; Thu, 17 Aug 2023 02:45:38 +0000 Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4RR8Sq0XFRzVkPQ; Thu, 17 Aug 2023 10:43:23 +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; Thu, 17 Aug 2023 10:45:28 +0800 From: Li Zetao To: , , , , , , , , , , , , , , , , Subject: [PATCH -next 03/11] mtd: rawnand: fsmc: Use helper function devm_clk_get_enabled() Date: Thu, 17 Aug 2023 10:45:01 +0800 Message-ID: <20230817024509.3951629-4-lizetao1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230817024509.3951629-1-lizetao1@huawei.com> References: <20230817024509.3951629-1-lizetao1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) 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-20230816_194537_057939_4C3CA3B6 X-CRM114-Status: GOOD ( 11.06 ) 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: robh@kernel.org, paul@crapouillou.net, dmitry.torokhov@gmail.com, philmd@linaro.org, geert+renesas@glider.be, martin.blumenstingl@googlemail.com, yangyingliang@huawei.com, lizetao1@huawei.com, christophe.leroy@csgroup.eu, linux-sunxi@lists.linux.dev, rogerq@kernel.org, linux-mtd@lists.infradead.org, u.kleine-koenig@pengutronix.de, christophe.kerello@foss.st.com, linux-mediatek@lists.infradead.org, jinpu.wang@ionos.com, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, heiko@sntech.de Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org After the commit 7ef9651e9792 ("clk: Provide new devm_clk helpers for prepared and enabled clocks"), it can replace the pair of functions, devm_clk_get() and clk_prepare_enable() with a single helper function devm_clk_get_enabled(). Moreover, the driver will keeps a clock prepared (or enabled) during the whole lifetime of the driver, it is unnecessary to unprepare and disable clock explicitly when remove driver or in the error handling path. Signed-off-by: Li Zetao --- drivers/mtd/nand/raw/fsmc_nand.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/mtd/nand/raw/fsmc_nand.c b/drivers/mtd/nand/raw/fsmc_nand.c index 7b4742420dfc..ab1b9a5c93e9 100644 --- a/drivers/mtd/nand/raw/fsmc_nand.c +++ b/drivers/mtd/nand/raw/fsmc_nand.c @@ -1066,16 +1066,12 @@ static int __init fsmc_nand_probe(struct platform_device *pdev) host->regs_va = base + FSMC_NOR_REG_SIZE + (host->bank * FSMC_NAND_BANK_SZ); - host->clk = devm_clk_get(&pdev->dev, NULL); + host->clk = devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(host->clk)) { dev_err(&pdev->dev, "failed to fetch block clock\n"); return PTR_ERR(host->clk); } - ret = clk_prepare_enable(host->clk); - if (ret) - return ret; - /* * This device ID is actually a common AMBA ID as used on the * AMBA PrimeCell bus. However it is not a PrimeCell. @@ -1157,7 +1153,6 @@ static int __init fsmc_nand_probe(struct platform_device *pdev) dma_release_channel(host->read_dma_chan); disable_clk: fsmc_nand_disable(host); - clk_disable_unprepare(host->clk); return ret; } @@ -1182,7 +1177,6 @@ static void fsmc_nand_remove(struct platform_device *pdev) dma_release_channel(host->write_dma_chan); dma_release_channel(host->read_dma_chan); } - clk_disable_unprepare(host->clk); } }