From 75a60ed20d1ad58983e04dee27faae454e81d6a5 Mon Sep 17 00:00:00 2001 From: Perry Hung Date: Fri, 24 Jul 2015 19:02:33 -0400 Subject: [PATCH] greybus: svc: connection: ask SVC to create connections Ask the SVC to do all the necessary bits for creating a new connection. This is skipped for the initial SVC connection. Tested-by: Viresh Kumar Reviewed-by: Viresh Kumar Signed-off-by: Perry Hung Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/connection.c | 7 ++++++- drivers/staging/greybus/greybus.h | 1 + drivers/staging/greybus/svc.c | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/staging/greybus/connection.c b/drivers/staging/greybus/connection.c index b32da8af68f4..1a657f706b93 100644 --- a/drivers/staging/greybus/connection.c +++ b/drivers/staging/greybus/connection.c @@ -251,7 +251,12 @@ gb_connection_create_range(struct greybus_host_device *hd, spin_unlock_irq(&gb_connections_lock); - /* XXX Will have to establish connections to get version */ + if (hd_cport_id != GB_SVC_CPORT_ID) { + gb_svc_connection_create(hd->svc, + hd->endo->ap_intf_id, hd_cport_id, + bundle->intf->interface_id, cport_id); + } + gb_connection_bind_protocol(connection); if (!connection->protocol) dev_warn(&connection->dev, diff --git a/drivers/staging/greybus/greybus.h b/drivers/staging/greybus/greybus.h index 90f996276ca4..ef11b960d1b7 100644 --- a/drivers/staging/greybus/greybus.h +++ b/drivers/staging/greybus/greybus.h @@ -103,6 +103,7 @@ struct greybus_host_device { struct gb_endo *endo; struct gb_connection *initial_svc_connection; + struct gb_svc *svc; /* Private data for the host driver */ unsigned long hd_priv[0] __aligned(sizeof(s64)); diff --git a/drivers/staging/greybus/svc.c b/drivers/staging/greybus/svc.c index 3d1808712598..b718a881a7e3 100644 --- a/drivers/staging/greybus/svc.c +++ b/drivers/staging/greybus/svc.c @@ -430,6 +430,7 @@ static int gb_svc_connection_init(struct gb_connection *connection) if (!svc) return -ENOMEM; + connection->hd->svc = svc; svc->connection = connection; connection->private = svc; @@ -445,6 +446,7 @@ static void gb_svc_connection_exit(struct gb_connection *connection) { struct gb_svc *svc = connection->private; + connection->hd->svc = NULL; connection->private = NULL; kfree(svc); } -- 2.11.0