From patchwork Sat Dec 31 08:10:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 13085982 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 AFC55C4332F for ; Sat, 31 Dec 2022 08:11:45 +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=Un9lPAgQw4++KjDRmcHgHFiH6ia+lZzU8OksZYZ1JDc=; b=3JQehxNTNW3zvp ZXdvIzkeqWSAYXOwJetlhPQ1QTiJPBg1mjhgmphGVHh6KOnGRbr/dEfm7uLJ39bgXYI6ZJjtZSvps Q2jHyZYYrgCPHj78eE+5KT26KZZo97UL2tDGfpcMpiyo1nYgZrEcsikyQcs7EnTTvQXWUaPgP0VrP 7J539qgTaJmBew70ZXsKHl9b93XjJ3QntJ1UnP7ZpNm3jKQR4PMIiB/VtTjFRbnVqAOePb/upLMXA sOT9eGBqW6Tj1cd0iQEP992olna3c9o5RvvYF6U3f8ENeT6u7Lz/KdX87jeUSVEeKslVf1QsmoAjD tITNFXmMyuaU5LLwLRZw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pBWwx-002GIB-GD; Sat, 31 Dec 2022 08:10:39 +0000 Received: from smtp-15.smtpout.orange.fr ([80.12.242.15] helo=smtp.smtpout.orange.fr) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pBWwk-002G5k-LS for linux-arm-kernel@lists.infradead.org; Sat, 31 Dec 2022 08:10:28 +0000 Received: from pop-os.home ([86.243.100.34]) by smtp.orange.fr with ESMTPA id BWwcp2uHMTOlqBWwcpenvO; Sat, 31 Dec 2022 09:10:21 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 31 Dec 2022 09:10:21 +0100 X-ME-IP: 86.243.100.34 From: Christophe JAILLET To: Wim Van Sebroeck , Guenter Roeck , Florian Fainelli , Broadcom internal kernel review list 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: bcm7038: Use devm_clk_get_enabled() helper Date: Sat, 31 Dec 2022 09:10:17 +0100 Message-Id: <9c055911e9f557b7239000c8e6cfa0cc393a19e9.1672474203.git.christophe.jaillet@wanadoo.fr> 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_001026_894690_DC212D68 X-CRM114-Status: GOOD ( 10.79 ) 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 Acked-by: Florian Fainelli Reviewed-by: Guenter Roeck --- drivers/watchdog/bcm7038_wdt.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/drivers/watchdog/bcm7038_wdt.c b/drivers/watchdog/bcm7038_wdt.c index 9388838899ac..e038dd66b819 100644 --- a/drivers/watchdog/bcm7038_wdt.c +++ b/drivers/watchdog/bcm7038_wdt.c @@ -127,11 +127,6 @@ static const struct watchdog_ops bcm7038_wdt_ops = { .get_timeleft = bcm7038_wdt_get_timeleft, }; -static void bcm7038_clk_disable_unprepare(void *data) -{ - clk_disable_unprepare(data); -} - static int bcm7038_wdt_probe(struct platform_device *pdev) { struct bcm7038_wdt_platform_data *pdata = pdev->dev.platform_data; @@ -153,17 +148,9 @@ static int bcm7038_wdt_probe(struct platform_device *pdev) if (pdata && pdata->clk_name) clk_name = pdata->clk_name; - wdt->clk = devm_clk_get(dev, clk_name); + wdt->clk = devm_clk_get_enabled(dev, clk_name); /* If unable to get clock, use default frequency */ if (!IS_ERR(wdt->clk)) { - err = clk_prepare_enable(wdt->clk); - if (err) - return err; - err = devm_add_action_or_reset(dev, - bcm7038_clk_disable_unprepare, - wdt->clk); - if (err) - return err; wdt->rate = clk_get_rate(wdt->clk); /* Prevent divide-by-zero exception */ if (!wdt->rate)