diff options
author | Matt Porter <mporter@linaro.org> | 2014-10-22 06:43:29 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <greg@kroah.com> | 2014-10-22 09:57:49 +0400 |
commit | 6271b5bac99c2d06543adbdbecb9157d77765831 (patch) | |
tree | 9d6763570c72ccb014f396deb44cd80453bd561e /drivers/staging/greybus/module.c | |
parent | 0369a459982f58688235000fc8990b70e7553e6e (diff) | |
download | linux-6271b5bac99c2d06543adbdbecb9157d77765831.tar.xz |
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>
Diffstat (limited to 'drivers/staging/greybus/module.c')
-rw-r--r-- | drivers/staging/greybus/module.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/staging/greybus/module.c b/drivers/staging/greybus/module.c index 2883947fb630..50139f41fe20 100644 --- a/drivers/staging/greybus/module.c +++ b/drivers/staging/greybus/module.c @@ -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; |