From patchwork Sun Jun 11 22:56:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Shyti X-Patchwork-Id: 691547 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 39679C7EE23 for ; Sun, 11 Jun 2023 23:16:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230374AbjFKXQY (ORCPT ); Sun, 11 Jun 2023 19:16:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229455AbjFKXQX (ORCPT ); Sun, 11 Jun 2023 19:16:23 -0400 Received: from 10.mo561.mail-out.ovh.net (10.mo561.mail-out.ovh.net [87.98.165.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA63BE9 for ; Sun, 11 Jun 2023 16:16:21 -0700 (PDT) Received: from director3.ghost.mail-out.ovh.net (unknown [10.108.4.54]) by mo561.mail-out.ovh.net (Postfix) with ESMTP id D76D723FBA for ; Sun, 11 Jun 2023 22:57:55 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-5c4nf (unknown [10.111.208.12]) by director3.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 5F0961FD4F; Sun, 11 Jun 2023 22:57:55 +0000 (UTC) Received: from etezian.org ([37.59.142.109]) by ghost-submission-6684bf9d7b-5c4nf with ESMTPSA id pYXzEnNRhmT62A8AHo92QQ (envelope-from ); Sun, 11 Jun 2023 22:57:55 +0000 Authentication-Results: garm.ovh; auth=pass (GARM-109S003f65bf91f-46a1-44c3-8689-e20d3fa42f9a, CC7C3CD7EA035B6EDB7D18A077CE8F666EF926BD) smtp.auth=andi@etezian.org X-OVh-ClientIp: 93.66.31.89 From: Andi Shyti To: Linux I2C Cc: Andi Shyti , Paul Cercueil Subject: [PATCH 06/15] i2c: busses: jz4780: Use devm_clk_get_enabled() Date: Mon, 12 Jun 2023 00:56:53 +0200 Message-Id: <20230611225702.891856-7-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: 5869034741874887376 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvhedrgedufedgudehucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomheptehnughiucfuhhihthhiuceorghnughirdhshhihthhisehkvghrnhgvlhdrohhrgheqnecuggftrfgrthhtvghrnhepgfduveejteegteelhfetueetheegfeehhfektddvleehtefhheevkeduleeuueevnecukfhppeduvdejrddtrddtrddupdelfedrieeirdefuddrkeelpdefjedrheelrddugedvrddutdelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpeeorghnughisegvthgviihirghnrdhorhhgqedpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhivdgtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdfovfetjfhoshhtpehmohehiedupdhmohguvgepshhmthhpohhuth 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: Paul Cercueil --- drivers/i2c/busses/i2c-jz4780.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/drivers/i2c/busses/i2c-jz4780.c b/drivers/i2c/busses/i2c-jz4780.c index 0dfe603995214..7f21611ca3262 100644 --- a/drivers/i2c/busses/i2c-jz4780.c +++ b/drivers/i2c/busses/i2c-jz4780.c @@ -792,26 +792,21 @@ static int jz4780_i2c_probe(struct platform_device *pdev) platform_set_drvdata(pdev, i2c); - i2c->clk = devm_clk_get(&pdev->dev, NULL); + i2c->clk = devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(i2c->clk)) return PTR_ERR(i2c->clk); - ret = clk_prepare_enable(i2c->clk); - if (ret) - return ret; - ret = of_property_read_u32(pdev->dev.of_node, "clock-frequency", &clk_freq); if (ret) { dev_err(&pdev->dev, "clock-frequency not specified in DT\n"); - goto err; + return ret; } i2c->speed = clk_freq / 1000; if (i2c->speed == 0) { - ret = -EINVAL; dev_err(&pdev->dev, "clock-frequency minimum is 1000\n"); - goto err; + return -EINVAL; } jz4780_i2c_set_speed(i2c); @@ -827,22 +822,14 @@ static int jz4780_i2c_probe(struct platform_device *pdev) ret = platform_get_irq(pdev, 0); if (ret < 0) - goto err; + return ret; i2c->irq = ret; ret = devm_request_irq(&pdev->dev, i2c->irq, jz4780_i2c_irq, 0, dev_name(&pdev->dev), i2c); if (ret) - goto err; - - ret = i2c_add_adapter(&i2c->adap); - if (ret < 0) - goto err; - - return 0; + return ret; -err: - clk_disable_unprepare(i2c->clk); - return ret; + return i2c_add_adapter(&i2c->adap); } static void jz4780_i2c_remove(struct platform_device *pdev)