summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/interface.c
diff options
context:
space:
mode:
authorJohan Hovold <johan@hovoldconsulting.com>2016-03-09 12:20:36 +0100
committerGreg Kroah-Hartman <gregkh@google.com>2016-03-10 13:57:42 -0800
commit7a137fb290df63f24242fc4996decd0b339ba3b1 (patch)
treea977d0c2845747f32274a0b801cc855fcff38e02 /drivers/staging/greybus/interface.c
parent39495a2bea4d523c4d36f28f3739caa8d3a404c4 (diff)
downloadop-kernel-dev-7a137fb290df63f24242fc4996decd0b339ba3b1.zip
op-kernel-dev-7a137fb290df63f24242fc4996decd0b339ba3b1.tar.gz
greybus: interface: separate initialisation and registration
Separate interface initialisation from registration of the interface and its bundles. This is a step towards registering also interfaces that failed to initialise (e.g. a dummy interface). Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Jeffrey Carlyle <jcarlyle@google.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/interface.c')
-rw-r--r--drivers/staging/greybus/interface.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/drivers/staging/greybus/interface.c b/drivers/staging/greybus/interface.c
index 63dd285..a32e564 100644
--- a/drivers/staging/greybus/interface.c
+++ b/drivers/staging/greybus/interface.c
@@ -179,16 +179,12 @@ void gb_interfaces_remove(struct gb_host_device *hd)
gb_interface_remove(intf);
}
-/**
- * gb_interface_init
- *
- * Create connection for control CPort and then request/parse manifest.
- * Finally initialize all the bundles to set routes via SVC and initialize all
- * connections.
+/*
+ * Intialise an interface by enabling the control connection and fetching the
+ * manifest and other information over it.
*/
int gb_interface_init(struct gb_interface *intf)
{
- struct gb_bundle *bundle, *tmp;
int ret, size;
void *manifest;
@@ -236,11 +232,22 @@ int gb_interface_init(struct gb_interface *intf)
if (ret)
goto free_manifest;
- /* Register the interface and its bundles. */
+free_manifest:
+ kfree(manifest);
+
+ return ret;
+}
+
+/* Register an interface and its bundles. */
+int gb_interface_add(struct gb_interface *intf)
+{
+ struct gb_bundle *bundle, *tmp;
+ int ret;
+
ret = device_add(&intf->dev);
if (ret) {
dev_err(&intf->dev, "failed to register interface: %d\n", ret);
- goto free_manifest;
+ return ret;
}
dev_info(&intf->dev, "Interface added: VID=0x%08x, PID=0x%08x\n",
@@ -256,9 +263,5 @@ int gb_interface_init(struct gb_interface *intf)
}
}
- ret = 0;
-
-free_manifest:
- kfree(manifest);
- return ret;
+ return 0;
}
OpenPOWER on IntegriCloud