From patchwork Sat Dec 31 14:25:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 37871 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp3366428wrt; Sat, 31 Dec 2022 06:28:24 -0800 (PST) X-Google-Smtp-Source: AMrXdXv6n8pIzev3HtrYiC7mVXmeFsF33hmm+P0N1sYzmvDk591UFqMPuYCRkVvcw4ngh1SRz17J X-Received: by 2002:a17:906:c18d:b0:843:770e:777d with SMTP id g13-20020a170906c18d00b00843770e777dmr28430159ejz.11.1672496904056; Sat, 31 Dec 2022 06:28:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672496904; cv=none; d=google.com; s=arc-20160816; b=fLF9SEWB+LmhIhzTVMM8fsHGq6x9tOLZeTsw/s2ttACfUawk9ZTEgdkibqwa8WVp29 enybDILrSVdPNyA+fe2UPLpyqflwxPI8HoUwJG5uwK8CR7ZosJrCE6kJJSHJCEdnJPXK cdsYWy/Zyf2BKIv8GLqhJNI1TgvK5RxxSarEn0BqJxtl2FqBTbVakOocqZ5XCTk+aAhF 90D8jznd4IqLOY4ZIsFoASYGkxscPCB+rVZwlgvqsFi+ENBw4tphwV1MGEUJVUkUT5xp 19kv3z2c9hPlLTUX6hOPussTxquJJAZyKRQrjZwkGD25B2wK5p6hU/tyf+rMTnrr0wmd dOww== 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=lnskDk7cf9IELofNEM5MxniaTchN8kb1UunnSN9a80I=; b=jQG8fX4a4foEduDOZntGY+OcUfxgfAtIJiI/x9d0BmysQDwTWU1NutrannQUS72hye cXSVKiahBrJ89subnZqPfu/yFx0xv/kNnxoCUifJn2Il+0gHfbTT40vix/o3yuJAnQgO LVzRY1cyoLSmDkwr1WCm2gEU25BmvdJV/CMUSfgpolb08orCO0B+ozHmeCDlhlxAVOG2 +YoXJGEWgZxKQ7icw3EkrJR3qwvhNtxauOZseS6yrqPGqlO8mVePhh8c0pI2xNHwtejT S5/q1QKaNodYIjVfpF/ADW4lUd7cX/rtUYUaWNPSOjQPYk3mCvSIZpm0ETbzloWIo6DD i7dw== 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 hd44-20020a17090796ac00b007ae37a89b5bsi20695333ejc.601.2022.12.31.06.28.00; Sat, 31 Dec 2022 06:28:24 -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 S229448AbiLaOZo (ORCPT + 99 others); Sat, 31 Dec 2022 09:25:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235673AbiLaOZj (ORCPT ); Sat, 31 Dec 2022 09:25:39 -0500 Received: from smtp.smtpout.orange.fr (smtp-19.smtpout.orange.fr [80.12.242.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8FA1E0E4 for ; Sat, 31 Dec 2022 06:25:35 -0800 (PST) Received: from pop-os.home ([86.243.100.34]) by smtp.orange.fr with ESMTPA id BcnlpDxYdLrOWBcnlp3Dt3; Sat, 31 Dec 2022 15:25:34 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 31 Dec 2022 15:25:34 +0100 X-ME-IP: 86.243.100.34 From: Christophe JAILLET To: Vladimir Zapolskiy , Wim Van Sebroeck , Guenter Roeck Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-arm-kernel@lists.infradead.org, linux-watchdog@vger.kernel.org Subject: [PATCH] watchdog: pnx4008: Use devm_clk_get_enabled() helper Date: Sat, 31 Dec 2022 15:25:31 +0100 Message-Id: <61f4e39db4c88408ee0149580e9aa925b784bc93.1672496714.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=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?1753740113633776872?= X-GMAIL-MSGID: =?utf-8?q?1753740113633776872?= 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/pnx4008_wdt.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/drivers/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c index e0ea133c1690..87a44a5675a1 100644 --- a/drivers/watchdog/pnx4008_wdt.c +++ b/drivers/watchdog/pnx4008_wdt.c @@ -179,11 +179,6 @@ static struct watchdog_device pnx4008_wdd = { .max_timeout = MAX_HEARTBEAT, }; -static void pnx4008_clk_disable_unprepare(void *data) -{ - clk_disable_unprepare(data); -} - static int pnx4008_wdt_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -195,18 +190,10 @@ static int pnx4008_wdt_probe(struct platform_device *pdev) if (IS_ERR(wdt_base)) return PTR_ERR(wdt_base); - wdt_clk = devm_clk_get(dev, NULL); + wdt_clk = devm_clk_get_enabled(dev, NULL); if (IS_ERR(wdt_clk)) return PTR_ERR(wdt_clk); - ret = clk_prepare_enable(wdt_clk); - if (ret) - return ret; - ret = devm_add_action_or_reset(dev, pnx4008_clk_disable_unprepare, - wdt_clk); - if (ret) - return ret; - pnx4008_wdd.bootstatus = (readl(WDTIM_RES(wdt_base)) & WDOG_RESET) ? WDIOF_CARDRESET : 0; pnx4008_wdd.parent = dev;