driver core: add BUS_NOTIFY_UNBOUND_DRIVER event
authorJoerg Roedel <joerg.roedel@amd.com>
Fri, 24 Apr 2009 12:57:00 +0000 (14:57 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 16 Jun 2009 04:30:24 +0000 (21:30 -0700)
This patch adds a new bus notifier event which is emitted _after_ a
device is removed from its driver. This event will be used by the
dma-api debug code to check if a driver has released all dma allocations
for that device.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/base/dd.c
include/linux/device.h

index 742cbe6b042bbf711054e2cd7f02cdcc66354752..efd00de183b12dd7b6fc31f2fed3f5e566afeac5 100644 (file)
@@ -320,6 +320,10 @@ static void __device_release_driver(struct device *dev)
                devres_release_all(dev);
                dev->driver = NULL;
                klist_remove(&dev->p->knode_driver);
+               if (dev->bus)
+                       blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
+                                                    BUS_NOTIFY_UNBOUND_DRIVER,
+                                                    dev);
        }
 }
 
index a4a7b10aaa48a8b086142876272466a888069ce4..4410464b134a1f61fc5ae2fe0d81a4b775937eba 100644 (file)
@@ -114,6 +114,8 @@ extern int bus_unregister_notifier(struct bus_type *bus,
 #define BUS_NOTIFY_BOUND_DRIVER                0x00000003 /* driver bound to device */
 #define BUS_NOTIFY_UNBIND_DRIVER       0x00000004 /* driver about to be
                                                      unbound */
+#define BUS_NOTIFY_UNBOUND_DRIVER      0x00000005 /* driver is unbound
+                                                     from the device */
 
 extern struct kset *bus_get_kset(struct bus_type *bus);
 extern struct klist *bus_get_device_klist(struct bus_type *bus);