summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/core.c
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2015-07-28 07:28:42 +0530
committerGreg Kroah-Hartman <gregkh@google.com>2015-07-28 14:47:03 -0700
commit9612f2bcd466364a244b8c2a012de69abd8fb258 (patch)
treef2e09c190bde9011e70879e12d78664edb317ed6 /drivers/staging/greybus/core.c
parentfe166c6a2b9225d71b1b4f1035603e189f6c3640 (diff)
downloadop-kernel-dev-9612f2bcd466364a244b8c2a012de69abd8fb258.zip
op-kernel-dev-9612f2bcd466364a244b8c2a012de69abd8fb258.tar.gz
greybus: initialize svc connection while creating hd
Its really part of initializing the host device and is required for every 'hd' that is created. Lets move the call to do basic initialization of svc connection to greybus_create_hd(). Also add a comment to specify why we need to do it that early. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/core.c')
-rw-r--r--drivers/staging/greybus/core.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/staging/greybus/core.c b/drivers/staging/greybus/core.c
index 7d5cd99..9f105fb 100644
--- a/drivers/staging/greybus/core.c
+++ b/drivers/staging/greybus/core.c
@@ -208,6 +208,21 @@ struct greybus_host_device *greybus_create_hd(struct greybus_host_driver *driver
ida_init(&hd->cport_id_map);
hd->buffer_size_max = buffer_size_max;
+ /*
+ * Initialize AP's SVC protocol connection:
+ *
+ * This is required as part of early initialization of the host device
+ * as we need this connection in order to start any kind of message
+ * exchange between the AP and the SVC. SVC will start with a
+ * 'get-version' request followed by a 'svc-hello' message and at that
+ * time we will create a fully initialized svc-connection, as we need
+ * endo-id and AP's interface id for that.
+ */
+ if (!gb_ap_svc_connection_create(hd)) {
+ kref_put_mutex(&hd->kref, free_hd, &hd_mutex);
+ return ERR_PTR(-ENOMEM);
+ }
+
return hd;
}
EXPORT_SYMBOL_GPL(greybus_create_hd);
OpenPOWER on IntegriCloud