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: 13086034 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 78DCBC3DA7A for ; Sat, 31 Dec 2022 12:36:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=4I5B4euSCa4MFUgWWiXvU4HUqaCf7Hk1RH7GZqqCHTk=; b=BQN6au60pK6NNp A+Gl+B4z64ZY1ticA8wlQgpMr3CUANA3EGaCTZRm+JUeZ4a2oYcVZZ6NnvCsH4ZZiGjyKLXenDM+S knNu/9BA9JRSr0e92gsjfRMkCxQjsrbYKA6LnV7i89aPZI2GlQj4GuFtClSe8ZyMGyaV4f1//SVR8 FY44wP3Jx+CnA2a5sl/gS1wn0L1Hgaay6VGX7eXyf9i47XMWwRJxSW4aJcK7ohItDJqvuYqFvUewL CMYcprL3SQpuRbxiMYnkEM85OByia4lfBXisbsfs7U1W2TsH7XcwmFHU4ZPew6OTZ8ygJDm7uAixv jbfJYKYnK2JwAFlvAOOQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pBb5P-005FkC-JA; Sat, 31 Dec 2022 12:35:39 +0000 Received: from smtp-25.smtpout.orange.fr ([80.12.242.25] helo=smtp.smtpout.orange.fr) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pBb4o-005FJX-Dn for linux-amlogic@lists.infradead.org; Sat, 31 Dec 2022 12:35:04 +0000 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221231_043502_655251_CE7F2B57 X-CRM114-Status: UNSURE ( 9.72 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org 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;