greybus: svc: connection: ask SVC to create connections
authorPerry Hung <perry@leaflabs.com>
Fri, 24 Jul 2015 23:02:33 +0000 (19:02 -0400)
committerGreg Kroah-Hartman <gregkh@google.com>
Wed, 29 Jul 2015 17:06:18 +0000 (10:06 -0700)
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 <viresh.kumar@linaro.org>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Perry Hung <perry@leaflabs.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/connection.c
drivers/staging/greybus/greybus.h
drivers/staging/greybus/svc.c

index b32da8af68f47a9adc55a9a087105166ddca1564..1a657f706b93124303151ac521d057e1a6e9cb14 100644 (file)
@@ -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,
index 90f996276ca46792bf0535775b212c38b18cdfdc..ef11b960d1b764244d674d8929351b010959e2a7 100644 (file)
@@ -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));
index 3d1808712598b5463c5616ed58fe64f02087d7e5..b718a881a7e3555ac999d1f1b9b2c11836ed29f6 100644 (file)
@@ -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);
 }