diff options
author | Johan Hovold <johan@hovoldconsulting.com> | 2015-12-07 15:05:43 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2015-12-08 15:56:38 -0500 |
commit | a7e36d0eac7fe9d8c66547ac4ec660b026ca4691 (patch) | |
tree | 29711b15c480e8aa73586198ca5789872d2c07ec /drivers/staging/greybus/manifest.c | |
parent | bdc37354aa933d299c959144487eba777e707b63 (diff) | |
download | linux-a7e36d0eac7fe9d8c66547ac4ec660b026ca4691.tar.bz2 |
greybus: bundle: separate bundle creation and registration
Separate bundle creation and registration.
Note that the bundle connections still needs to be initialised post
registration as protocol drivers create child devices to the bundle.
This will ultimately allow connection structures to be created while
parsing manifests, but the connections to not be enabled until a driver
is bound.
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-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.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/drivers/staging/greybus/manifest.c b/drivers/staging/greybus/manifest.c index 8310f199f0f1..51201128498d 100644 --- a/drivers/staging/greybus/manifest.c +++ b/drivers/staging/greybus/manifest.c @@ -236,7 +236,6 @@ static u32 gb_manifest_parse_cports(struct gb_bundle *bundle) u8 protocol_id; u16 cport_id; u32 count = 0; - int ret; /* Set up all cport descriptors associated with this bundle */ list_for_each_entry_safe(desc, next, &intf->manifest_descs, links) { @@ -262,12 +261,6 @@ static u32 gb_manifest_parse_cports(struct gb_bundle *bundle) if (!connection) goto exit; - ret = gb_connection_init(connection); - if (ret) { - gb_connection_destroy(connection); - goto exit; - } - count++; /* Release the cport descriptor */ @@ -293,12 +286,14 @@ exit: */ static u32 gb_manifest_parse_bundles(struct gb_interface *intf) { + struct gb_connection *connection; struct manifest_desc *desc; struct gb_bundle *bundle; struct gb_bundle *bundle_next; u32 count = 0; u8 bundle_id; u8 class; + int ret; while ((desc = get_next_bundle_desc(intf))) { struct greybus_descriptor_bundle *desc_bundle; @@ -354,6 +349,23 @@ static u32 gb_manifest_parse_bundles(struct gb_interface *intf) continue; } + ret = gb_bundle_add(bundle); + if (ret) { + gb_bundle_destroy(bundle); + continue; + } + + list_for_each_entry(connection, &bundle->connections, + bundle_links) { + ret = gb_connection_init(connection); + if (ret) + break; + } + if (ret) { + gb_bundle_destroy(bundle); + continue; + } + count++; } |