From patchwork Fri Dec 30 16:49:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 37714 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2980061wrt; Fri, 30 Dec 2022 08:55:57 -0800 (PST) X-Google-Smtp-Source: AMrXdXuDFb2PYbt6EybtD7eQ/QwkgkCWL+7El/eGV+M4l8NgQ0MfjHqiYS7jrzreuhLZjjIe8d/O X-Received: by 2002:a05:6402:394:b0:46c:a1f7:d9ac with SMTP id o20-20020a056402039400b0046ca1f7d9acmr28576743edv.8.1672419356998; Fri, 30 Dec 2022 08:55:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672419356; cv=none; d=google.com; s=arc-20160816; b=NzWniMSlPo3N6cmUU1zyJH3BydPBUFAI67aRsKhMJKSQMTwnjUnTTdo9upYEsFRxr2 nINIFdHeOoqlAQtP3zgwlhXqrlD/qbuYlJFLV0U1faAzfLMRi1TrgHsxP6ei0eGZwdrU k/Uah6VfeKBy8UklwEqi1s+7RICwGbuSlD84QBrTbzgu8YHv3AEPNGdPU1c8v6OAazK9 T3saQEYq+Oj0PJsurzaZ6/zPbgfSPZhxq53OVyvjOveAzcKU4YIjvnMRjzcw+syiMuZw mHsLw0DfkCdTb5SQCUOARFxcsFOshYySkgbRxRQgVqGdgZ4KNArYrjIjNmUPAxb3Ehb6 hSCw== 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=Ssg+6QHmoccevonMlQRFok4vxRcLFqUZmiZkJcq47qE=; b=Sox9TWnIsRWGgXC2ytwICx6dvKouxqe5kGZsRegewK+6isbMNL4QzN6A1qCaFbhIy0 m0jBueNR5lue1jjvIo0WXkjU6+xWmdBkBG56Ci0cBSeyGAhVqk2ba/78p8Brn7FhP+bU m21I8uS8ZpkjlJLubMeK7XedNoeHKshsL6LoFkeCXBiCa7niJZ4M96fBViP+oixkjy+a dUtOlM0H4MT7CMAmLQNIA9TnOt/76eEC4vrmJkaP7O0KWE1Yl0xVFyPPnL0/HSRS1TF0 EIUJIg1qKajDcdS83qOTATNDvmO8IibyYRPdJq7WbxWI4ffHO1wrbD3EMmhhg1UxtUyP GIzg== 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 s20-20020aa7c554000000b00485732f1604si10007937edr.347.2022.12.30.08.55.33; Fri, 30 Dec 2022 08:55:56 -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 S229671AbiL3Qtx (ORCPT + 99 others); Fri, 30 Dec 2022 11:49:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229527AbiL3Qtv (ORCPT ); Fri, 30 Dec 2022 11:49:51 -0500 Received: from smtp.smtpout.orange.fr (smtp-18.smtpout.orange.fr [80.12.242.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A0B260D5 for ; Fri, 30 Dec 2022 08:49:51 -0800 (PST) Received: from pop-os.home ([86.243.100.34]) by smtp.orange.fr with ESMTPA id BIZopMPUH4s3dBIZop6r4L; Fri, 30 Dec 2022 17:49:49 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Fri, 30 Dec 2022 17:49:49 +0100 X-ME-IP: 86.243.100.34 From: Christophe JAILLET To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Wim Van Sebroeck , Guenter Roeck Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-arm-msm@vger.kernel.org, linux-watchdog@vger.kernel.org Subject: [PATCH] watchdog: qcom: Use devm_clk_get_enabled() helper Date: Fri, 30 Dec 2022 17:49:47 +0100 Message-Id: <7c2d5f3815949faf6d3a0237a7b5f272f00a7ae9.1672418969.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_H3,RCVD_IN_MSPIKE_WL,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?1753658799731358028?= X-GMAIL-MSGID: =?utf-8?q?1753658799731358028?= 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/qcom-wdt.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/drivers/watchdog/qcom-wdt.c b/drivers/watchdog/qcom-wdt.c index 0d2209c5eaca..d776474dcdf3 100644 --- a/drivers/watchdog/qcom-wdt.c +++ b/drivers/watchdog/qcom-wdt.c @@ -175,11 +175,6 @@ static const struct watchdog_info qcom_wdt_pt_info = { .identity = KBUILD_MODNAME, }; -static void qcom_clk_disable_unprepare(void *data) -{ - clk_disable_unprepare(data); -} - static const struct qcom_wdt_match_data match_data_apcs_tmr = { .offset = reg_offset_data_apcs_tmr, .pretimeout = false, @@ -226,21 +221,12 @@ static int qcom_wdt_probe(struct platform_device *pdev) if (IS_ERR(wdt->base)) return PTR_ERR(wdt->base); - clk = devm_clk_get(dev, NULL); + clk = devm_clk_get_enabled(dev, NULL); if (IS_ERR(clk)) { dev_err(dev, "failed to get input clock\n"); return PTR_ERR(clk); } - ret = clk_prepare_enable(clk); - if (ret) { - dev_err(dev, "failed to setup clock\n"); - return ret; - } - ret = devm_add_action_or_reset(dev, qcom_clk_disable_unprepare, clk); - if (ret) - return ret; - /* * We use the clock rate to calculate the max timeout, so ensure it's * not zero to avoid a divide-by-zero exception.