return ret;
}
-static void driver_sysfs_remove(struct device *dev)
+static void driver_sysfs_remove(struct device *dev, int failed)
{
struct device_driver *drv = dev->driver;
+ if (failed && dev->bus)
+ blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
+ BUS_NOTIFY_BIND_FAILED, dev);
+
if (drv) {
sysfs_remove_link(&drv->p->kobj, kobject_name(&dev->kobj));
sysfs_remove_link(&dev->kobj, "driver");
probe_failed:
devres_release_all(dev);
- driver_sysfs_remove(dev);
+ driver_sysfs_remove(dev, true);
dev->driver = NULL;
dev_set_drvdata(dev, NULL);
if (drv) {
pm_runtime_get_sync(dev);
- driver_sysfs_remove(dev);
+ driver_sysfs_remove(dev, false);
if (dev->bus)
blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
extern int bus_unregister_notifier(struct bus_type *bus,
struct notifier_block *nb);
-/* All 4 notifers below get called with the target struct device *
+/* All 7 notifers below get called with the target struct device *
* as an argument. Note that those functions are likely to be called
* with the device lock held in the core, so be careful.
*/
unbound */
#define BUS_NOTIFY_UNBOUND_DRIVER 0x00000006 /* driver is unbound
from the device */
+#define BUS_NOTIFY_BIND_FAILED 0x00000007 /* driver failed to bind
+ to device */
extern struct kset *bus_get_kset(struct bus_type *bus);
extern struct klist *bus_get_device_klist(struct bus_type *bus);