summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/manifest.c
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2015-06-22 16:42:27 +0530
committerGreg Kroah-Hartman <gregkh@google.com>2015-06-23 23:16:15 -0700
commit6c68da264b080f749e8848b0227e6bb7d7c72f21 (patch)
tree9092b29b987a070bf14d925dfd3e10d1bc3821bb /drivers/staging/greybus/manifest.c
parentcdee4f7505dbb06671a41f63b295d3d7680d760c (diff)
greybus: interface: Get manifest using Control protocol
Control protocol is ready to be used for fetching manifest. Lets do it. This changes few things: - Creates/initializes bundle/connection for control protocol initially and skips doing the same later. - Manifest is parsed at link-up now, instead of hotplug which was the case earlier. This is because we need device_id (provided during link-up) for registering bundle. - Manifest is fetched using control protocol. So the sequence of events is: Event Previously Now ----- ---------- --- Interface Hotplug create intf create intf parse mfst Interface Link Up init bundles create control conn get mfst size get mfst parse mfst init bundles Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/manifest.c')
-rw-r--r--drivers/staging/greybus/manifest.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/staging/greybus/manifest.c b/drivers/staging/greybus/manifest.c
index 377c449d5785..bd5753f8c384 100644
--- a/drivers/staging/greybus/manifest.c
+++ b/drivers/staging/greybus/manifest.c
@@ -225,11 +225,17 @@ static u32 gb_manifest_parse_cports(struct gb_bundle *bundle)
if (cport_id > CPORT_ID_MAX)
goto cleanup;
+ /* Don't recreate connection for control cport */
+ if (cport_id == GB_CONTROL_CPORT_ID)
+ goto release_descriptor;
+
/* Found one. Set up its function structure */
protocol_id = desc_cport->protocol_id;
+
if (!gb_connection_create(bundle, cport_id, protocol_id))
goto cleanup;
+release_descriptor:
count++;
/* Release the cport descriptor */
@@ -268,11 +274,19 @@ static u32 gb_manifest_parse_bundles(struct gb_interface *intf)
/* Found one. Set up its bundle structure*/
desc_bundle = desc->data;
+
+ /* Don't recreate bundle for control cport */
+ if (desc_bundle->id == GB_CONTROL_BUNDLE_ID) {
+ bundle = intf->control->connection->bundle;
+ goto parse_cports;
+ }
+
bundle = gb_bundle_create(intf, desc_bundle->id,
desc_bundle->class);
if (!bundle)
goto cleanup;
+parse_cports:
/* Now go set up this bundle's functions and cports */
if (!gb_manifest_parse_cports(bundle))
goto cleanup;