-
- return 0;
-}
-
-/**
- * match_bus_device_to_driver: returns 1 if device is bound to driver
- * @driver: driver to match
- * @busid: busid of device to match
- * returns 1 if found and 0 if not found
- */
-static int match_bus_device_to_driver(struct sysfs_driver *driver,
- unsigned char *busid)
-{
- struct sysfs_link *cur = NULL;
- int found = 0;
-
- if (driver == NULL || driver->directory == NULL || busid == NULL) {
- errno = EINVAL;
- return found;
- }
- if (driver->directory->links != NULL) {
- dlist_for_each_data(driver->directory->links, cur,
- struct sysfs_link) {
- if ((strcmp(cur->name, busid)) == 0)
- found++;
- }
- }
- return found;
-}
-
-/**
- * link_bus_devices_to_drivers: goes through and links devices to drivers
- * @bus: bus to link
- */
-static void link_bus_devices_to_drivers(struct sysfs_bus *bus)
-{
- struct sysfs_device *dev = NULL;
- struct sysfs_driver *drv = NULL;
-
- if (bus != NULL && bus->devices != NULL && bus->drivers != NULL) {
- dlist_for_each_data(bus->devices, dev, struct sysfs_device) {
- dlist_for_each_data(bus->drivers, drv,
- struct sysfs_driver) {
- if ((match_bus_device_to_driver(drv,
- dev->bus_id)) != 0) {
- strncpy(dev->driver_name, drv->name,
- SYSFS_NAME_LEN);
- if (drv->devices == NULL)
- drv->devices = dlist_new
- (sizeof(struct
- sysfs_device));
- dlist_unshift(drv->devices, dev);
- }
- }
- }
- }