summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/hd.c
diff options
context:
space:
mode:
authorJohan Hovold <johan@hovoldconsulting.com>2015-11-25 15:59:18 +0100
committerGreg Kroah-Hartman <gregkh@google.com>2015-11-25 15:34:19 -0800
commit5ef323846ff7d1c32e4fb2441dfc79b10d6092b3 (patch)
tree1a9287746669e0b8f78bace354c615a68006c1d2 /drivers/staging/greybus/hd.c
parent87757e325ab8b5b9e0e90e37de77778a631e6c8c (diff)
downloadop-kernel-dev-5ef323846ff7d1c32e4fb2441dfc79b10d6092b3.zip
op-kernel-dev-5ef323846ff7d1c32e4fb2441dfc79b10d6092b3.tar.gz
greybus: hd: fix svc-connection handling
Create the svc connection when registering the host-device and remove the current svc connection hacks that "upgraded" the svc connection once the endo id and ap interface id was known. Note that the old implementation was partly based on a misunderstanding as it was the remote interface id, rather than the local AP interface id, that used to define a connection (but we also needed the endo_id). The remote interface is no longer needed as static connections, such as the svc connection, are now simply defined by the host-device and host cport id. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/hd.c')
-rw-r--r--drivers/staging/greybus/hd.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/drivers/staging/greybus/hd.c b/drivers/staging/greybus/hd.c
index 88d2f01..2ee5d4f 100644
--- a/drivers/staging/greybus/hd.c
+++ b/drivers/staging/greybus/hd.c
@@ -98,6 +98,18 @@ struct gb_host_device *gb_hd_create(struct gb_hd_driver *driver,
}
EXPORT_SYMBOL_GPL(gb_hd_create);
+static int gb_hd_create_svc_connection(struct gb_host_device *hd)
+{
+ hd->svc_connection = gb_connection_create_static(hd, GB_SVC_CPORT_ID,
+ GREYBUS_PROTOCOL_SVC);
+ if (!hd->svc_connection) {
+ dev_err(&hd->dev, "failed to create svc connection\n");
+ return -ENOMEM;
+ }
+
+ return 0;
+}
+
int gb_hd_add(struct gb_host_device *hd)
{
int ret;
@@ -106,19 +118,10 @@ int gb_hd_add(struct gb_host_device *hd)
if (ret)
return ret;
- /*
- * 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)) {
+ ret = gb_hd_create_svc_connection(hd);
+ if (ret) {
device_del(&hd->dev);
- return -ENOMEM;
+ return ret;
}
return 0;
@@ -135,9 +138,7 @@ void gb_hd_del(struct gb_host_device *hd)
gb_interfaces_remove(hd);
gb_endo_remove(hd->endo);
- /* Is the SVC still using the partially uninitialized connection ? */
- if (hd->initial_svc_connection)
- gb_connection_destroy(hd->initial_svc_connection);
+ gb_connection_destroy(hd->svc_connection);
device_del(&hd->dev);
}
OpenPOWER on IntegriCloud