From patchwork Sun Jun 11 22:56:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Shyti X-Patchwork-Id: 691545 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB027C7EE23 for ; Sun, 11 Jun 2023 23:36:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229573AbjFKXg0 (ORCPT ); Sun, 11 Jun 2023 19:36:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229494AbjFKXg0 (ORCPT ); Sun, 11 Jun 2023 19:36:26 -0400 Received: from 11.mo561.mail-out.ovh.net (11.mo561.mail-out.ovh.net [87.98.184.158]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 293DC193 for ; Sun, 11 Jun 2023 16:36:25 -0700 (PDT) Received: from director7.ghost.mail-out.ovh.net (unknown [10.108.16.251]) by mo561.mail-out.ovh.net (Postfix) with ESMTP id 31F4B2403E for ; Sun, 11 Jun 2023 22:58:00 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-bnf6w (unknown [10.110.171.220]) by director7.ghost.mail-out.ovh.net (Postfix) with ESMTPS id BDAB91FD53; Sun, 11 Jun 2023 22:57:59 +0000 (UTC) Received: from etezian.org ([37.59.142.109]) by ghost-submission-6684bf9d7b-bnf6w with ESMTPSA id MPyaK3dRhmTR0gAA3EbPLg (envelope-from ); Sun, 11 Jun 2023 22:57:59 +0000 Authentication-Results: garm.ovh; auth=pass (GARM-109S003c5df0168-3016-4d9a-b272-019080fd8893, CC7C3CD7EA035B6EDB7D18A077CE8F666EF926BD) smtp.auth=andi@etezian.org X-OVh-ClientIp: 93.66.31.89 From: Andi Shyti To: Linux I2C Cc: Andi Shyti , Stefan Roese , Matthias Brugger , AngeloGioacchino Del Regno Subject: [PATCH 08/15] i2c: busses: mt7621: Use devm_clk_get_enabled() Date: Mon, 12 Jun 2023 00:56:55 +0200 Message-Id: <20230611225702.891856-9-andi.shyti@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230611225702.891856-1-andi.shyti@kernel.org> References: <20230611225702.891856-1-andi.shyti@kernel.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 5870442115460303571 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvhedrgedufedgudehucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomheptehnughiucfuhhihthhiuceorghnughirdhshhihthhisehkvghrnhgvlhdrohhrgheqnecuggftrfgrthhtvghrnhepgfduveejteegteelhfetueetheegfeehhfektddvleehtefhheevkeduleeuueevnecukfhppeduvdejrddtrddtrddupdelfedrieeirdefuddrkeelpdefjedrheelrddugedvrddutdelnecuvehluhhsthgvrhfuihiivgepvdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpeeorghnughisegvthgviihirghnrdhorhhgqedpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhivdgtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdfovfetjfhoshhtpehmohehiedupdhmohguvgepshhmthhpohhuth Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Replace the pair of functions, devm_clk_get() and clk_prepare_enable(), with a single function devm_clk_get_enabled(). Signed-off-by: Andi Shyti Cc: Stefan Roese Cc: Matthias Brugger Cc: AngeloGioacchino Del Regno Reviewed-by: Matthias Brugger Reviewed-by: Stefan Roese --- drivers/i2c/busses/i2c-mt7621.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/drivers/i2c/busses/i2c-mt7621.c b/drivers/i2c/busses/i2c-mt7621.c index f9c294e2bd3c5..104bb194e9906 100644 --- a/drivers/i2c/busses/i2c-mt7621.c +++ b/drivers/i2c/busses/i2c-mt7621.c @@ -282,16 +282,11 @@ static int mtk_i2c_probe(struct platform_device *pdev) if (IS_ERR(i2c->base)) return PTR_ERR(i2c->base); - i2c->clk = devm_clk_get(&pdev->dev, NULL); + i2c->clk = devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(i2c->clk)) { - dev_err(&pdev->dev, "no clock defined\n"); + dev_err(&pdev->dev, "Failed to enable clock\n"); return PTR_ERR(i2c->clk); } - ret = clk_prepare_enable(i2c->clk); - if (ret) { - dev_err(&pdev->dev, "Unable to enable clock\n"); - return ret; - } i2c->dev = &pdev->dev; @@ -301,8 +296,7 @@ static int mtk_i2c_probe(struct platform_device *pdev) if (i2c->bus_freq == 0) { dev_warn(i2c->dev, "clock-frequency 0 not supported\n"); - ret = -EINVAL; - goto err_disable_clk; + return -EINVAL; } adap = &i2c->adap; @@ -320,23 +314,17 @@ static int mtk_i2c_probe(struct platform_device *pdev) ret = i2c_add_adapter(adap); if (ret < 0) - goto err_disable_clk; + return ret; dev_info(&pdev->dev, "clock %u kHz\n", i2c->bus_freq / 1000); return 0; - -err_disable_clk: - clk_disable_unprepare(i2c->clk); - - return ret; } static void mtk_i2c_remove(struct platform_device *pdev) { struct mtk_i2c *i2c = platform_get_drvdata(pdev); - clk_disable_unprepare(i2c->clk); i2c_del_adapter(&i2c->adap); }