summaryrefslogtreecommitdiff
path: root/drivers/staging/greybus/module.c
diff options
context:
space:
mode:
authorMatt Porter <mporter@linaro.org>2014-10-22 06:43:29 +0400
committerGreg Kroah-Hartman <greg@kroah.com>2014-10-22 09:57:49 +0400
commit6271b5bac99c2d06543adbdbecb9157d77765831 (patch)
tree9d6763570c72ccb014f396deb44cd80453bd561e /drivers/staging/greybus/module.c
parent0369a459982f58688235000fc8990b70e7553e6e (diff)
downloadlinux-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.c11
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;