linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Subject: [PATCH] drivers-core: move device_pm_remove behind bus_remove_device
@ 2012-09-21  1:58 Zhang, LongX
  2012-10-15  7:39 ` Yanmin Zhang
  0 siblings, 1 reply; 4+ messages in thread
From: Zhang, LongX @ 2012-09-21  1:58 UTC (permalink / raw)
  To: linux-kernel@vger.kernel.org, linux-pm@lists.linux-foundation.org
  Cc: rjw@sisk.pl, yanmin_zhang@linux.intel.com

From: LongX Zhang <longx.zhang@intel.com>

device_pm_remove will call pm_runtime_remove which would disable
runtime PM of the device. After that pm_runtime_get* or
pm_runtime_put* will be ingored. So if we disable the runtime PM
before device really be removed, drivers' _remove callback may
access HW even pm_runtime_get* fails. That is bad.

Signed-off-by: LongX Zhang <longx.zhang@intel.com>
---
 drivers/base/core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index 5e6e00b..81ea7f2 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1169,7 +1169,6 @@ void device_del(struct device *dev)
 	if (dev->bus)
 		blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
 					     BUS_NOTIFY_DEL_DEVICE, dev);
-	device_pm_remove(dev);
 	dpm_sysfs_remove(dev);
 	if (parent)
 		klist_del(&dev->p->knode_parent);
@@ -1194,6 +1193,7 @@ void device_del(struct device *dev)
 	device_remove_file(dev, &uevent_attr);
 	device_remove_attrs(dev);
 	bus_remove_device(dev);
+	device_pm_remove(dev);
 	driver_deferred_probe_del(dev);
 
 	/*
-- 
1.7.10

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

end of thread, other threads:[~2012-10-18  0:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-21  1:58 Subject: [PATCH] drivers-core: move device_pm_remove behind bus_remove_device Zhang, LongX
2012-10-15  7:39 ` Yanmin Zhang
2012-10-15 20:59   ` Rafael J. Wysocki
2012-10-18  0:21     ` Yanmin Zhang

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