From patchwork Sat Dec 31 10:37:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 37820 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp3288840wrt; Sat, 31 Dec 2022 02:48:27 -0800 (PST) X-Google-Smtp-Source: AMrXdXtDDe4qkKoZLN7vebXonr2mGYAhyk3d4bCnBYN4grZ1IKpJ8v90t+5PChL4PPuX7O8jYoYH X-Received: by 2002:a17:906:f84d:b0:7c1:28a7:f79b with SMTP id ks13-20020a170906f84d00b007c128a7f79bmr25310286ejb.59.1672483707634; Sat, 31 Dec 2022 02:48:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672483707; cv=none; d=google.com; s=arc-20160816; b=b+CJ2937gyzr20pfqEbhizBf+eAgjvqbUdfK6frkRm1cQuhRicH2rO8DtlqA+W/mKr 3DiQOxDyte07VHN7QfnL1+npvnEX1fut3jjOp93byP6jRdOUZjrg8luvGDB8VL33Fu/1 8EiVWpCuTGxwLmAsy+S3XrJUyZwWO8nfCXjHVp8vTzrkiurt8w7G/6LX4Iuva0rqiKW9 f4smDI7MSTMMi3GJfpON8/qGm/VMBasAxvK1uHM68F3cX/S0YMZlB3GvxoBGgIGTMiRJ HASyYAXfnxUyUpBDn2k7vHVksGVlx2DoFAf5itbZuo8c8RL2ckbYCxtDJdHsCeDNqjuC 97Ew== 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=rUmyKnG04Qx1FqpnaCrgNOEDbLNy35tJxVCrsbyk4zY=; b=1FZYZk5+Xqo0/d9Rx6VKR73OIUIfAjaxrUUT1ThhtBIpG8d/A8ElamY7UKQGA6Xlr3 BZHdBPhxKrTAAfzn+oXDGvQ0TwTC0EOck8aCPfrZhjswm4nTwT4TXiXP2DEb6u+9jSdh ybE5GdAYqkThwnv5FoCfVPL5+wPrpveaX/RSEroQ8NKnhd/Xst9bXmAIeNsUCcBq9RNf c6jJSog7oe3R+Wo7giBBk8x/hYPSTKeGduXNhyUzJdzFv4b9nBcPvYvpfVVFM/uapahT iikT7QYvVaKOfFzho5fbIDiuAAnrgfTGrQYWIcRAsCtyPjWSgoltovSs9yw8/KcewG2T 3k9A== 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 gs16-20020a1709072d1000b007c4f6c37193si20999626ejc.223.2022.12.31.02.48.02; Sat, 31 Dec 2022 02:48:27 -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 S231539AbiLaKhs (ORCPT + 99 others); Sat, 31 Dec 2022 05:37:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229486AbiLaKhp (ORCPT ); Sat, 31 Dec 2022 05:37:45 -0500 Received: from smtp.smtpout.orange.fr (smtp-23.smtpout.orange.fr [80.12.242.23]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5804DB7DE for ; Sat, 31 Dec 2022 02:37:43 -0800 (PST) Received: from pop-os.home ([86.243.100.34]) by smtp.orange.fr with ESMTPA id BZFEpDf5DPNsNBZFEp5YB1; Sat, 31 Dec 2022 11:37:41 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 31 Dec 2022 11:37:41 +0100 X-ME-IP: 86.243.100.34 From: Christophe JAILLET To: Wim Van Sebroeck , Guenter Roeck Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-watchdog@vger.kernel.org Subject: [PATCH] watchdog: davinci: Use devm_clk_get_enabled() helper Date: Sat, 31 Dec 2022 11:37:39 +0100 Message-Id: <6a4cf8e8b9d8f555c77395ba2ecadc205553774d.1672483046.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_H2,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?1753726276062548525?= X-GMAIL-MSGID: =?utf-8?q?1753726276062548525?= 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/davinci_wdt.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/drivers/watchdog/davinci_wdt.c b/drivers/watchdog/davinci_wdt.c index 584a56893b81..5f2184bda7b2 100644 --- a/drivers/watchdog/davinci_wdt.c +++ b/drivers/watchdog/davinci_wdt.c @@ -189,14 +189,8 @@ static const struct watchdog_ops davinci_wdt_ops = { .restart = davinci_wdt_restart, }; -static void davinci_clk_disable_unprepare(void *data) -{ - clk_disable_unprepare(data); -} - static int davinci_wdt_probe(struct platform_device *pdev) { - int ret = 0; struct device *dev = &pdev->dev; struct watchdog_device *wdd; struct davinci_wdt_device *davinci_wdt; @@ -205,21 +199,11 @@ static int davinci_wdt_probe(struct platform_device *pdev) if (!davinci_wdt) return -ENOMEM; - davinci_wdt->clk = devm_clk_get(dev, NULL); + davinci_wdt->clk = devm_clk_get_enabled(dev, NULL); if (IS_ERR(davinci_wdt->clk)) return dev_err_probe(dev, PTR_ERR(davinci_wdt->clk), "failed to get clock node\n"); - ret = clk_prepare_enable(davinci_wdt->clk); - if (ret) { - dev_err(dev, "failed to prepare clock\n"); - return ret; - } - ret = devm_add_action_or_reset(dev, davinci_clk_disable_unprepare, - davinci_wdt->clk); - if (ret) - return ret; - platform_set_drvdata(pdev, davinci_wdt); wdd = &davinci_wdt->wdd;