linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c: omap: Don't do pm_runtime_resume in .remove()
@ 2023-04-02 10:55 Uwe Kleine-König
  2023-04-02 20:50 ` Andreas Kemnade
  0 siblings, 1 reply; 14+ messages in thread
From: Uwe Kleine-König @ 2023-04-02 10:55 UTC (permalink / raw)
  To: Aaro Koskinen, Janusz Krzysztofik, Tony Lindgren, Vignesh R
  Cc: linux-omap, linux-i2c, kernel, Rafael J. Wysocki, linux-pm

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(-)

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;
 }

base-commit: fe15c26ee26efa11741a7b632e9f23b01aca4cc6
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2023-04-13 16:49 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-02 10:55 [PATCH] i2c: omap: Don't do pm_runtime_resume in .remove() Uwe Kleine-König
2023-04-02 20:50 ` Andreas Kemnade
2023-04-03  5:48   ` Uwe Kleine-König
2023-04-03  6:04     ` Tony Lindgren
2023-04-06  6:44       ` Wolfram Sang
2023-04-06  8:23         ` [PATCH] i2c: omap: Improve error reporting for problems during .remove() Uwe Kleine-König
2023-04-13  5:12           ` Tony Lindgren
2023-04-13  6:24             ` Uwe Kleine-König
2023-04-13  6:39               ` Tony Lindgren
2023-04-13  7:07                 ` Uwe Kleine-König
2023-04-13  7:11                   ` Tony Lindgren
2023-04-13  7:37                     ` Uwe Kleine-König
2023-04-13  7:40                       ` Tony Lindgren
2023-04-13 16:49           ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).