Commit 33e86005 authored by Patrick Mochel's avatar Patrick Mochel

Implement find_bus() for finding a struct bus_type by name.

Simply, pass off to kset_find_obj() to iterate over list of buses and 
search for bus with certain name.
parent 7dd6e94e
...@@ -477,6 +477,21 @@ void put_bus(struct bus_type * bus) ...@@ -477,6 +477,21 @@ void put_bus(struct bus_type * bus)
subsys_put(&bus->subsys); subsys_put(&bus->subsys);
} }
/**
* find_bus - locate bus by name.
* @name: name of bus.
*
* Call kset_find_obj() to iterate over list of buses to
* find a bus by name. Return bus if found.
*/
struct bus_type * find_bus(char * name)
{
struct kobject * k = kset_find_obj(&bus_subsys.kset,name);
return k ? to_bus(k) : NULL;
}
/** /**
* bus_register - register a bus with the system. * bus_register - register a bus with the system.
* @bus: bus. * @bus: bus.
...@@ -539,6 +554,7 @@ EXPORT_SYMBOL(bus_register); ...@@ -539,6 +554,7 @@ EXPORT_SYMBOL(bus_register);
EXPORT_SYMBOL(bus_unregister); EXPORT_SYMBOL(bus_unregister);
EXPORT_SYMBOL(get_bus); EXPORT_SYMBOL(get_bus);
EXPORT_SYMBOL(put_bus); EXPORT_SYMBOL(put_bus);
EXPORT_SYMBOL(find_bus);
EXPORT_SYMBOL(bus_create_file); EXPORT_SYMBOL(bus_create_file);
EXPORT_SYMBOL(bus_remove_file); EXPORT_SYMBOL(bus_remove_file);
...@@ -82,6 +82,7 @@ extern void bus_unregister(struct bus_type * bus); ...@@ -82,6 +82,7 @@ extern void bus_unregister(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);
extern struct bus_type * find_bus(char * name);
/* iterator helpers for buses */ /* iterator helpers for buses */
......
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