From patchwork Sat Dec 31 08:00: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: 37813 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp3243988wrt; Sat, 31 Dec 2022 00:01:09 -0800 (PST) X-Google-Smtp-Source: AMrXdXtliDtL4WayHfxsH/X7zvhlMTQ9ZFubFbsc9o0WxIJd42mEIpJWtGThMLxE+dyaR8Vj6vKb X-Received: by 2002:a17:90a:7283:b0:225:be73:312 with SMTP id e3-20020a17090a728300b00225be730312mr30362125pjg.49.1672473668941; Sat, 31 Dec 2022 00:01:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672473668; cv=none; d=google.com; s=arc-20160816; b=tH/CYLZ6iddzQRPXT39Hfwj6CgAyVcz5IwA1LL+tXuDb0zOiiSItIzBiq6c0BW0s+V 5HihyLoaPYWJCTmuWlFhMzCwZecIQVws0Y3Z081XIbG7jQJTEif+gQAP3NBieBB6DuOd 4fVMc49UqRyWS7cf8hPiXtTK/LgvMYmu24r/ruLTJvMMVsEb8Ap2gTAlySsfhL0siuCl CeW+L4P1U0pNsfSYHFb/uM7S4HS8gd7tkjz7yvr4XGSNf1/B+iXJu4KTXpanAhnhdQhC hY0s+b30jgAogVotdxIrEzW0nB9XTMX2NVHEuqdy+6IGY1EOKKiRts4nqGs9bCoRvcHA o1Zw== 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=MFKA6NLYxtrp6ZUhH+VqbkTZZYpPvRq+q/wgn8FW5eM=; b=B4oSjTGaUyzYyl4+GBSSH0JzWjAkb6RA66LCxDixZdaoZ65i3ecsBIK3xEXOb7OOEF 504xHhzDFYKdsjHKxi9aMCeg2+L6nFU0tLc10WcxwFMudoSrmgn1keRTfO5Dauxt+8KO rJz9zDh9kiqNagD1UbawbM4Zz2G1YaBuMETpJLikwXQ/CQG+Ia0alq+ZZg/kNPybXO0Y tzi6RtdCPOdFEnyftMpgv0cbiS66fQdV5l+Ev6w7DJnbwDJJBWLSK940320K4hRRpHql QpFyz9gl17GCOloGwjzGfMTkpiRLKuA1icWQb0iQvOM9Zxc7OJXLLmAgBDuZYc+3uXzI FKaQ== 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 s16-20020a634510000000b00477cfa54894si23579901pga.300.2022.12.31.00.00.55; Sat, 31 Dec 2022 00:01:08 -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 S229563AbiLaIAi (ORCPT + 99 others); Sat, 31 Dec 2022 03:00:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229943AbiLaIAg (ORCPT ); Sat, 31 Dec 2022 03:00:36 -0500 Received: from smtp.smtpout.orange.fr (smtp-26.smtpout.orange.fr [80.12.242.26]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AAE7933F for ; Sat, 31 Dec 2022 00:00:35 -0800 (PST) Received: from pop-os.home ([86.243.100.34]) by smtp.orange.fr with ESMTPA id BWnApyjIetht4BWnBpyodI; Sat, 31 Dec 2022 09:00:33 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 31 Dec 2022 09:00:33 +0100 X-ME-IP: 86.243.100.34 From: Christophe JAILLET To: =?utf-8?q?Marek_Beh=C3=BAn?= , 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: armada_37xx: Use devm_clk_get_enabled() helper Date: Sat, 31 Dec 2022 09:00:31 +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_H3,RCVD_IN_MSPIKE_WL,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?1753715749682690360?= X-GMAIL-MSGID: =?utf-8?q?1753715749682690360?= 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/armada_37xx_wdt.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/drivers/watchdog/armada_37xx_wdt.c b/drivers/watchdog/armada_37xx_wdt.c index ac9fed1ef681..e58652939f8a 100644 --- a/drivers/watchdog/armada_37xx_wdt.c +++ b/drivers/watchdog/armada_37xx_wdt.c @@ -246,11 +246,6 @@ static const struct watchdog_ops armada_37xx_wdt_ops = { .get_timeleft = armada_37xx_wdt_get_timeleft, }; -static void armada_clk_disable_unprepare(void *data) -{ - clk_disable_unprepare(data); -} - static int armada_37xx_wdt_probe(struct platform_device *pdev) { struct armada_37xx_watchdog *dev; @@ -280,18 +275,10 @@ static int armada_37xx_wdt_probe(struct platform_device *pdev) return -ENOMEM; /* init clock */ - dev->clk = devm_clk_get(&pdev->dev, NULL); + dev->clk = devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(dev->clk)) return PTR_ERR(dev->clk); - ret = clk_prepare_enable(dev->clk); - if (ret) - return ret; - ret = devm_add_action_or_reset(&pdev->dev, - armada_clk_disable_unprepare, dev->clk); - if (ret) - return ret; - dev->clk_rate = clk_get_rate(dev->clk); if (!dev->clk_rate) return -EINVAL;