Subject: [PATCH 2/32] Call platform_notify_remove later

From: Benjamin Herrenschmidt <[email-masked]>
Date: Fri, 10 Nov 2006 18:44:44 +1100

Move the call to platform_notify_remove() to after the call to
bus_remove_device(), where it belongs.  It's bogus to notify the platform
of removal while drivers are still attached to the device and possibly
still operating since the platform might use this callback to tear down
some resources used by the driver (ACPI bits, iommu table, ...)

Signed-off-by: Benjamin Herrenschmidt <[email-masked]>
Cc: "Brown, Len" <[email-masked]>
Cc: Greg KH <[email-masked]>
Signed-off-by: Andrew Morton <[email-masked]>

---
This patch is already in -mm under the name

call-platform_notify_remove-later.patch

 drivers/base/core.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: linux-cell/drivers/base/core.c
===================================================================
--- linux-cell.orig/drivers/base/core.c	2006-10-25 13:04:40.000000000 +1000
+++ linux-cell/drivers/base/core.c	2006-10-25 13:04:56.000000000 +1000
@@ -615,12 +615,13 @@ void device_del(struct device * dev)
 	device_remove_groups(dev);
 	device_remove_attrs(dev);
 
+	bus_remove_device(dev);
+
 	/* Notify the platform of the removal, in case they
 	 * need to do anything...
 	 */
 	if (platform_notify_remove)
 		platform_notify_remove(dev);
-	bus_remove_device(dev);
 	device_pm_remove(dev);
 	kobject_uevent(&dev->kobj, KOBJ_REMOVE);
 	kobject_del(&dev->kobj);