From patchwork Fri Dec 30 16:41: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: 37713 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2979905wrt; Fri, 30 Dec 2022 08:55:31 -0800 (PST) X-Google-Smtp-Source: AMrXdXtAtnVxY4ePVlAi+Ciw6VPcVX//ll8opbGju3tsc5UmIs9yT5HkT+z4NO4CiqKgO6VLDflG X-Received: by 2002:a05:6402:685:b0:46b:4011:9863 with SMTP id f5-20020a056402068500b0046b40119863mr27401058edy.39.1672419331262; Fri, 30 Dec 2022 08:55:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672419331; cv=none; d=google.com; s=arc-20160816; b=tLvOhqw1dMv+G8MlYypVL5GOhaQRHwxrDRyzL4FBs2cDOpXNDAXK8ktAsr9DkRJ5Gc fF4Y91QAFxtxcjxCrglWhCqiobVUFcil65WRBK935d7ezStrd3cJWOVUGM00cYC1xe+6 5WBJtzjDb1hSA0MeS/pnIVxHfObb/g15TXTv4MdyrIgu91xejl3gIt2tedZGQF6Y/xNT 722qn+Pjcas8a+HrweI/f9dR5cvLxScdDjb9YQqMB9RhLuAfbA7xfmZKSHPt4JxdojnW HzZGUXKudr4bvirMcnjmmbSFs7SGmMXmi7YdgbEgUMQc67ehYls+uNkmqgdPnI05VVVq jzKQ== 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=Z9o2hwvFfFOMfddtCb5AmgacUU4huysFtrdmkKgFLw8=; b=Jxykt1OpN1W6suYXzjeWJE+57dEP/9g6ASRV8oP6Oc9pqNBdmVt7BYnMM96pDxD2o3 bq44WNyz6SGXFO/9UazcDlMy5lX5beImiX/m/FSTJ1Nc/hxHZDaf+pIxOAMedV8M1uxf 4lyR6a4SNmvq9s5wMEO+9jUls1BWVb+sIrjBubK4ZD9HCM0IKQTtluUCmWS/Aeu71gE7 rITzy5bl16kjXTGfqtN9NliLDQQAaorCXFymDa90KWj/yE3Ak+WZSWFlYrLvRVhJAgR3 KmFjYFub94PQ2H2AJDVq/zm5WTjmSDCuj+z/N6UhUoYPsHvzYvKaCreZDwNHwKtXn0w3 UNhw== 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 b15-20020a056402350f00b0046af9fdf3f5si19492276edd.282.2022.12.30.08.55.07; Fri, 30 Dec 2022 08:55:31 -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 S231319AbiL3Qlu (ORCPT + 99 others); Fri, 30 Dec 2022 11:41:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229649AbiL3Qls (ORCPT ); Fri, 30 Dec 2022 11:41:48 -0500 Received: from smtp.smtpout.orange.fr (smtp-25.smtpout.orange.fr [80.12.242.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B29D13D49 for ; Fri, 30 Dec 2022 08:41:46 -0800 (PST) Received: from pop-os.home ([86.243.100.34]) by smtp.orange.fr with ESMTPA id BIS0pfZvxl2VFBIS0pV5zo; Fri, 30 Dec 2022 17:41:45 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Fri, 30 Dec 2022 17:41:45 +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: rtd119x: Use devm_clk_get_enabled() helper Date: Fri, 30 Dec 2022 17:41:31 +0100 Message-Id: <14b521b821279bc5111dc80b55d0936c5767c737.1672418470.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?1753658772791788479?= X-GMAIL-MSGID: =?utf-8?q?1753658772791788479?= 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/rtd119x_wdt.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/drivers/watchdog/rtd119x_wdt.c b/drivers/watchdog/rtd119x_wdt.c index 834b94ff3f90..95c8d7abce42 100644 --- a/drivers/watchdog/rtd119x_wdt.c +++ b/drivers/watchdog/rtd119x_wdt.c @@ -94,16 +94,10 @@ static const struct of_device_id rtd119x_wdt_dt_ids[] = { { } }; -static void rtd119x_clk_disable_unprepare(void *data) -{ - clk_disable_unprepare(data); -} - static int rtd119x_wdt_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct rtd119x_watchdog_device *data; - int ret; data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); if (!data) @@ -113,18 +107,10 @@ static int rtd119x_wdt_probe(struct platform_device *pdev) if (IS_ERR(data->base)) return PTR_ERR(data->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, rtd119x_clk_disable_unprepare, - data->clk); - if (ret) - return ret; - data->wdt_dev.info = &rtd119x_wdt_info; data->wdt_dev.ops = &rtd119x_wdt_ops; data->wdt_dev.timeout = 120;