summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/manifest.c
diff options
context:
space:
mode:
authorJohan Hovold <johan@hovoldconsulting.com>2015-12-07 15:05:34 +0100
committerGreg Kroah-Hartman <gregkh@google.com>2015-12-08 15:31:14 -0500
commit0bf1f2441979e290945f4e5af40d76582c61da1e (patch)
tree9656af68832e9aa9594eac0acbbff2c64d5ae66a /drivers/staging/greybus/manifest.c
parent36173112354a4f5993d464f95b04d41e1eec10a0 (diff)
downloadlinux-0bf1f2441979e290945f4e5af40d76582c61da1e.tar.bz2
greybus: connection: separate connection creation and enabling
Separate connection creation from enabling. 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.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/staging/greybus/manifest.c b/drivers/staging/greybus/manifest.c
index 72400e38b392..2d470500222e 100644
--- a/drivers/staging/greybus/manifest.c
+++ b/drivers/staging/greybus/manifest.c
@@ -228,6 +228,7 @@ static char *gb_string_get(struct gb_interface *intf, u8 string_id)
*/
static u32 gb_manifest_parse_cports(struct gb_bundle *bundle)
{
+ struct gb_connection *connection;
struct gb_interface *intf = bundle->intf;
struct manifest_desc *desc;
struct manifest_desc *next;
@@ -235,6 +236,7 @@ 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) {
@@ -254,10 +256,18 @@ static u32 gb_manifest_parse_cports(struct gb_bundle *bundle)
/* Found one. Set up its function structure */
protocol_id = desc_cport->protocol_id;
- if (!gb_connection_create_dynamic(intf, bundle, cport_id,
- protocol_id))
+ connection = gb_connection_create_dynamic(intf, bundle,
+ cport_id,
+ protocol_id);
+ if (!connection)
goto exit;
+ ret = gb_connection_init(connection);
+ if (ret) {
+ gb_connection_destroy(connection);
+ goto exit;
+ }
+
count++;
/* Release the cport descriptor */