]> git.karo-electronics.de Git - linux-beck.git/commitdiff
greybus: connection: add helper to create control connections
authorJohan Hovold <johan@hovoldconsulting.com>
Thu, 21 Jan 2016 16:34:12 +0000 (17:34 +0100)
committerGreg Kroah-Hartman <gregkh@google.com>
Fri, 22 Jan 2016 06:45:09 +0000 (22:45 -0800)
Add dedicated helper to create control connections.

This will allow us to simplify the generic (dynamic) interface.

Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/connection.c
drivers/staging/greybus/connection.h
drivers/staging/greybus/control.c

index 9b8112bd16a009dffcbd2649ae1d1412703c875e..f81f053a2e98fe7d1810cd933801362624cd4b31 100644 (file)
@@ -222,6 +222,12 @@ gb_connection_create_static(struct gb_host_device *hd, u16 hd_cport_id)
        return gb_connection_create(hd, hd_cport_id, NULL, NULL, 0, 0);
 }
 
+struct gb_connection *
+gb_connection_create_control(struct gb_interface *intf)
+{
+       return gb_connection_create(intf->hd, -1, intf, NULL, 0, 0);
+}
+
 struct gb_connection *
 gb_connection_create_dynamic(struct gb_interface *intf,
                                        struct gb_bundle *bundle,
index 562bd2b47ac5b238b9fda54c5b324e8bbd32b7e9..cd4a093f6e9b75f4c863587f4a4be29879014645 100644 (file)
@@ -57,6 +57,7 @@ struct gb_connection {
 
 struct gb_connection *gb_connection_create_static(struct gb_host_device *hd,
                                u16 hd_cport_id);
+struct gb_connection *gb_connection_create_control(struct gb_interface *intf);
 struct gb_connection *gb_connection_create_dynamic(struct gb_interface *intf,
                                struct gb_bundle *bundle, u16 cport_id,
                                u8 protocol_id);
index 0e50fd419f3a6e4f2d8d0c7f6848693b52b1a367..a766ec8b0228cdc408e72e9d57e9b053861f56f0 100644 (file)
@@ -186,9 +186,7 @@ struct gb_control *gb_control_create(struct gb_interface *intf)
        if (!control)
                return NULL;
 
-       control->connection = gb_connection_create_dynamic(intf, NULL,
-                                               GB_CONTROL_CPORT_ID,
-                                               GREYBUS_PROTOCOL_CONTROL);
+       control->connection = gb_connection_create_control(intf);
        if (!control->connection) {
                dev_err(&intf->dev, "failed to create control connection\n");
                kfree(control);