From patchwork Sat Dec 31 12:34:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 37838 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp3323917wrt; Sat, 31 Dec 2022 04:41:04 -0800 (PST) X-Google-Smtp-Source: AMrXdXu6hLD9jF4c3GFRLh29JcxqswZULBbfF7nk7MYxpEujp/Ek1ntSo2MpXSvgA4facvTfL9R5 X-Received: by 2002:a17:906:12c7:b0:7c1:639:6b42 with SMTP id l7-20020a17090612c700b007c106396b42mr36185248ejb.62.1672490464166; Sat, 31 Dec 2022 04:41:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672490464; cv=none; d=google.com; s=arc-20160816; b=yse3qAY7jEGUPBpJFUI1Cdm4wV3eTz92Xb0OFDjWArk3Ep3JG6h5aSg6OdtNUtPal0 okyzK5OQuN2PZxhjLxTVTQzSSjkjSZLVHem+O/jFd4NI5/PT4JNuQJnn59d/co/waklX 9Ct169ced6VFwtWze2KHaPuNxWRsoMcMGgXLyH8XEYK/FB4YFoCE2QvpVwJeNYJbiqY1 c7ZsfsHIqg5AWxjLmALUn4bEe418RsNJ3cippy6Rf/8M7vf+PDj6pXqrnAptdtQTx48A BU5ID/4UyJgzdGWD/2UqrAcC443AUyL6G3aaChvJYwIkxJvWXMr/mXb7CD/oH9EEGhc9 4n7A== 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=DfDzHyEdjjLukJEYIuUCEM+OSolsD2qxr7i1c0j7AZI=; b=daJK0i55aMI95EBUQBR9TgGzeEnf6hveJEqXXMk+ZBtOmuFaQAam1xC42c2xENdY8o CtMijuncHbIZaPk9tge72dwHozfFhvjI+l2vmQxoRM9ciuqCQpyrM7C6Eww0wULm86fc x9ecwvENxYcQxzQppE2AtErf+TfuM8zea+f1MlM6MQjQzknkrEVjTLaz8Rk5pMjjk/I7 KIVxa5uwbe8q2BEkCS+OzXUJRQyi6tACfUjIYnGMQkC+SwRGZ2CzHjWO0dd01VFEKux6 /sgj+yhdijfLUsRsagLClNtp6nseAX60zUzKTvH3B80glrX8wDvkv+QXEfeZG0PQrSdv tLsQ== 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 cw15-20020a170906478f00b007ad943d0608si21101086ejc.630.2022.12.31.04.40.37; Sat, 31 Dec 2022 04:41:04 -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 S229755AbiLaMfD (ORCPT + 99 others); Sat, 31 Dec 2022 07:35:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229842AbiLaMfB (ORCPT ); Sat, 31 Dec 2022 07:35:01 -0500 Received: from smtp.smtpout.orange.fr (smtp-25.smtpout.orange.fr [80.12.242.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D05C638E for ; Sat, 31 Dec 2022 04:34:59 -0800 (PST) Received: from pop-os.home ([86.243.100.34]) by smtp.orange.fr with ESMTPA id Bb4Yp03tAtht4Bb4YpzGXL; Sat, 31 Dec 2022 13:34:58 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 31 Dec 2022 13:34:58 +0100 X-ME-IP: 86.243.100.34 From: Christophe JAILLET To: Wim Van Sebroeck , Guenter Roeck , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-watchdog@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org Subject: [PATCH] watchdog: meson_gxbb: Use devm_clk_get_enabled() helper Date: Sat, 31 Dec 2022 13:34:44 +0100 Message-Id: <6c5948373d309408095c1a098b7b4c491c5265f7.1672490071.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?1753733360769153210?= X-GMAIL-MSGID: =?utf-8?q?1753733360769153210?= 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 Reviewed-by: Martin Blumenstingl --- drivers/watchdog/meson_gxbb_wdt.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/drivers/watchdog/meson_gxbb_wdt.c b/drivers/watchdog/meson_gxbb_wdt.c index 981a2f7c3bec..35d80cb39856 100644 --- a/drivers/watchdog/meson_gxbb_wdt.c +++ b/drivers/watchdog/meson_gxbb_wdt.c @@ -146,16 +146,10 @@ static const struct of_device_id meson_gxbb_wdt_dt_ids[] = { }; MODULE_DEVICE_TABLE(of, meson_gxbb_wdt_dt_ids); -static void meson_clk_disable_unprepare(void *data) -{ - clk_disable_unprepare(data); -} - static int meson_gxbb_wdt_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct meson_gxbb_wdt *data; - int ret; u32 ctrl_reg; data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); @@ -166,18 +160,10 @@ static int meson_gxbb_wdt_probe(struct platform_device *pdev) if (IS_ERR(data->reg_base)) return PTR_ERR(data->reg_base); - data->clk = devm_clk_get(dev, NULL); + data->clk = devm_clk_get_enabled(dev, NULL); if (IS_ERR(data->clk)) return PTR_ERR(data->clk); - ret = clk_prepare_enable(data->clk); - if (ret) - return ret; - ret = devm_add_action_or_reset(dev, meson_clk_disable_unprepare, - data->clk); - if (ret) - return ret; - platform_set_drvdata(pdev, data); data->wdt_dev.parent = dev;