]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/base/dd.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog
[linux-2.6-omap-h63xx.git] / drivers / base / dd.c
index 18dba8e78da7fa04bfaf05d421a2adace9333941..7ac474db88c525f46a0846810ca5f384fa07b104 100644 (file)
@@ -207,31 +207,16 @@ static int __device_attach(struct device_driver * drv, void * data)
        return driver_probe_device(drv, dev);
 }
 
-static int device_probe_drivers(void *data)
-{
-       struct device *dev = data;
-       int ret = 0;
-
-       if (dev->bus) {
-               down(&dev->sem);
-               ret = bus_for_each_drv(dev->bus, NULL, dev, __device_attach);
-               up(&dev->sem);
-       }
-       return ret;
-}
-
 /**
  *     device_attach - try to attach device to a driver.
  *     @dev:   device.
  *
  *     Walk the list of drivers that the bus has and call
  *     driver_probe_device() for each pair. If a compatible
- *     pair is found, break out and return. If the bus specifies
- *     multithreaded probing, walking the list of drivers is done
- *     on a probing thread.
+ *     pair is found, break out and return.
  *
  *     Returns 1 if the device was bound to a driver;
- *     0 if no matching device was found or multithreaded probing is done;
+ *     0 if no matching device was found;
  *     -ENODEV if the device is not registered.
  *
  *     When called for a USB interface, @dev->parent->sem must be held.
@@ -239,7 +224,6 @@ static int device_probe_drivers(void *data)
 int device_attach(struct device * dev)
 {
        int ret = 0;
-       struct task_struct *probe_task = ERR_PTR(-ENOMEM);
 
        down(&dev->sem);
        if (dev->driver) {
@@ -251,12 +235,7 @@ int device_attach(struct device * dev)
                        ret = 0;
                }
        } else {
-               if (dev->bus->multithread_probe)
-                       probe_task = kthread_run(device_probe_drivers, dev,
-                                                "probe-%s", dev->bus_id);
-               if(IS_ERR(probe_task))
-                       ret = bus_for_each_drv(dev->bus, NULL, dev,
-                                              __device_attach);
+               ret = bus_for_each_drv(dev->bus, NULL, dev, __device_attach);
        }
        up(&dev->sem);
        return ret;
@@ -302,24 +281,16 @@ int driver_attach(struct device_driver * drv)
        return bus_for_each_dev(drv->bus, NULL, drv, __driver_attach);
 }
 
-/**
- *     device_release_driver - manually detach device from driver.
- *     @dev:   device.
- *
- *     Manually detach device from driver.
- *
+/*
  *     __device_release_driver() must be called with @dev->sem held.
- *     When called for a USB interface, @dev->parent->sem must be held
- *     as well.
+ *     When called for a USB interface, @dev->parent->sem must be held as well.
  */
-
 static void __device_release_driver(struct device * dev)
 {
        struct device_driver * drv;
 
-       drv = dev->driver;
+       drv = get_driver(dev->driver);
        if (drv) {
-               get_driver(drv);
                driver_sysfs_remove(dev);
                sysfs_remove_link(&dev->kobj, "driver");
                klist_remove(&dev->knode_driver);
@@ -339,6 +310,13 @@ static void __device_release_driver(struct device * dev)
        }
 }
 
+/**
+ *     device_release_driver - manually detach device from driver.
+ *     @dev:   device.
+ *
+ *     Manually detach device from driver.
+ *     When called for a USB interface, @dev->parent->sem must be held.
+ */
 void device_release_driver(struct device * dev)
 {
        /*
@@ -383,33 +361,6 @@ void driver_detach(struct device_driver * drv)
        }
 }
 
-#ifdef CONFIG_PCI_MULTITHREAD_PROBE
-static int __init wait_for_probes(void)
-{
-       DEFINE_WAIT(wait);
-
-       printk(KERN_INFO "%s: waiting for %d threads\n", __FUNCTION__,
-                       atomic_read(&probe_count));
-       if (!atomic_read(&probe_count))
-               return 0;
-       while (atomic_read(&probe_count)) {
-               prepare_to_wait(&probe_waitqueue, &wait, TASK_UNINTERRUPTIBLE);
-               if (atomic_read(&probe_count))
-                       schedule();
-       }
-       finish_wait(&probe_waitqueue, &wait);
-       return 0;
-}
-
-core_initcall_sync(wait_for_probes);
-postcore_initcall_sync(wait_for_probes);
-arch_initcall_sync(wait_for_probes);
-subsys_initcall_sync(wait_for_probes);
-fs_initcall_sync(wait_for_probes);
-device_initcall_sync(wait_for_probes);
-late_initcall_sync(wait_for_probes);
-#endif
-
 EXPORT_SYMBOL_GPL(device_bind_driver);
 EXPORT_SYMBOL_GPL(device_release_driver);
 EXPORT_SYMBOL_GPL(device_attach);