summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/module.c
diff options
context:
space:
mode:
authorAlex Elder <elder@linaro.org>2014-10-22 02:04:32 -0500
committerGreg Kroah-Hartman <greg@kroah.com>2014-10-22 17:22:22 +0800
commitc41b4f121240df46e5d901ad8aa9b9051b6c58e1 (patch)
treeecdce71ca5de3935ab367764abfc6ade618a9268 /drivers/staging/greybus/module.c
parent525f1467bc22ad7d0866444b3a57c21ba64a0dd2 (diff)
downloadlinux-c41b4f121240df46e5d901ad8aa9b9051b6c58e1.tar.gz
linux-c41b4f121240df46e5d901ad8aa9b9051b6c58e1.tar.bz2
linux-c41b4f121240df46e5d901ad8aa9b9051b6c58e1.zip
greybus: only initialize interfaces when up
Rather than bringing up all interfaces described in the manifest, wait until we get a link up message, and at that time go initialize the link. Signed-off-by: Alex Elder <elder@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.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/drivers/staging/greybus/module.c b/drivers/staging/greybus/module.c
index 50139f41fe20..bcb0ff098164 100644
--- a/drivers/staging/greybus/module.c
+++ b/drivers/staging/greybus/module.c
@@ -118,15 +118,25 @@ struct gb_module *gb_module_find(struct greybus_host_device *hd, u8 module_id)
return NULL;
}
-void gb_module_interfaces_init(struct gb_module *gmod)
+int
+gb_module_interface_init(struct gb_module *gmod, u8 interface_id, u8 device_id)
{
struct gb_interface *interface;
- int ret = 0;
+ int ret;
- list_for_each_entry(interface, &gmod->interfaces, links) {
- ret = gb_interface_connections_init(interface);
- if (ret)
- dev_err(gmod->hd->parent,
- "module interface init error %d\n", ret);
+ interface = gb_interface_find(gmod, interface_id);
+ if (!interface) {
+ dev_err(gmod->hd->parent, "module %hhu not found\n",
+ interface_id);
+ return -ENOENT;
}
+ ret = gb_interface_connections_init(interface);
+ if (ret) {
+ dev_err(gmod->hd->parent, "module interface init error %d\n",
+ ret);
+ return ret;
+ }
+ interface->device_id = device_id;
+
+ return svc_set_route_send(interface, gmod->hd);
}