/* 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) {
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) {
.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);
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 *);
.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);