From: Oleksij Rempel <o.rempel@pengutronix.de>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Oleksij Rempel <linux@rempel-privat.de>,
Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
NXP Linux Team <linux-imx@nxp.com>,
linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] i2c: imx: Simplify using devm_clk_get_enabled()
Date: Tue, 14 Mar 2023 11:31:01 +0100 [thread overview]
Message-ID: <20230314103101.GB28733@pengutronix.de> (raw)
In-Reply-To: <20230313183349.2774002-1-u.kleine-koenig@pengutronix.de>
On Mon, Mar 13, 2023 at 07:33:49PM +0100, Uwe Kleine-König wrote:
> 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.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
Thank you!
> ---
> drivers/i2c/busses/i2c-imx.c | 12 +-----------
> 1 file changed, 1 insertion(+), 11 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
> index cf5bacf3a488..42189a5f2905 100644
> --- a/drivers/i2c/busses/i2c-imx.c
> +++ b/drivers/i2c/busses/i2c-imx.c
> @@ -1482,17 +1482,11 @@ 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;
> - }
> -
> /* Init queue */
> init_waitqueue_head(&i2c_imx->queue);
>
> @@ -1564,7 +1558,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;
> }
>
> @@ -1590,7 +1583,6 @@ static int i2c_imx_remove(struct platform_device *pdev)
> imx_i2c_write_reg(0, i2c_imx, IMX_I2C_IFDR);
> imx_i2c_write_reg(0, i2c_imx, IMX_I2C_I2CR);
> imx_i2c_write_reg(0, i2c_imx, IMX_I2C_I2SR);
> - clk_disable(i2c_imx->clk);
> }
>
> clk_notifier_unregister(i2c_imx->clk, &i2c_imx->clk_change_nb);
> @@ -1598,8 +1590,6 @@ static int i2c_imx_remove(struct platform_device *pdev)
> if (irq >= 0)
> free_irq(irq, i2c_imx);
>
> - clk_unprepare(i2c_imx->clk);
> -
> pm_runtime_put_noidle(&pdev->dev);
> pm_runtime_disable(&pdev->dev);
>
>
> base-commit: eeac8ede17557680855031c6f305ece2378af326
> --
> 2.39.1
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-03-14 12:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-13 18:33 [PATCH] i2c: imx: Simplify using devm_clk_get_enabled() Uwe Kleine-König
2023-03-14 10:31 ` Oleksij Rempel [this message]
2023-03-16 20:08 ` Wolfram Sang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230314103101.GB28733@pengutronix.de \
--to=o.rempel@pengutronix.de \
--cc=festevam@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-imx@nxp.com \
--cc=linux@rempel-privat.de \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=u.kleine-koenig@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox