From patchwork Fri Dec 30 16:36:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 37712 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2973534wrt; Fri, 30 Dec 2022 08:38:41 -0800 (PST) X-Google-Smtp-Source: AMrXdXsc98qVBrbcwP4ZxPIHcAH68jWxY8cNHP3sT1V595ZTDbnqQOPGbc1Z2+TtYAGNmpd9MHmD X-Received: by 2002:a17:906:92c4:b0:82d:e2a6:4b1e with SMTP id d4-20020a17090692c400b0082de2a64b1emr34539446ejx.47.1672418321214; Fri, 30 Dec 2022 08:38:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672418321; cv=none; d=google.com; s=arc-20160816; b=D6c+q23U2VmOrxfLLbEgDP2J9mIi2D1AeeY0Ixf00ccmYuMG9Qcrq4cBi5A+quhl+B e7FCDr72b6lRxeS/KJ/ajfdKi4XXAzscALHn3IsXPVpFCrERaNeSr80AvCwc4vVaa+b8 JpnVHJCYsnioOB0Fb+Os0bBXCWzlm7ceJvtXmRKCQ9oAAzFxxffFIQVE6GiGy6GGC9hD 76beNziYbUE8QpH4VqRgv5o+KxldlRtwDdEbzR/qFzIi1FUYOSL9Mfd+S4EVOt3m5BWh NfXyaNuYtgKifVfUV92AL06Sc4O0P+lesELXJM3+nXMmt4vZTLZSgkYFv6rD+vapMd7U kvhg== 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=fXzqNdOSauQfXsg6dJ+WYH/EBAGtr4910dNaomK94rU=; b=YV0hJlhoagIx2SoLqeiD6n4/psGPdVshVL9LDjlztcfhOJVpFgfsyiSmeZC9wy0S/v 3hum1i1ij+qu7sv3JWOnu8HryvVxC6RTQgVLUS1V4kL/L5OxBm6Nl7b10/9DeA9K0Fm+ O4jmS09h6B3eokrG7ep4g596sALTDROhRAKXLqvn+9lPf5rziNS7R4ixq1BCXQK0lOrA ZRqMF40Gvg84K/CDumtbpp5S/+FYE5ciB696EoR6DezvY7tG31gtWpRuqSxEo/rvgZgH xd2K5GeZV00iLkA+F62gYk3rfdb6ACNopiM5ndyGcHtDM3UQpcwXKKAmheXZovCcc5iF vxJg== 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 xi5-20020a170906dac500b007c1727f7c65si17402596ejb.470.2022.12.30.08.38.17; Fri, 30 Dec 2022 08:38:41 -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 S235054AbiL3Qgy (ORCPT + 99 others); Fri, 30 Dec 2022 11:36:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235239AbiL3QgZ (ORCPT ); Fri, 30 Dec 2022 11:36:25 -0500 Received: from smtp.smtpout.orange.fr (smtp-23.smtpout.orange.fr [80.12.242.23]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6241FAEE for ; Fri, 30 Dec 2022 08:36:23 -0800 (PST) Received: from pop-os.home ([86.243.100.34]) by smtp.orange.fr with ESMTPA id BIMnp9TXhPNsNBIMnp4aaY; Fri, 30 Dec 2022 17:36:22 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Fri, 30 Dec 2022 17:36:22 +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: rzn1: Use devm_clk_get_enabled() helper Date: Fri, 30 Dec 2022 17:36:20 +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_H2,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?1753657713674077642?= X-GMAIL-MSGID: =?utf-8?q?1753657713674077642?= 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/rzn1_wdt.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/drivers/watchdog/rzn1_wdt.c b/drivers/watchdog/rzn1_wdt.c index 55ab384b9965..980c1717adb5 100644 --- a/drivers/watchdog/rzn1_wdt.c +++ b/drivers/watchdog/rzn1_wdt.c @@ -98,11 +98,6 @@ static const struct watchdog_ops rzn1_wdt_ops = { .ping = rzn1_wdt_ping, }; -static void rzn1_wdt_clk_disable_unprepare(void *data) -{ - clk_disable_unprepare(data); -} - static int rzn1_wdt_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -132,23 +127,12 @@ static int rzn1_wdt_probe(struct platform_device *pdev) return ret; } - clk = devm_clk_get(dev, NULL); + clk = devm_clk_get_enabled(dev, NULL); if (IS_ERR(clk)) { dev_err(dev, "failed to get the clock\n"); return PTR_ERR(clk); } - ret = clk_prepare_enable(clk); - if (ret) { - dev_err(dev, "failed to prepare/enable the clock\n"); - return ret; - } - - ret = devm_add_action_or_reset(dev, rzn1_wdt_clk_disable_unprepare, - clk); - if (ret) - return ret; - clk_rate = clk_get_rate(clk); if (!clk_rate) { dev_err(dev, "failed to get the clock rate\n");