1
0
Fork 0

greybus: module: add gb_module_find()

Add support for getting a struct gb_module from a
Module ID.

Signed-off-by: Matt Porter <mporter@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
hifive-unleashed-5.1
Matt Porter 2014-10-21 22:43:29 -04:00 committed by Greg Kroah-Hartman
parent 0369a45998
commit 6271b5bac9
2 changed files with 14 additions and 0 deletions

View File

@ -107,6 +107,17 @@ void gb_module_destroy(struct gb_module *gmod)
kfree(gmod);
}
struct gb_module *gb_module_find(struct greybus_host_device *hd, u8 module_id)
{
struct gb_module *module;
list_for_each_entry(module, &hd->modules, links)
if (module->module_id == module_id)
return module;
return NULL;
}
void gb_module_interfaces_init(struct gb_module *gmod)
{
struct gb_interface *interface;

View File

@ -52,6 +52,9 @@ struct gb_module *gb_module_create(struct greybus_host_device *hd,
u8 module_id);
void gb_module_destroy(struct gb_module *module);
struct gb_module *gb_module_find(struct greybus_host_device *hd,
u8 module_id);
void gb_module_interfaces_init(struct gb_module *gmod);
#endif /* __MODULE_H */