greybus: connection: kill GB_PROTOCOL_SKIP_SVC_CONNECTION
authorJohan Hovold <johan@hovoldconsulting.com>
Wed, 25 Nov 2015 14:59:13 +0000 (15:59 +0100)
committerGreg Kroah-Hartman <gregkh@google.com>
Wed, 25 Nov 2015 23:34:19 +0000 (15:34 -0800)
Add helper to determine whether a connection is static, and remove the
protocol flag GB_PROTOCOL_SKIP_SVC_CONNECTION.

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

index a7b803799fa59629db8f101e98b951ccb017662d..3f2fe01035472c8057e670414a4982594ff29900 100644 (file)
@@ -289,11 +289,10 @@ static int
 gb_connection_svc_connection_create(struct gb_connection *connection)
 {
        struct gb_host_device *hd = connection->hd;
-       struct gb_protocol *protocol = connection->protocol;
        struct gb_interface *intf;
        int ret;
 
-       if (protocol->flags & GB_PROTOCOL_SKIP_SVC_CONNECTION)
+       if (gb_connection_is_static(connection))
                return 0;
 
        intf = connection->bundle->intf;
@@ -315,7 +314,7 @@ gb_connection_svc_connection_create(struct gb_connection *connection)
 static void
 gb_connection_svc_connection_destroy(struct gb_connection *connection)
 {
-       if (connection->protocol->flags & GB_PROTOCOL_SKIP_SVC_CONNECTION)
+       if (gb_connection_is_static(connection))
                return;
 
        gb_svc_connection_destroy(connection->hd->svc,
index c5499fcbfd131b9a214173fe5dbb7a1484c933ce..446ffe157a12cdab054061319ad80983fe9dd28e 100644 (file)
@@ -60,6 +60,11 @@ struct gb_connection *gb_connection_create_dynamic(struct gb_interface *intf,
                                u8 protocol_id);
 void gb_connection_destroy(struct gb_connection *connection);
 
+static inline bool gb_connection_is_static(struct gb_connection *connection)
+{
+       return !connection->intf;
+}
+
 void greybus_data_rcvd(struct gb_host_device *hd, u16 cport_id,
                        u8 *data, size_t length);
 
index b1d122c61c44a57b98807d1ac4e225501907978a..384ddf8d16000ae2d1c81b3576ebcc8597e949af 100644 (file)
@@ -18,7 +18,6 @@ struct gb_operation;
 #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 */
-#define GB_PROTOCOL_SKIP_SVC_CONNECTION                BIT(4)  /* Don't send SVC connection requests */
 
 typedef int (*gb_connection_init_t)(struct gb_connection *);
 typedef void (*gb_connection_exit_t)(struct gb_connection *);
index 9dd51122ea4c2fa672045f23b362b2e4f53b9d11..3beb3a2dfb87adbbe42a8a92357183f291663bad 100644 (file)
@@ -750,7 +750,6 @@ static struct gb_protocol svc_protocol = {
        .flags                  = GB_PROTOCOL_SKIP_CONTROL_CONNECTED |
                                  GB_PROTOCOL_SKIP_CONTROL_DISCONNECTED |
                                  GB_PROTOCOL_NO_BUNDLE |
-                                 GB_PROTOCOL_SKIP_VERSION |
-                                 GB_PROTOCOL_SKIP_SVC_CONNECTION,
+                                 GB_PROTOCOL_SKIP_VERSION,
 };
 gb_builtin_protocol_driver(svc_protocol);