diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2015-07-28 07:28:42 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2015-07-29 10:06:21 -0700 |
commit | e75b82bfc72533be25ce42241ca2d07b607ee705 (patch) | |
tree | 21a45bd2cdec7a3e419cc516642f81d7deb7fbdd /drivers/staging/greybus/core.c | |
parent | ca539a67c6a25e47233fdab67bdf1d4db00f883f (diff) | |
download | op-kernel-dev-e75b82bfc72533be25ce42241ca2d07b607ee705.zip op-kernel-dev-e75b82bfc72533be25ce42241ca2d07b607ee705.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.c | 15 |
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); |