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: 37833 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp3299381wrt; Sat, 31 Dec 2022 03:22:34 -0800 (PST) X-Google-Smtp-Source: AMrXdXs5QExJ4vjrb6URw/4M+fgcTKuT0vI+POnhlRhU+9mfNc3OiTV3H0Re0LPcijVbrkcw5vHE X-Received: by 2002:aa7:938d:0:b0:580:b57:f7a1 with SMTP id t13-20020aa7938d000000b005800b57f7a1mr38082627pfe.18.1672485754608; Sat, 31 Dec 2022 03:22:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672485754; cv=none; d=google.com; s=arc-20160816; b=XpguH+pWwnYg5RP5aQoQlHmHbVuMOSnB7b8X9wTqSP/gg99J1lupavPNEPQCnH0DTs 5HUM8MEYgeub8MP9NC0YVfvvXZDthGaLuNtTy4/BkZTkf4Lbb1u1PSkL7MkmI3fXtgoY LcgCwLmoLNrjqECzA6Q9A01ABc6O+blGARKZDEDWRgGBNXjNSQYumwX80NrQ/LoLhT01 mZyknU5ipRnzEM55wXqtHB3cA1vqTRKUKY/lYkwT+d9vs502U0OWlk0US/+CJih8fWi2 QN7fGkUxHbicuHaExrCgPZfhvUt0TNfHZmqaW6xVa0H4/vuNQAbHz8lfhE//4juOuv+I GRUw== 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=DZS9DAvtKuZU4IzWnABGJt1u16uYGW08mvS/sSpZj2g=; b=a5SEcUEMRxSLg/675JOSDomEgKlyV7Cy+0pZu/dJ7tJ+DTkUyyR8OmBM91L9X7OAd7 stphKNYv9Eg+N2ayq2d+aUNTHp//DrulvXPhotLdDpx3lrn+PxdncAdcnUJQCKCBWi+e uNusmWIH+N2viB84DbNGImW2vCRCL115nVcZrR1iCRfntSaxI/+k2GCAXv5MHLFrCn9X vFBGwX1KuJgOKy2c5F46s8xa6OLZphqpQucdGsqcD0g+TcdcWDdPpFXyuJEqCSzwHG4j EWbeknz4HBIkcs97cRpyWGTQGlHoRkJdvSI0QPvI4epCv+7MxcS7U7Siz7ePErSUKIBO LQew== 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 r28-20020aa7989c000000b005810f268678si16676731pfl.165.2022.12.31.03.22.20; Sat, 31 Dec 2022 03:22:34 -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 S231928AbiLaLAD (ORCPT + 99 others); Sat, 31 Dec 2022 06:00:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229486AbiLaLAC (ORCPT ); Sat, 31 Dec 2022 06:00:02 -0500 Received: from smtp.smtpout.orange.fr (smtp-29.smtpout.orange.fr [80.12.242.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CDD02DED for ; Sat, 31 Dec 2022 03:00:01 -0800 (PST) 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-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=ham 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?1753728422494236372?= X-GMAIL-MSGID: =?utf-8?q?1753728422494236372?= 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;