* [PATCH] i2c: imx: If pm_runtime_get_sync() returned 1 device access is possible
@ 2022-09-12 13:20 Uwe Kleine-König
2022-09-14 11:22 ` Oleksij Rempel
2022-09-16 19:38 ` Wolfram Sang
0 siblings, 2 replies; 3+ messages in thread
From: Uwe Kleine-König @ 2022-09-12 13:20 UTC (permalink / raw)
To: Oleksij Rempel, Shawn Guo, Wolfram Sang
Cc: NXP Linux Team, Pengutronix Kernel Team, linux-i2c,
Fabio Estevam, Dan Carpenter
pm_runtime_get_sync() returning 1 also means the device is powered. So
resetting the chip registers in .remove() is possible and should be
done.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: d98bdd3a5b50 ("i2c: imx: Make sure to unregister adapter on remove()")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/i2c/busses/i2c-imx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index e47fa3465671..3082183bd66a 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -1583,7 +1583,7 @@ static int i2c_imx_remove(struct platform_device *pdev)
if (i2c_imx->dma)
i2c_imx_dma_free(i2c_imx);
- if (ret == 0) {
+ if (ret >= 0) {
/* setup chip registers to defaults */
imx_i2c_write_reg(0, i2c_imx, IMX_I2C_IADR);
imx_i2c_write_reg(0, i2c_imx, IMX_I2C_IFDR);
--
2.37.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] i2c: imx: If pm_runtime_get_sync() returned 1 device access is possible
2022-09-12 13:20 [PATCH] i2c: imx: If pm_runtime_get_sync() returned 1 device access is possible Uwe Kleine-König
@ 2022-09-14 11:22 ` Oleksij Rempel
2022-09-16 19:38 ` Wolfram Sang
1 sibling, 0 replies; 3+ messages in thread
From: Oleksij Rempel @ 2022-09-14 11:22 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Oleksij Rempel, Shawn Guo, Wolfram Sang, Dan Carpenter,
Fabio Estevam, NXP Linux Team, Pengutronix Kernel Team,
linux-i2c
On Mon, Sep 12, 2022 at 03:20:40PM +0200, Uwe Kleine-König wrote:
> pm_runtime_get_sync() returning 1 also means the device is powered. So
> resetting the chip registers in .remove() is possible and should be
> done.
>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Fixes: d98bdd3a5b50 ("i2c: imx: Make sure to unregister adapter on remove()")
> 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 | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
> index e47fa3465671..3082183bd66a 100644
> --- a/drivers/i2c/busses/i2c-imx.c
> +++ b/drivers/i2c/busses/i2c-imx.c
> @@ -1583,7 +1583,7 @@ static int i2c_imx_remove(struct platform_device *pdev)
> if (i2c_imx->dma)
> i2c_imx_dma_free(i2c_imx);
>
> - if (ret == 0) {
> + if (ret >= 0) {
> /* setup chip registers to defaults */
> imx_i2c_write_reg(0, i2c_imx, IMX_I2C_IADR);
> imx_i2c_write_reg(0, i2c_imx, IMX_I2C_IFDR);
> --
> 2.37.2
>
>
>
--
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 |
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] i2c: imx: If pm_runtime_get_sync() returned 1 device access is possible
2022-09-12 13:20 [PATCH] i2c: imx: If pm_runtime_get_sync() returned 1 device access is possible Uwe Kleine-König
2022-09-14 11:22 ` Oleksij Rempel
@ 2022-09-16 19:38 ` Wolfram Sang
1 sibling, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2022-09-16 19:38 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Oleksij Rempel, Shawn Guo, NXP Linux Team,
Pengutronix Kernel Team, linux-i2c, Fabio Estevam, Dan Carpenter
[-- Attachment #1: Type: text/plain, Size: 470 bytes --]
On Mon, Sep 12, 2022 at 03:20:40PM +0200, Uwe Kleine-König wrote:
> pm_runtime_get_sync() returning 1 also means the device is powered. So
> resetting the chip registers in .remove() is possible and should be
> done.
>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Fixes: d98bdd3a5b50 ("i2c: imx: Make sure to unregister adapter on remove()")
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Applied to for-current, thanks!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-09-16 19:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-12 13:20 [PATCH] i2c: imx: If pm_runtime_get_sync() returned 1 device access is possible Uwe Kleine-König
2022-09-14 11:22 ` Oleksij Rempel
2022-09-16 19:38 ` Wolfram Sang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.