Driver core: Call platform_notify_remove later
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Thu, 9 Nov 2006 03:46:14 +0000 (19:46 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 1 Dec 2006 22:52:01 +0000 (14:52 -0800)
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 <benh@kernel.crashing.org>
Cc: "Brown, Len" <len.brown@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/base/core.c

index f544adc5a5e2f66191a6f57608c9a493060ec65e..5d11bbdfbd2f9c99b318f4c54b8b1fa4848fec9c 100644 (file)
@@ -682,6 +682,7 @@ void device_del(struct device * dev)
        device_remove_file(dev, &dev->uevent_attr);
        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...
@@ -691,7 +692,6 @@ void device_del(struct device * dev)
        if (dev->bus)
                blocking_notifier_call_chain(&dev->bus->bus_notifier,
                                             BUS_NOTIFY_DEL_DEVICE, dev);
-       bus_remove_device(dev);
        device_pm_remove(dev);
        kobject_uevent(&dev->kobj, KOBJ_REMOVE);
        kobject_del(&dev->kobj);