From patchwork Fri Dec 30 15:29:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 37684 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2944725wrt; Fri, 30 Dec 2022 07:33:21 -0800 (PST) X-Google-Smtp-Source: AMrXdXsASxCTfWWYG/HWGQoyF6uO8jrvafInejjlNiFqf9i3yb5q4568QEIerQ6VIf6Udtcyx6UE X-Received: by 2002:a17:902:f2ca:b0:189:86cd:d7c0 with SMTP id h10-20020a170902f2ca00b0018986cdd7c0mr38944707plc.18.1672414401047; Fri, 30 Dec 2022 07:33:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672414401; cv=none; d=google.com; s=arc-20160816; b=pfkfSz+0nGmmrNAQXWkiYXRPhA6MDK05NM57vrcAXZuWGyrXswcyhcyofbr4zQYhuT jXrkTk0FqAJwFyqIFRVUcBUUWv3UEIQN4UXs3BALhnaQ1gZI4z8ClIZKSBEMPCO6gT/N 3CQfVAjsWhBoS04W+ao1DV3bCfljtINeBC7TcjqUy3bsCXzPqdp0/P/94bYp/ycbKzmh HVPbjrW5R1pkamNSyW2ES6hPtF3ck3lDJ9bKESPQdG/y3Jel5XdtOTnXWtLfkGSM3ETn PtLNN1lzSwMOI0A/I1qdFPBVYyMdWyhymeXxyOh/4/fVVVe/JsGWaEXgF4WZgelNKPwO AGow== 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=1SFONQcmJF3oAZo+5Vc18IrCmwhtao0VLNuX15Nq5mc=; b=mZq7VdnaUv5VMAcy1lZbve+tfPjYowzFi0Md08dRimbXIeEjXTy0KGnqc54nYYy0Ev vGQOhc6NFvqk0tnsPVHvXtoSxotS4C5CGksOCWMDu96V7VzMNFUwuSnNsO/Y9jxrYvgH P5ISJ4V2b4dZFCUFrCfBZS2rWigOGkc0n9wuraBV3dbiBbSGlu2JGVv6CJAZagoZ1H3e xIRv+2Mc9KKY0W0iPaP6IkM478HkEtWq/4NWMUOTDycvMet9KaLERSSZXbZTgLUkdYW8 ovoiEWrE2HWJtJJaAE5gdW7uMix0z3+J5ZTbEk4XM1Xbx3SqWq/DqWXSDTt7UvgrUvPu tBeg== 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 u5-20020a17090341c500b001899f747c32si23822897ple.348.2022.12.30.07.33.06; Fri, 30 Dec 2022 07:33:21 -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 S229895AbiL3P3U (ORCPT + 99 others); Fri, 30 Dec 2022 10:29:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229489AbiL3P3S (ORCPT ); Fri, 30 Dec 2022 10:29:18 -0500 Received: from smtp.smtpout.orange.fr (smtp-11.smtpout.orange.fr [80.12.242.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AF43A449 for ; Fri, 30 Dec 2022 07:29:17 -0800 (PST) Received: from pop-os.home ([86.243.100.34]) by smtp.orange.fr with ESMTPA id BHJope39eoBUEBHJopwrqH; Fri, 30 Dec 2022 16:29:15 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Fri, 30 Dec 2022 16:29:15 +0100 X-ME-IP: 86.243.100.34 From: Christophe JAILLET To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , dri-devel@lists.freedesktop.org Subject: [PATCH] drm/bridge: tc358767: Use devm_clk_get_enabled() helper Date: Fri, 30 Dec 2022 16:29:10 +0100 Message-Id: <4f855984ea895e1488169e77935fa6e044912ac2.1672414073.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, 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?1753653603075879120?= X-GMAIL-MSGID: =?utf-8?q?1753653603075879120?= 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: Andrzej Hajda --- drivers/gpu/drm/bridge/tc358767.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index 2a58eb271f70..b95c36ca660d 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -2022,13 +2022,6 @@ static int tc_probe_bridge_endpoint(struct tc_data *tc) return -EINVAL; } -static void tc_clk_disable(void *data) -{ - struct clk *refclk = data; - - clk_disable_unprepare(refclk); -} - static int tc_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct device *dev = &client->dev; @@ -2045,21 +2038,13 @@ static int tc_probe(struct i2c_client *client, const struct i2c_device_id *id) if (ret) return ret; - tc->refclk = devm_clk_get(dev, "ref"); + tc->refclk = devm_clk_get_enabled(dev, "ref"); if (IS_ERR(tc->refclk)) { ret = PTR_ERR(tc->refclk); dev_err(dev, "Failed to get refclk: %d\n", ret); return ret; } - ret = clk_prepare_enable(tc->refclk); - if (ret) - return ret; - - ret = devm_add_action_or_reset(dev, tc_clk_disable, tc->refclk); - if (ret) - return ret; - /* tRSTW = 100 cycles , at 13 MHz that is ~7.69 us */ usleep_range(10, 15);