diff options
-rw-r--r-- | drivers/base/bus.c | 27 | ||||
-rw-r--r-- | include/linux/device.h | 2 |
2 files changed, 10 insertions, 19 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 7e17488271a8..96fe2f956754 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 */ |
484 | static int bus_rescan_devices_helper(struct device *dev, void *data) | 484 | static 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 | */ |
504 | int bus_rescan_devices(struct bus_type * bus) | 499 | void 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 | ||
diff --git a/include/linux/device.h b/include/linux/device.h index 07222c531d37..f378c846e6d5 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -69,7 +69,7 @@ struct bus_type { | |||
69 | extern int bus_register(struct bus_type * bus); | 69 | extern int bus_register(struct bus_type * bus); |
70 | extern void bus_unregister(struct bus_type * bus); | 70 | extern void bus_unregister(struct bus_type * bus); |
71 | 71 | ||
72 | extern int bus_rescan_devices(struct bus_type * bus); | 72 | extern void bus_rescan_devices(struct bus_type * bus); |
73 | 73 | ||
74 | extern struct bus_type * get_bus(struct bus_type * bus); | 74 | extern struct bus_type * get_bus(struct bus_type * bus); |
75 | extern void put_bus(struct bus_type * bus); | 75 | extern void put_bus(struct bus_type * bus); |