Commit 73009dd4 authored by Hollis Blanchard's avatar Hollis Blanchard Committed by Greg Kroah-Hartman

[PATCH] Driver Core: add device_find() function

Greg KH wrote:
>
> How about just adding a device_find() function to the driver core, where
> you pass in a name and a type, so that others can use it?

Something like this?
parent b989f180
......@@ -400,6 +400,14 @@ int device_for_each_child(struct device * dev, void * data,
return error;
}
struct device *device_find(const char *name, struct bus_type *bus)
{
struct kobject *k = kset_find_obj(&bus->devices, name);
if (k)
return to_dev(k);
return NULL;
}
int __init devices_init(void)
{
return subsystem_register(&devices_subsys);
......@@ -416,6 +424,7 @@ EXPORT_SYMBOL(device_unregister);
EXPORT_SYMBOL(device_unregister_wait);
EXPORT_SYMBOL(get_device);
EXPORT_SYMBOL(put_device);
EXPORT_SYMBOL(device_find);
EXPORT_SYMBOL(device_create_file);
EXPORT_SYMBOL(device_remove_file);
......@@ -354,6 +354,7 @@ extern int (*platform_notify_remove)(struct device * dev);
*/
extern struct device * get_device(struct device * dev);
extern void put_device(struct device * dev);
extern struct device *device_find(const char *name, struct bus_type *bus);
/* drivers/base/platform.c */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment