aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/dd.c41
1 files changed, 3 insertions, 38 deletions
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 18dba8e78da7..92428e55b0c2 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -226,12 +226,10 @@ static int device_probe_drivers(void *data)
226 * 226 *
227 * Walk the list of drivers that the bus has and call 227 * Walk the list of drivers that the bus has and call
228 * driver_probe_device() for each pair. If a compatible 228 * driver_probe_device() for each pair. If a compatible
229 * pair is found, break out and return. If the bus specifies 229 * pair is found, break out and return.
230 * multithreaded probing, walking the list of drivers is done
231 * on a probing thread.
232 * 230 *
233 * Returns 1 if the device was bound to a driver; 231 * Returns 1 if the device was bound to a driver;
234 * 0 if no matching device was found or multithreaded probing is done; 232 * 0 if no matching device was found;
235 * -ENODEV if the device is not registered. 233 * -ENODEV if the device is not registered.
236 * 234 *
237 * When called for a USB interface, @dev->parent->sem must be held. 235 * When called for a USB interface, @dev->parent->sem must be held.
@@ -239,7 +237,6 @@ static int device_probe_drivers(void *data)
239int device_attach(struct device * dev) 237int device_attach(struct device * dev)
240{ 238{
241 int ret = 0; 239 int ret = 0;
242 struct task_struct *probe_task = ERR_PTR(-ENOMEM);
243 240
244 down(&dev->sem); 241 down(&dev->sem);
245 if (dev->driver) { 242 if (dev->driver) {
@@ -251,12 +248,7 @@ int device_attach(struct device * dev)
251 ret = 0; 248 ret = 0;
252 } 249 }
253 } else { 250 } else {
254 if (dev->bus->multithread_probe) 251 ret = bus_for_each_drv(dev->bus, NULL, dev, __device_attach);
255 probe_task = kthread_run(device_probe_drivers, dev,
256 "probe-%s", dev->bus_id);
257 if(IS_ERR(probe_task))
258 ret = bus_for_each_drv(dev->bus, NULL, dev,
259 __device_attach);
260 } 252 }
261 up(&dev->sem); 253 up(&dev->sem);
262 return ret; 254 return ret;
@@ -383,33 +375,6 @@ void driver_detach(struct device_driver * drv)
383 } 375 }
384} 376}
385 377
386#ifdef CONFIG_PCI_MULTITHREAD_PROBE
387static int __init wait_for_probes(void)
388{
389 DEFINE_WAIT(wait);
390
391 printk(KERN_INFO "%s: waiting for %d threads\n", __FUNCTION__,
392 atomic_read(&probe_count));
393 if (!atomic_read(&probe_count))
394 return 0;
395 while (atomic_read(&probe_count)) {
396 prepare_to_wait(&probe_waitqueue, &wait, TASK_UNINTERRUPTIBLE);
397 if (atomic_read(&probe_count))
398 schedule();
399 }
400 finish_wait(&probe_waitqueue, &wait);
401 return 0;
402}
403
404core_initcall_sync(wait_for_probes);
405postcore_initcall_sync(wait_for_probes);
406arch_initcall_sync(wait_for_probes);
407subsys_initcall_sync(wait_for_probes);
408fs_initcall_sync(wait_for_probes);
409device_initcall_sync(wait_for_probes);
410late_initcall_sync(wait_for_probes);
411#endif
412
413EXPORT_SYMBOL_GPL(device_bind_driver); 378EXPORT_SYMBOL_GPL(device_bind_driver);
414EXPORT_SYMBOL_GPL(device_release_driver); 379EXPORT_SYMBOL_GPL(device_release_driver);
415EXPORT_SYMBOL_GPL(device_attach); 380EXPORT_SYMBOL_GPL(device_attach);