diff options
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/bus.c | 5 | ||||
-rw-r--r-- | drivers/base/class.c | 13 | ||||
-rw-r--r-- | drivers/base/dd.c | 2 | ||||
-rw-r--r-- | drivers/base/power/suspend.c | 12 |
4 files changed, 24 insertions, 8 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 48718b7..76656ac 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c @@ -188,6 +188,11 @@ static ssize_t driver_bind(struct device_driver *drv, up(&dev->sem); if (dev->parent) up(&dev->parent->sem); + + if (err > 0) /* success */ + err = count; + else if (err == 0) /* driver didn't accept device */ + err = -ENODEV; } put_device(dev); put_bus(bus); diff --git a/drivers/base/class.c b/drivers/base/class.c index df7fdab..0e71dff3 100644 --- a/drivers/base/class.c +++ b/drivers/base/class.c @@ -562,14 +562,13 @@ int class_device_add(struct class_device *class_dev) kobject_uevent(&class_dev->kobj, KOBJ_ADD); /* notify any interfaces this device is now here */ - if (parent_class) { - down(&parent_class->sem); - list_add_tail(&class_dev->node, &parent_class->children); - list_for_each_entry(class_intf, &parent_class->interfaces, node) - if (class_intf->add) - class_intf->add(class_dev, class_intf); - up(&parent_class->sem); + down(&parent_class->sem); + list_add_tail(&class_dev->node, &parent_class->children); + list_for_each_entry(class_intf, &parent_class->interfaces, node) { + if (class_intf->add) + class_intf->add(class_dev, class_intf); } + up(&parent_class->sem); register_done: if (error) { diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 730a9ce..889c711 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -209,7 +209,7 @@ static void __device_release_driver(struct device * dev) sysfs_remove_link(&dev->kobj, "driver"); klist_remove(&dev->knode_driver); - if (dev->bus->remove) + if (dev->bus && dev->bus->remove) dev->bus->remove(dev); else if (drv->remove) drv->remove(dev); diff --git a/drivers/base/power/suspend.c b/drivers/base/power/suspend.c index bdb6066..662209d 100644 --- a/drivers/base/power/suspend.c +++ b/drivers/base/power/suspend.c @@ -10,6 +10,8 @@ #include <linux/vt_kern.h> #include <linux/device.h> +#include <linux/kallsyms.h> +#include <linux/pm.h> #include "../base.h" #include "power.h" @@ -58,6 +60,7 @@ int suspend_device(struct device * dev, pm_message_t state) if (dev->bus && dev->bus->suspend && !dev->power.power_state.event) { dev_dbg(dev, "suspending\n"); error = dev->bus->suspend(dev, state); + suspend_report_result(dev->bus->suspend, error); } up(&dev->sem); return error; @@ -169,3 +172,12 @@ int device_power_down(pm_message_t state) EXPORT_SYMBOL_GPL(device_power_down); +void __suspend_report_result(const char *function, void *fn, int ret) +{ + if (ret) { + printk(KERN_ERR "%s(): ", function); + print_fn_descriptor_symbol("%s() returns ", (unsigned long)fn); + printk("%d\n", ret); + } +} +EXPORT_SYMBOL_GPL(__suspend_report_result); |