[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230402103951.2510773-1-u.kleine-koenig@pengutronix.de>
Date: Sun, 2 Apr 2023 12:39:51 +0200
From: Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>
To: "Rafael J . Wysocki" <rafael.j.wysocki@...el.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-kernel@...r.kernel.org, kernel@...gutronix.de
Subject: [PATCH RFC] PM: runtime: Drop device usage only after remove is done
Many device drivers call one of the variants of pm_runtime_resume() in
their remove callback. So calling pm_runtime_put_sync() just before that
is ineffective as the suspend callback might just be called just to
resume the device directly afterwards again.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
---
Hello,
this is a theoretical issue that I noticed while doing some research how
pm-runtime works. Not sure it makes sense, so I marked it as RFC.
Best regards
Uwe
drivers/base/dd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 8def2ba08a82..6beac141d3d2 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -1235,10 +1235,10 @@ static void __device_release_driver(struct device *dev, struct device *parent)
bus_notify(dev, BUS_NOTIFY_UNBIND_DRIVER);
- pm_runtime_put_sync(dev);
-
device_remove(dev);
+ pm_runtime_put_sync(dev);
+
if (dev->bus && dev->bus->dma_cleanup)
dev->bus->dma_cleanup(dev);
base-commit: fe15c26ee26efa11741a7b632e9f23b01aca4cc6
--
2.39.2
Powered by blists - more mailing lists