diff mbox series

i2c: omap: Don't do pm_runtime_resume in .remove()

Message ID 20230402105518.2512541-1-u.kleine-koenig@pengutronix.de
State New
Headers show
Series i2c: omap: Don't do pm_runtime_resume in .remove() | expand

Commit Message

Uwe Kleine-König April 2, 2023, 10:55 a.m. UTC
One of the first things that the driver's pm_runtime_resume callback
does is to write zero to the OMAP_I2C_CON_REG register.
So there is no need to have the device resumed just to write to the
OMAP_I2C_CON_REG register and the call to pm_runtime_resume_and_get()
can be dropped.

The intended side effect of this commit is to remove an error path of
the function resulting in the remove callback returning a mostly ignored
error code. This prepares changing the prototype of struct
platform_driver's remove callback to return void.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Hello,

I'm not completely sure that the reasing in the commit log is sound.
There might at least theoretical side effects of the register write
that are different if the device is fully resumed.

Best regards
Uwe

 drivers/i2c/busses/i2c-omap.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)


base-commit: fe15c26ee26efa11741a7b632e9f23b01aca4cc6

Comments

Wolfram Sang April 6, 2023, 6:44 a.m. UTC | #1
> > So if there is some clk handling necessary before the register access,
> > I'm not aware where it's hidden. Is there some bus or omap specific code
> > that ensures clk handling?
> 
> I think the missing part is that the runtime PM calls in the i2c driver
> cause the parent ti-sysc interconnect target module device to get enabled
> and clocked before accessing the i2c registers.

So, this patch is not needed?
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index f9ae520aed22..a572f6d994ca 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -1522,16 +1522,12 @@  omap_i2c_probe(struct platform_device *pdev)
 static int omap_i2c_remove(struct platform_device *pdev)
 {
 	struct omap_i2c_dev	*omap = platform_get_drvdata(pdev);
-	int ret;
 
 	i2c_del_adapter(&omap->adapter);
-	ret = pm_runtime_resume_and_get(&pdev->dev);
-	if (ret < 0)
-		return ret;
 
 	omap_i2c_write_reg(omap, OMAP_I2C_CON_REG, 0);
+
 	pm_runtime_dont_use_autosuspend(&pdev->dev);
-	pm_runtime_put_sync(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
 	return 0;
 }