greybus: connection: unconditionally enable connections
authorJohan Hovold <johan@hovoldconsulting.com>
Wed, 25 Nov 2015 14:59:24 +0000 (15:59 +0100)
committerGreg Kroah-Hartman <gregkh@google.com>
Wed, 25 Nov 2015 23:39:16 +0000 (15:39 -0800)
Remove conditional enabling of connections when binding protocols that
served no purpose as a connection either has no bundle or it has an
interface with a valid device id.

Also remove the now unused GB_PROTOCOL_NO_BUNDLE protocol flag.

This is an intermediate step in moving the protocol binding to
connection_init, but is also needed as the control bundle is going away.

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

index 7dde8a11935e5838af9d17d9a4e3e151b8774cfd..2b078466854795c1c0e4c483c626699fce3e7fae 100644 (file)
@@ -541,19 +541,11 @@ int gb_connection_bind_protocol(struct gb_connection *connection)
        }
        connection->protocol = protocol;
 
-       /*
-        * If we have a valid device_id for the interface block, then we have an
-        * active device, so bring up the connection at the same time.
-        */
-       if ((!connection->bundle &&
-            protocol->flags & GB_PROTOCOL_NO_BUNDLE) ||
-           connection->bundle->intf->device_id != GB_DEVICE_ID_BAD) {
-               ret = gb_connection_init(connection);
-               if (ret) {
-                       gb_protocol_put(protocol);
-                       connection->protocol = NULL;
-                       return ret;
-               }
+       ret = gb_connection_init(connection);
+       if (ret) {
+               gb_protocol_put(protocol);
+               connection->protocol = NULL;
+               return ret;
        }
 
        return 0;
index 384ddf8d16000ae2d1c81b3576ebcc8597e949af..f24281b39db5b817780b76a5490e781a4dd5085d 100644 (file)
@@ -16,7 +16,6 @@ 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_NO_BUNDLE                  BIT(2)  /* Protocol May have a bundle-less connection */
 #define GB_PROTOCOL_SKIP_VERSION               BIT(3)  /* Don't send get_version() requests */
 
 typedef int (*gb_connection_init_t)(struct gb_connection *);
index 42cc7e9a20a49dd88e78a5f780555913ca7e40a9..f9ca08b34cd0f1638a2635f44bc891ff20125128 100644 (file)
@@ -678,7 +678,6 @@ static struct gb_protocol svc_protocol = {
        .request_recv           = gb_svc_request_recv,
        .flags                  = GB_PROTOCOL_SKIP_CONTROL_CONNECTED |
                                  GB_PROTOCOL_SKIP_CONTROL_DISCONNECTED |
-                                 GB_PROTOCOL_NO_BUNDLE |
                                  GB_PROTOCOL_SKIP_VERSION,
 };
 gb_builtin_protocol_driver(svc_protocol);