From patchwork Fri Dec 30 15:34:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 37687 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2946194wrt; Fri, 30 Dec 2022 07:36:55 -0800 (PST) X-Google-Smtp-Source: AMrXdXuPOLj2z7ZT3aVO0K63CpDJm+iJbpQuhvHky561K4u2MJqiYyNXjl/iVMy5twsxpIFsC7Tx X-Received: by 2002:a17:902:e543:b0:189:a6b4:91ed with SMTP id n3-20020a170902e54300b00189a6b491edmr49001475plf.17.1672414615115; Fri, 30 Dec 2022 07:36:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672414615; cv=none; d=google.com; s=arc-20160816; b=xcAS0MF6ISvgDvQ5vPxXQsQ+5J35ckf8XGJfCsTM+wf3Ry5ybwZyx2iQPENGBdqYbB WHylB8DOXyFn18SytkPsLc9K+1dUX9JhQaf8uwCMDjGw84EfuM+7p3wLqCKa/DKSJrRU cAYTSw0FMVrXqRJ2LeOdlw9/ttgof9TLgdi7aW32+c1GDnh2LMy8ngBwgHjVx/LIXPGH OyeNmqHbIJmXxFOPhu2Jpj4xmzbRkIV4QftYeJHPATSgu++L/hnDRybdHI45Dfy7CB2E DYjrZL945QWbSZ6lazv0gGLMv0j+e8JGgFZZKyi/WD6KB5EFUMD2rAd/FxDOwUHAqTCe VKUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :message-id:date:subject:cc:from; bh=BnfSz75enxjPqKeHUnsdwRkH17cRVf1x33vIjNloXT4=; b=0oXU9+174czFz1g9ceujgeaAzPtCzItpNZ8hsLklBIWSoPF//L+mOMx41o6JOeubc9 LPJhAQ1FzDHKpjsSCKzbGJlqqGaahTxeBjdAkY7tmQjIpNPyLb/9Yer/WnxTYEyRasmg ych1bfvS0IoQt7Mb/R/uPrQcaALsPDRckydnhU1GeN5UCq5faokP5sB/BwiPWL5Z6GID h9+9muynEPZPmC5A1ic0RwqlNSfn8HvnBYZxupb272VcqwJtVHv1X/YjoS3RXYn38QyB TkTI70eRC0NEdHUEvOzyfdhpEjAaaXUMc/RazhojidtYzmvWl39uVk9UMxkGscDy8Jze Wgbg== 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 jf2-20020a170903268200b0017841de491fsi13370119plb.361.2022.12.30.07.36.42; Fri, 30 Dec 2022 07:36:55 -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 S235148AbiL3Peo (ORCPT + 99 others); Fri, 30 Dec 2022 10:34:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235145AbiL3Pei (ORCPT ); Fri, 30 Dec 2022 10:34:38 -0500 Received: from smtp.smtpout.orange.fr (smtp-30.smtpout.orange.fr [80.12.242.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0BC5B841 for ; Fri, 30 Dec 2022 07:34:37 -0800 (PST) Received: from pop-os.home ([86.243.100.34]) by smtp.orange.fr with ESMTPA id BHP1pigEwSTJGBHP1p2nrE; Fri, 30 Dec 2022 16:34:36 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Fri, 30 Dec 2022 16:34:36 +0100 X-ME-IP: 86.243.100.34 From: Christophe JAILLET Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH] bus: bt1-apb: Use devm_clk_get_enabled() helper Date: Fri, 30 Dec 2022 16:34:34 +0100 Message-Id: <206396623f7a9c475c915896c3990bee2d3384dd.1672414440.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 To: unlisted-recipients:; (no To-header on input) 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?1753653827648729733?= X-GMAIL-MSGID: =?utf-8?q?1753653827648729733?= 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 --- drivers/bus/bt1-apb.c | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/drivers/bus/bt1-apb.c b/drivers/bus/bt1-apb.c index 63b1b4a76671..9ed8d10c489b 100644 --- a/drivers/bus/bt1-apb.c +++ b/drivers/bus/bt1-apb.c @@ -186,34 +186,13 @@ static int bt1_apb_request_rst(struct bt1_apb *apb) return ret; } -static void bt1_apb_disable_clk(void *data) -{ - struct bt1_apb *apb = data; - - clk_disable_unprepare(apb->pclk); -} - static int bt1_apb_request_clk(struct bt1_apb *apb) { - int ret; - - apb->pclk = devm_clk_get(apb->dev, "pclk"); + apb->pclk = devm_clk_get_enabled(apb->dev, "pclk"); if (IS_ERR(apb->pclk)) return dev_err_probe(apb->dev, PTR_ERR(apb->pclk), "Couldn't get APB clock descriptor\n"); - ret = clk_prepare_enable(apb->pclk); - if (ret) { - dev_err(apb->dev, "Couldn't enable the APB clock\n"); - return ret; - } - - ret = devm_add_action_or_reset(apb->dev, bt1_apb_disable_clk, apb); - if (ret) { - dev_err(apb->dev, "Can't add APB EHB clocks disable action\n"); - return ret; - } - apb->rate = clk_get_rate(apb->pclk); if (!apb->rate) { dev_err(apb->dev, "Invalid clock rate\n");