This function really is a bus function, not a driver one, so move it from driver.c to bus.c so that we can clean up some internal bus logic easier.
Showing the changes to drivers/base/driver.c (1 of 2 files). Show all
Unified · Split
| @@ -274,30 +274,3 @@ void driver_unregister(struct device_driver *drv) · 273 unmodified lines | |||
| 274 | bus_remove_driver(drv); | 274 | bus_remove_driver(drv); |
| 275 | } | 275 | } |
| 276 | EXPORT_SYMBOL_GPL(driver_unregister); | 276 | EXPORT_SYMBOL_GPL(driver_unregister); |
| 277 | |||
| 278 | /** | ||
| 279 | * driver_find - locate driver on a bus by its name. | ||
| 280 | * @name: name of the driver. | ||
| 281 | * @bus: bus to scan for the driver. | ||
| 282 | * | ||
| 283 | * Call kset_find_obj() to iterate over list of drivers on | ||
| 284 | * a bus to find driver by name. Return driver if found. | ||
| 285 | * | ||
| 286 | * This routine provides no locking to prevent the driver it returns | ||
| 287 | * from being unregistered or unloaded while the caller is using it. | ||
| 288 | * The caller is responsible for preventing this. | ||
| 289 | */ | ||
| 290 | struct device_driver *driver_find(const char *name, struct bus_type *bus) | ||
| 291 | { | ||
| 292 | struct kobject *k = kset_find_obj(bus->p->drivers_kset, name); | ||
| 293 | struct driver_private *priv; | ||
| 294 | |||
| 295 | if (k) { | ||
| 296 | /* Drop reference added by kset_find_obj() */ | ||
| 297 | kobject_put(k); | ||
| 298 | priv = to_driver(k); | ||
| 299 | return priv->driver; | ||
| 300 | } | ||
| 301 | return NULL; | ||
| 302 | } | ||
| 303 | EXPORT_SYMBOL_GPL(driver_find); | ||