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: 37710 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2972002wrt; Fri, 30 Dec 2022 08:35:02 -0800 (PST) X-Google-Smtp-Source: AMrXdXvmoVRbEV312Ya5sCT/24gUW9LocMqxryVKVmCByb+PLvcs+ygukgWv8i+mKpQjn7hMNV+y X-Received: by 2002:a17:907:a0d0:b0:7c1:55aa:2e84 with SMTP id hw16-20020a170907a0d000b007c155aa2e84mr25417157ejc.1.1672418101917; Fri, 30 Dec 2022 08:35:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672418101; cv=none; d=google.com; s=arc-20160816; b=Z3RmcZToC81Z1Ue6I8WY32KuV+06ZrcAETisCKj0uJpHD+Yv62BpiL3Uz9w98aKATE 9eutf01zXUsgVCSelAKjtUCikijd1sM0uolUZFVwtuKlR6gc06Khol73temA8Ylpu7xP zuWfNkg6m+PDskC3liTkghD+8AadeTd0ep8JlOFUOFjmmyzTI840nv1R/aKP9Llpohj/ 8K1AlyEykzlqpoC8TUP/e9l2ef3A2qRYjkADlXBc/N69Xfnq5DxZt2rqBKdWD4h5otG5 a5LctlewlHnUI/zJa134yeacYKODqiq4G8PTpgBml5xfcVcp/xQN4WChcjD+cAz/g5dV ifFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=QoAa5kmY7JbCrxTdVbC6vWHFS65kA/KOFwOty9d6Od8=; b=DE9q/JZXAnh1QvOanuxvkjyrjL5VPWZpfZJlFoe+idfk0YYGgtLwPU+jYqUoGOwK5m 0me1Occ/51q8VJaL0/10xZOQOaFho4SnmQImhD8JODVUPyKcGeCwFqPoodvbyrpFjmKG rzm8OqUSLpFgGD7gmNuS72WUZdtZPRlXObxO2Otsvgah8gChT+FzmQ2+OHsVVjz+myuQ iEl3/0YsQnKQtK6YJIfltYQfg/elFG9FwDkizF19y5xKmrus3B1A1DEEyR3bq0e9xnhz 0NagesSjNtTunnHMe9miLjet/1zHAtBJcSz7cBf6ehimEAz3ta9HpxoLOIu25lPBb/7/ WLiw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t10-20020a056402240a00b0048b0b329f9fsi1707287eda.416.2022.12.30.08.34.36; Fri, 30 Dec 2022 08:35:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229527AbiL3QdB (ORCPT + 99 others); Fri, 30 Dec 2022 11:33:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229519AbiL3Qc7 (ORCPT ); Fri, 30 Dec 2022 11:32:59 -0500 Received: from smtp.smtpout.orange.fr (smtp-29.smtpout.orange.fr [80.12.242.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 715C41838C for ; Fri, 30 Dec 2022 08:32:53 -0800 (PST) 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-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753657483787073723?= X-GMAIL-MSGID: =?utf-8?q?1753657483787073723?= 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;