From patchwork Fri Dec 30 16:32:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 13084502 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 F12FEC4167B for ; Fri, 30 Dec 2022 19:15: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=sR1MmpIhQFBC83qzGJgk6fdZEbCvHMRVcC23EYg2JPk=; b=kOR8YKRR8ye7ML d5J6Y+25oHbIFFR5OKCPtyqaYQT3XOTap4l/nfW4+P87BjjQsdqLGs+Rocwnb6kYbS8KsPBQMv9+S DSMDw1rSOFXINoKkkKp94/fnfFycityCfIR0AcW1l8w+n/e3hU3BaevdQDHTxsOj8D+icpZkcG92z eNfoyfg+amCEq5WaiT+3yZrun24B5R90tdzvGWo/MhavCb3NlVBC9jCxSUXai7PgwCxvY5A9qlNPa 43yvd+IOiaAyDbBeendqW6ksWR8PDlpSAxFe4PkYgWpw9FnM9LqSkBi77bopSqtWsW1nbFxUQzU9b frsdOrs3BJJxPaLJRVMQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pBKpm-00CXkP-Ee; Fri, 30 Dec 2022 19:14:27 +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 1pBIJU-00B4Ou-PK for linux-arm-kernel@lists.infradead.org; Fri, 30 Dec 2022 16:32:59 +0000 Received: from pop-os.home ([86.243.100.34]) by smtp.orange.fr with ESMTPA id BIJMpP2pGRn9tBIJNpODUv; Fri, 30 Dec 2022 17:32:51 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Fri, 30 Dec 2022 17:32:51 +0100 X-ME-IP: 86.243.100.34 From: Christophe JAILLET To: Wim Van Sebroeck , Guenter Roeck , Nobuhiro Iwamatsu 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: visconti: Use devm_clk_get_enabled() helper Date: Fri, 30 Dec 2022 17:32:42 +0100 Message-Id: <13e8cdf17556da111d1d98a8fe0b1dc1c78007e2.1672417940.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-20221230_083257_015218_85E6C808 X-CRM114-Status: GOOD ( 10.34 ) 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/visconti_wdt.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/drivers/watchdog/visconti_wdt.c b/drivers/watchdog/visconti_wdt.c index 83ef55e66ca8..cef0794708e7 100644 --- a/drivers/watchdog/visconti_wdt.c +++ b/drivers/watchdog/visconti_wdt.c @@ -112,11 +112,6 @@ static const struct watchdog_ops visconti_wdt_ops = { .set_timeout = visconti_wdt_set_timeout, }; -static void visconti_clk_disable_unprepare(void *data) -{ - clk_disable_unprepare(data); -} - static int visconti_wdt_probe(struct platform_device *pdev) { struct watchdog_device *wdev; @@ -134,20 +129,10 @@ static int visconti_wdt_probe(struct platform_device *pdev) if (IS_ERR(priv->base)) return PTR_ERR(priv->base); - clk = devm_clk_get(dev, NULL); + clk = devm_clk_get_enabled(dev, NULL); if (IS_ERR(clk)) return dev_err_probe(dev, PTR_ERR(clk), "Could not get clock\n"); - ret = clk_prepare_enable(clk); - if (ret) { - dev_err(dev, "Could not enable clock\n"); - return ret; - } - - ret = devm_add_action_or_reset(dev, visconti_clk_disable_unprepare, clk); - if (ret) - return ret; - clk_freq = clk_get_rate(clk); if (!clk_freq) return -EINVAL;