From patchwork Sat Dec 31 10:59:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 13086026 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 68F8FC3DA7A for ; Sat, 31 Dec 2022 11:02:21 +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=rnFfZO7p+CPLktpLyEgtc5WKF1huRl1SDBtoW31uhsM=; b=lYj94CrLiiM1Mr tdBNYp26ge5HjQ5iwzC8AA81J9eseMFBAzMSIvO42/McGA49ZFdJnKtidXwaDDcPgrXgYUZCz4tWR pjhwWt6KpQH3nHOud68rAH5nw2MO8hpAysFdAEW590OwslPZurWeVuYX74VbPGXZkD0OjrpaWHJoa 4hnAtTM42QtDva8aUvHcjQlILuDJdYtHCBd0GEQYzQcrivkFreAPEN6/dkpFKvGaKb15lo5c26zYu k0ZlIofZlzDEYfqxGRgVZzeDK/x7JqchEoHoYwxi9JPSpj+zVRdDc/d7meyVqw1DT9S0lmGV2jMNK D51wmKqsHxDId1AiqMTw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pBZbi-004AYC-Do; Sat, 31 Dec 2022 11:00:55 +0000 Received: from smtp-29.smtpout.orange.fr ([80.12.242.29] helo=smtp.smtpout.orange.fr) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pBZav-004A1U-74 for linux-arm-kernel@lists.infradead.org; Sat, 31 Dec 2022 11:00:08 +0000 Received: from pop-os.home ([86.243.100.34]) by smtp.orange.fr with ESMTPA id BZaopo5C5STJGBZaop4F8P; Sat, 31 Dec 2022 11:59:59 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 31 Dec 2022 11:59:59 +0100 X-ME-IP: 86.243.100.34 From: Christophe JAILLET To: Wim Van Sebroeck , Guenter Roeck , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-watchdog@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] watchdog: imx7ulp: Use devm_clk_get_enabled() helper Date: Sat, 31 Dec 2022 11:59:57 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221231_030005_474812_81322465 X-CRM114-Status: UNSURE ( 9.17 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The devm_clk_get_enabled() helper: - calls devm_clk_get() - calls clk_prepare_enable() and registers what is needed in order to call clk_disable_unprepare() when needed, as a managed resource. This simplifies the code and avoids the need of a dedicated function used with devm_add_action_or_reset(). Signed-off-by: Christophe JAILLET Reviewed-by: Guenter Roeck --- drivers/watchdog/imx7ulp_wdt.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/drivers/watchdog/imx7ulp_wdt.c b/drivers/watchdog/imx7ulp_wdt.c index 2897902090b3..7ca486794ba7 100644 --- a/drivers/watchdog/imx7ulp_wdt.c +++ b/drivers/watchdog/imx7ulp_wdt.c @@ -299,11 +299,6 @@ static int imx7ulp_wdt_init(struct imx7ulp_wdt_device *wdt, unsigned int timeout return ret; } -static void imx7ulp_wdt_action(void *data) -{ - clk_disable_unprepare(data); -} - static int imx7ulp_wdt_probe(struct platform_device *pdev) { struct imx7ulp_wdt_device *imx7ulp_wdt; @@ -321,7 +316,7 @@ static int imx7ulp_wdt_probe(struct platform_device *pdev) if (IS_ERR(imx7ulp_wdt->base)) return PTR_ERR(imx7ulp_wdt->base); - imx7ulp_wdt->clk = devm_clk_get(dev, NULL); + imx7ulp_wdt->clk = devm_clk_get_enabled(dev, NULL); if (IS_ERR(imx7ulp_wdt->clk)) { dev_err(dev, "Failed to get watchdog clock\n"); return PTR_ERR(imx7ulp_wdt->clk); @@ -336,14 +331,6 @@ static int imx7ulp_wdt_probe(struct platform_device *pdev) dev_info(dev, "imx7ulp wdt probe\n"); } - ret = clk_prepare_enable(imx7ulp_wdt->clk); - if (ret) - return ret; - - ret = devm_add_action_or_reset(dev, imx7ulp_wdt_action, imx7ulp_wdt->clk); - if (ret) - return ret; - wdog = &imx7ulp_wdt->wdd; wdog->info = &imx7ulp_wdt_info; wdog->ops = &imx7ulp_wdt_ops;