aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/bus.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/bus.c')
-rw-r--r--drivers/base/bus.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 7e17488271a..96fe2f95675 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -483,31 +483,22 @@ void bus_remove_driver(struct device_driver * drv)
483/* Helper for bus_rescan_devices's iter */ 483/* Helper for bus_rescan_devices's iter */
484static int bus_rescan_devices_helper(struct device *dev, void *data) 484static int bus_rescan_devices_helper(struct device *dev, void *data)
485{ 485{
486 int *count = data; 486 if (!dev->driver)
487 487 device_attach(dev);
488 if (!dev->driver && (device_attach(dev) > 0))
489 (*count)++;
490
491 return 0; 488 return 0;
492} 489}
493 490
494
495/** 491/**
496 * bus_rescan_devices - rescan devices on the bus for possible drivers 492 * bus_rescan_devices - rescan devices on the bus for possible drivers
497 * @bus: the bus to scan. 493 * @bus: the bus to scan.
498 * 494 *
499 * This function will look for devices on the bus with no driver 495 * This function will look for devices on the bus with no driver
500 * attached and rescan it against existing drivers to see if it 496 * attached and rescan it against existing drivers to see if it matches
501 * matches any. Calls device_attach(). Returns the number of devices 497 * any by calling device_attach() for the unbound devices.
502 * that were sucessfully bound to a driver.
503 */ 498 */
504int bus_rescan_devices(struct bus_type * bus) 499void bus_rescan_devices(struct bus_type * bus)
505{ 500{
506 int count = 0; 501 bus_for_each_dev(bus, NULL, NULL, bus_rescan_devices_helper);
507
508 bus_for_each_dev(bus, NULL, &count, bus_rescan_devices_helper);
509
510 return count;
511} 502}
512 503
513 504