From patchwork Fri Dec 30 15:41:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 37701 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2955775wrt; Fri, 30 Dec 2022 08:01:23 -0800 (PST) X-Google-Smtp-Source: AMrXdXty55QBoT2EuTxGa8BIn48F0ei5rUMacJyDcSz/qtSwxolA8Z8wEMoBQO94ZhFI6uivOKq9 X-Received: by 2002:a05:6a00:158e:b0:581:5be0:4e2a with SMTP id u14-20020a056a00158e00b005815be04e2amr19718417pfk.31.1672416082874; Fri, 30 Dec 2022 08:01:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672416082; cv=none; d=google.com; s=arc-20160816; b=Yampk/7YOX8tQYJqKu7njvfkZCy+POr3ox0WaMw0P5QDBQxn0rRF4LgrEaNOiXKb+K lMMv+7zOiQcPJnLYG9xwpfEkc8meprBztPUTE72sTqMAm2PrqlED4IN5pz5fuefK5rL9 sHa3d5k0kgX1dgKc3RzsLRYqTo+rqacFtqUxLWJhhqW2ZnbdQHRt3B+CcR6J7/r+P3oh hJNinTw3mkFRHrSTvKWesdJlPpFZQBFardDKQQI5Ic1iQiNcgVgNu7YEOnmxuFjL7MoJ QiFLti5dTjXTGfEET1/CC4PpciMa+qZWqrxqFsYRkJzZ7GjlluK+4+uOzLyvjr75Gxsv TygA== 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=AVl6I2m/xsVvv/v68WguD+49EirIat84hFdDkt7BD8M=; b=U7J8rQamtHBecDP88i5DLfy6YEgntt346kHp8SvQEFhB2rN3iSvi4+q5bssb63xo3E idBNBa9xvVgoytvdL+UzgO/2y8cLkCEQnjelJVyG7hspX4B4hQrdeIuUgbLpz/z1WPt4 q07X/mfGZ0bOviDjsZCORzBy/ioDFwZlIM5ZYYPE7+F2VpXseeC1w6FTthls3qhecxM8 h1QnASht19q84rdWVad89jhBAejb3YnDnN8TAFZihxULFhC9y2hecKhZ9Uq7880Pu2bl ERZUlqeNT6itp7UNHHPIhw/RyXCaCDMSMkfORefVyenvYgIe5N0qHfX/ILr55zF54n/K I3xQ== 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 p12-20020a056a000a0c00b00576c9c3c4aasi24053038pfh.5.2022.12.30.08.01.10; Fri, 30 Dec 2022 08:01:22 -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 S235271AbiL3Pls (ORCPT + 99 others); Fri, 30 Dec 2022 10:41:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235278AbiL3PlK (ORCPT ); Fri, 30 Dec 2022 10:41:10 -0500 Received: from smtp.smtpout.orange.fr (smtp-23.smtpout.orange.fr [80.12.242.23]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7559F1B1EE for ; Fri, 30 Dec 2022 07:41:09 -0800 (PST) Received: from pop-os.home ([86.243.100.34]) by smtp.orange.fr with ESMTPA id BHVLpyfPcexdxBHVLp8KyJ; Fri, 30 Dec 2022 16:41:07 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Fri, 30 Dec 2022 16:41:07 +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-axi: Use devm_clk_get_enabled() helper Date: Fri, 30 Dec 2022 16:41:05 +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_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 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?1753655366148951091?= X-GMAIL-MSGID: =?utf-8?q?1753655366148951091?= 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-axi.c | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/drivers/bus/bt1-axi.c b/drivers/bus/bt1-axi.c index 70e49a6e5374..e02485270777 100644 --- a/drivers/bus/bt1-axi.c +++ b/drivers/bus/bt1-axi.c @@ -146,33 +146,14 @@ static int bt1_axi_request_rst(struct bt1_axi *axi) return ret; } -static void bt1_axi_disable_clk(void *data) -{ - struct bt1_axi *axi = data; - - clk_disable_unprepare(axi->aclk); -} - static int bt1_axi_request_clk(struct bt1_axi *axi) { - int ret; - - axi->aclk = devm_clk_get(axi->dev, "aclk"); + axi->aclk = devm_clk_get_enabled(axi->dev, "aclk"); if (IS_ERR(axi->aclk)) return dev_err_probe(axi->dev, PTR_ERR(axi->aclk), "Couldn't get AXI Interconnect clock\n"); - ret = clk_prepare_enable(axi->aclk); - if (ret) { - dev_err(axi->dev, "Couldn't enable the AXI clock\n"); - return ret; - } - - ret = devm_add_action_or_reset(axi->dev, bt1_axi_disable_clk, axi); - if (ret) - dev_err(axi->dev, "Can't add AXI clock disable action\n"); - - return ret; + return 0; } static int bt1_axi_request_irq(struct bt1_axi *axi)