提交 23d3d602 编写于 作者: G Greg Kroah-Hartman

[PATCH] driver core: change bus_rescan_devices to return void

No one was looking at the return value of bus_rescan_devices, and it
really wasn't anything that anyone in the kernel would ever care about.
So change it which enabled some counting code to be removed also.
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 afdce75f
...@@ -483,31 +483,22 @@ void bus_remove_driver(struct device_driver * drv) ...@@ -483,31 +483,22 @@ void bus_remove_driver(struct device_driver * drv)
/* Helper for bus_rescan_devices's iter */ /* Helper for bus_rescan_devices's iter */
static int bus_rescan_devices_helper(struct device *dev, void *data) static int bus_rescan_devices_helper(struct device *dev, void *data)
{ {
int *count = data; if (!dev->driver)
device_attach(dev);
if (!dev->driver && (device_attach(dev) > 0))
(*count)++;
return 0; return 0;
} }
/** /**
* bus_rescan_devices - rescan devices on the bus for possible drivers * bus_rescan_devices - rescan devices on the bus for possible drivers
* @bus: the bus to scan. * @bus: the bus to scan.
* *
* This function will look for devices on the bus with no driver * This function will look for devices on the bus with no driver
* attached and rescan it against existing drivers to see if it * attached and rescan it against existing drivers to see if it matches
* matches any. Calls device_attach(). Returns the number of devices * any by calling device_attach() for the unbound devices.
* that were sucessfully bound to a driver.
*/ */
int bus_rescan_devices(struct bus_type * bus) void bus_rescan_devices(struct bus_type * bus)
{ {
int count = 0; bus_for_each_dev(bus, NULL, NULL, bus_rescan_devices_helper);
bus_for_each_dev(bus, NULL, &count, bus_rescan_devices_helper);
return count;
} }
......
...@@ -69,7 +69,7 @@ struct bus_type { ...@@ -69,7 +69,7 @@ struct bus_type {
extern int bus_register(struct bus_type * bus); extern int bus_register(struct bus_type * bus);
extern void bus_unregister(struct bus_type * bus); extern void bus_unregister(struct bus_type * bus);
extern int bus_rescan_devices(struct bus_type * bus); extern void bus_rescan_devices(struct bus_type * bus);
extern struct bus_type * get_bus(struct bus_type * bus); extern struct bus_type * get_bus(struct bus_type * bus);
extern void put_bus(struct bus_type * bus); extern void put_bus(struct bus_type * bus);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册