aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorMagnus Damm <damm@opensource.se>2010-07-23 06:56:18 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-08-05 16:53:35 -0400
commit45daef0fdcc44f6af86fdebc4fc7eb7c79375398 (patch)
tree95005210c9d1c726b5d2d36689b218be0255ce5c /drivers/base
parent600c20f34f645adf7884277302b10601583aa7d5 (diff)
Driver core: Add BUS_NOTIFY_BIND_DRIVER
Add BUS_NOTIFY_BIND_DRIVER as a bus notifier event. For driver binding/unbinding we with this in place have the following bus notifier events: - BUS_NOTIFY_BIND_DRIVER - before ->probe() - BUS_NOTIFY_BOUND_DRIVER - after ->probe() - BUS_NOTIFY_UNBIND_DRIVER - before ->remove() - BUS_NOTIFY_UNBOUND_DRIVER - after ->remove() The event BUS_NOTIFY_BIND_DRIVER allows bus code to be notified that ->probe() is about to be called. Useful for bus code that needs to setup hardware before the driver gets to run. With this in place platform drivers can be loaded and unloaded as modules and the new BIND event allows bus code to control for instance device clocks that must be enabled before the driver can be executed. Without this patch there is no way for the bus code to get notified that a modular driver is about to be probed. Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/dd.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 503c2620bbcc..da57ee9d63fe 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -51,6 +51,10 @@ static int driver_sysfs_add(struct device *dev)
51{ 51{
52 int ret; 52 int ret;
53 53
54 if (dev->bus)
55 blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
56 BUS_NOTIFY_BIND_DRIVER, dev);
57
54 ret = sysfs_create_link(&dev->driver->p->kobj, &dev->kobj, 58 ret = sysfs_create_link(&dev->driver->p->kobj, &dev->kobj,
55 kobject_name(&dev->kobj)); 59 kobject_name(&dev->kobj));
56 if (ret == 0) { 60 if (ret == 0) {