From patchwork Mon May 10 17:41:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 12249193 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B15E1C433B4 for ; Mon, 10 May 2021 18:01:38 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 373A161007 for ; Mon, 10 May 2021 18:01:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 373A161007 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=nRqpN65zhSLZboL2UfK13GYWK4TBv90LXvsuiF8CU3Q=; b=H9WXA+S65eghcsrD09JKmAuwp 7cfRFTY9F402Q4h3VMpvNx2Wc6mHkoScrqTfBNH1h56IbQuVpcZmY+U9w/u6cypPmpv0mC3Msi1n8 Ozx+MpiJb1ftaYCokdtTRrawcHC8iiHvk5MfPVBaDgrmJMPUkT8KqmpZYrNdFZRCXiO9Eh51ThGoP dbgjPHMRJG/dC7D0/RpteCl3Z3F4XMiMuGNJGMjX/fI+pJjrWjiqwnSNtNdZ2biA5yFZjhxCcJ/5A a5CL7J3KolCdU4H5rSqgzB1SsyVZkZqId1O5qYDfSgJBC6zSZ5d2zJe6HxcGM5EzVZH3i7ee4m/Ce 2HLgFtI2Q==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lgAC4-00FKNt-RX; Mon, 10 May 2021 17:59:50 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lg9ur-00FE2G-1V for linux-arm-kernel@desiato.infradead.org; Mon, 10 May 2021 17:42:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=Y545gijG+yRq1DyxXbtuXWl7DbS0FKLxdwefV9rRhQY=; b=HIzTPh8Dv4EN5JWYn68esP2NNu +bu20FMqy9HjnUnuXDs4GcE01eqVeHTFhB79ggQz29AKboiMd3TGeUaCXR2FWTHn0BKk3cOc14cE5 hq3mE4IBV7hgvrKHoStR5y03tmRa1RLeTYaCpWIVG3Qu8VOitP14PPA0OKLnIWB01zj5/I43wxqAc aDquPoQklx/ADFGs32ysodMC2oaJ1d/laczM9kipc/rNOSkBxD1GFsaGMGa3XwSk4ZaFG/UPVXQlQ Q1zxL4QK+gwNqqrnK8Lib+Lmh3EIxE+gsRKg9Pma3KjuYZqQP5th4N4n1gtY2b2zuUzxa2HRFUq3A cXZrY3xA==; Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lg9uo-008zkL-BZ for linux-arm-kernel@lists.infradead.org; Mon, 10 May 2021 17:41:59 +0000 Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lg9uh-0005HN-92; Mon, 10 May 2021 19:41:51 +0200 Received: from ukl by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1lg9ug-0006af-AM; Mon, 10 May 2021 19:41:50 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Michael Turquette , Stephen Boyd , Oleksij Rempel , Shawn Guo , Sascha Hauer Cc: linux-clk@vger.kernel.org, Jonathan Cameron , Alexandru Ardelean , Andrew Morton , kernel@pengutronix.de, Fabio Estevam , NXP Linux Team , linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Wolfram Sang , Oleksij Rempel Subject: [PATCH v7 5/6] i2c: imx: Simplify using devm_clk_get_enabled() Date: Mon, 10 May 2021 19:41:41 +0200 Message-Id: <20210510174142.986250-6-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210510174142.986250-1-u.kleine-koenig@pengutronix.de> References: <20210510174142.986250-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210510_104158_415090_07CF37C3 X-CRM114-Status: GOOD ( 12.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org devm_clk_get_enabled() returns the clk already (prepared and) enabled and the automatically called cleanup cares for disabling (and unpreparing). So simplify .probe() and .remove() accordingly. Acked-by: Oleksij Rempel Acked-by: Wolfram Sang Signed-off-by: Uwe Kleine-König --- drivers/i2c/busses/i2c-imx.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c index dc5ca71906db..13241401ad88 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c @@ -1405,16 +1405,10 @@ static int i2c_imx_probe(struct platform_device *pdev) ACPI_COMPANION_SET(&i2c_imx->adapter.dev, ACPI_COMPANION(&pdev->dev)); /* Get I2C clock */ - i2c_imx->clk = devm_clk_get(&pdev->dev, NULL); + i2c_imx->clk = devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(i2c_imx->clk)) return dev_err_probe(&pdev->dev, PTR_ERR(i2c_imx->clk), - "can't get I2C clock\n"); - - ret = clk_prepare_enable(i2c_imx->clk); - if (ret) { - dev_err(&pdev->dev, "can't enable I2C clock, ret=%d\n", ret); - return ret; - } + "can't get prepared I2C clock\n"); /* Init queue */ init_waitqueue_head(&i2c_imx->queue); @@ -1487,7 +1481,6 @@ static int i2c_imx_probe(struct platform_device *pdev) pm_runtime_disable(&pdev->dev); pm_runtime_set_suspended(&pdev->dev); pm_runtime_dont_use_autosuspend(&pdev->dev); - clk_disable_unprepare(i2c_imx->clk); return ret; } @@ -1517,7 +1510,6 @@ static int i2c_imx_remove(struct platform_device *pdev) irq = platform_get_irq(pdev, 0); if (irq >= 0) free_irq(irq, i2c_imx); - clk_disable_unprepare(i2c_imx->clk); pm_runtime_put_noidle(&pdev->dev); pm_runtime_disable(&pdev->dev);