summaryrefslogtreecommitdiffstats
path: root/drivers/base/core.c
diff options
context:
space:
mode:
authorJoerg Roedel <jroedel@suse.de>2014-09-30 13:02:02 +0200
committerJoerg Roedel <jroedel@suse.de>2014-10-02 11:14:34 +0200
commit599bad38cf7163123af7c9efea0fcf228bc74fe1 (patch)
tree876f2845a2c02b0d1f23eb6ca02aad986807132e /drivers/base/core.c
parentiommu: Replace rcu_assign_pointer() with RCU_INIT_POINTER() (diff)
downloadlinux-599bad38cf7163123af7c9efea0fcf228bc74fe1.tar.xz
linux-599bad38cf7163123af7c9efea0fcf228bc74fe1.zip
driver core: Add BUS_NOTIFY_REMOVED_DEVICE event
This event closes an important gap in the bus notifiers. There is already the BUS_NOTIFY_DEL_DEVICE event, but that is sent when the device is still bound to its device driver. This is too early for the IOMMU code to destroy any mappings for the device, as they might still be in use by the driver. The new BUS_NOTIFY_REMOVED_DEVICE event introduced with this patch closes this gap as it is sent when the device is already unbound from its device driver and almost completly removed from the driver core. With this event the IOMMU code can safely destroy any mappings and other data structures when a device is removed. Signed-off-by: Joerg Roedel <jroedel@suse.de> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Tested-by: Jerry Hoemann <jerry.hoemann@hp.com>
Diffstat (limited to 'drivers/base/core.c')
-rw-r--r--drivers/base/core.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 20da3ad1696b..7b270a2e6ed5 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1211,6 +1211,9 @@ void device_del(struct device *dev)
*/
if (platform_notify_remove)
platform_notify_remove(dev);
+ if (dev->bus)
+ blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
+ BUS_NOTIFY_REMOVED_DEVICE, dev);
kobject_uevent(&dev->kobj, KOBJ_REMOVE);
cleanup_device_parent(dev);
kobject_del(&dev->kobj);