]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
greybus: connection: remove skip-connected legacy protocol flags
authorJohan Hovold <johan@hovoldconsulting.com>
Tue, 19 Jan 2016 11:51:12 +0000 (12:51 +0100)
committerGreg Kroah-Hartman <gregkh@google.com>
Tue, 19 Jan 2016 20:17:13 +0000 (12:17 -0800)
Remove the legacy protocol flags that were used to suppress the
connected and disconnected events.

Instead send the connected and disconnected event for all bundle
connections and explicitly exclude static connections and control
connections.

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/control.c
drivers/staging/greybus/protocol.h
drivers/staging/greybus/svc.c

index c3207c828a450ce1acf4ce4b38da712e59e54299..3f644ca8759eb114c6d4df39d16b6e505b5c837c 100644 (file)
@@ -295,15 +295,17 @@ gb_connection_svc_connection_destroy(struct gb_connection *connection)
 /* Inform Interface about active CPorts */
 static int gb_connection_control_connected(struct gb_connection *connection)
 {
-       struct gb_protocol *protocol = connection->protocol;
        struct gb_control *control;
        u16 cport_id = connection->intf_cport_id;
        int ret;
 
-       if (protocol->flags & GB_PROTOCOL_SKIP_CONTROL_CONNECTED)
+       if (gb_connection_is_static(connection))
                return 0;
 
-       control = connection->bundle->intf->control;
+       control = connection->intf->control;
+
+       if (connection == control->connection)
+               return 0;
 
        ret = gb_control_connected_operation(control, cport_id);
        if (ret) {
@@ -319,15 +321,17 @@ static int gb_connection_control_connected(struct gb_connection *connection)
 static void
 gb_connection_control_disconnected(struct gb_connection *connection)
 {
-       struct gb_protocol *protocol = connection->protocol;
        struct gb_control *control;
        u16 cport_id = connection->intf_cport_id;
        int ret;
 
-       if (protocol->flags & GB_PROTOCOL_SKIP_CONTROL_DISCONNECTED)
+       if (gb_connection_is_static(connection))
                return;
 
-       control = connection->bundle->intf->control;
+       control = connection->intf->control;
+
+       if (connection == control->connection)
+               return;
 
        ret = gb_control_disconnected_operation(control, cport_id);
        if (ret) {
index 1c4994b846296f737382ccfe07b4a78ee9466143..12a9ecac4111f481f713546c88d569de0d6e3686 100644 (file)
@@ -159,7 +159,5 @@ static struct gb_protocol control_protocol = {
        .minor                  = GB_CONTROL_VERSION_MINOR,
        .connection_init        = gb_control_connection_init,
        .connection_exit        = gb_control_connection_exit,
-       .flags                  = GB_PROTOCOL_SKIP_CONTROL_CONNECTED |
-                                 GB_PROTOCOL_SKIP_CONTROL_DISCONNECTED,
 };
 gb_builtin_protocol_driver(control_protocol);
index f24281b39db5b817780b76a5490e781a4dd5085d..1f25c13bb0e8778f312d33681d12e2cf274d18bf 100644 (file)
@@ -14,8 +14,6 @@ struct gb_connection;
 struct gb_operation;
 
 /* Possible flags for protocol drivers */
-#define GB_PROTOCOL_SKIP_CONTROL_CONNECTED     BIT(0)  /* Don't sent connected requests */
-#define GB_PROTOCOL_SKIP_CONTROL_DISCONNECTED  BIT(1)  /* Don't sent disconnected requests */
 #define GB_PROTOCOL_SKIP_VERSION               BIT(3)  /* Don't send get_version() requests */
 
 typedef int (*gb_connection_init_t)(struct gb_connection *);
index 0bbcddaefbb4716a3574102d16d342ca1b5b0fc5..245cf4d43570ab17c941b6d23856d681960d0084 100644 (file)
@@ -864,8 +864,6 @@ static struct gb_protocol svc_protocol = {
        .connection_init        = gb_svc_connection_init,
        .connection_exit        = gb_svc_connection_exit,
        .request_recv           = gb_svc_request_recv,
-       .flags                  = GB_PROTOCOL_SKIP_CONTROL_CONNECTED |
-                                 GB_PROTOCOL_SKIP_CONTROL_DISCONNECTED |
-                                 GB_PROTOCOL_SKIP_VERSION,
+       .flags                  = GB_PROTOCOL_SKIP_VERSION,
 };
 gb_builtin_protocol_driver(svc_protocol);