diff --git a/net/bluetooth/bluetooth.h b/net/bluetooth/bluetooth.h index c337b2cf1f..2053584442 100644 --- a/net/bluetooth/bluetooth.h +++ b/net/bluetooth/bluetooth.h @@ -31,6 +31,8 @@ #include #include +#include + #include #ifdef CONFIG_NET_BLUETOOTH @@ -42,9 +44,9 @@ /* Allocate a new Bluetooth socket data callback */ #define bluetooth_callback_alloc(dev,conn) \ - devif_callback_alloc(dev, &conn->bc_list, &conn->bc_list_tail) + devif_callback_alloc(dev, &conn->bc_conn.list, &conn->bc_conn.list_tail) #define bluetooth_callback_free(dev,conn,cb) \ - devif_conn_callback_free(dev, cb, &conn->bc_list, &conn->bc_list_tail) + devif_conn_callback_free(dev, cb, &conn->bc_conn.list, &conn->bc_conn.list_tail) /* Memory Pools */ @@ -78,14 +80,7 @@ struct bluetooth_conn_s { /* Common prologue of all connection structures. */ - dq_entry_t bc_node; /* Supports a doubly linked list */ - - /* This is a list of Bluetooth callbacks. Each callback represents - * a thread that is stalled, waiting for a device-specific event. - */ - - FAR struct devif_callback_s *bc_list; /* Bluetooth callbacks */ - FAR struct devif_callback_s *bc_list_tail; /* Bluetooth callbacks */ + struct socket_conn_s bc_conn; /* Bluetooth-specific content follows. */ diff --git a/net/bluetooth/bluetooth_callback.c b/net/bluetooth/bluetooth_callback.c index fc0cec48ac..3141182d5a 100644 --- a/net/bluetooth/bluetooth_callback.c +++ b/net/bluetooth/bluetooth_callback.c @@ -69,7 +69,8 @@ uint16_t bluetooth_callback(FAR struct radio_driver_s *radio, { /* Perform the callback */ - flags = devif_conn_event(&radio->r_dev, conn, flags, conn->bc_list); + flags = devif_conn_event(&radio->r_dev, conn, + flags, conn->bc_conn.list); } return flags; diff --git a/net/bluetooth/bluetooth_conn.c b/net/bluetooth/bluetooth_conn.c index 5b94fd6409..ad57aee7ce 100644 --- a/net/bluetooth/bluetooth_conn.c +++ b/net/bluetooth/bluetooth_conn.c @@ -102,7 +102,7 @@ void bluetooth_conn_initialize(void) { /* Link each pre-allocated connection structure into the free list. */ - dq_addlast(&g_bluetooth_connections[i].bc_node, + dq_addlast(&g_bluetooth_connections[i].bc_conn.node, &g_free_bluetooth_connections); } #endif @@ -135,7 +135,7 @@ FAR struct bluetooth_conn_s *bluetooth_conn_alloc(void) { for (i = 0; i < CONFIG_NET_BLUETOOTH_NCONNS; i++) { - dq_addlast(&conn[i].bc_node, + dq_addlast(&conn[i].bc_conn.node, &g_active_bluetooth_connections); } } @@ -152,7 +152,7 @@ FAR struct bluetooth_conn_s *bluetooth_conn_alloc(void) /* Enqueue the connection into the active list */ - dq_addlast(&conn->bc_node, &g_active_bluetooth_connections); + dq_addlast(&conn->bc_conn.node, &g_active_bluetooth_connections); } net_unlock(); @@ -180,7 +180,7 @@ void bluetooth_conn_free(FAR struct bluetooth_conn_s *conn) /* Remove the connection from the active list */ net_lock(); - dq_rem(&conn->bc_node, &g_active_bluetooth_connections); + dq_rem(&conn->bc_conn.node, &g_active_bluetooth_connections); /* Check if there any any frames attached to the container */ @@ -209,7 +209,7 @@ void bluetooth_conn_free(FAR struct bluetooth_conn_s *conn) /* Free the connection */ - dq_addlast(&conn->bc_node, &g_free_bluetooth_connections); + dq_addlast(&conn->bc_conn.node, &g_free_bluetooth_connections); net_unlock(); } @@ -236,7 +236,7 @@ FAR struct bluetooth_conn_s * for (conn = (FAR struct bluetooth_conn_s *)g_active_bluetooth_connections.head; conn != NULL; - conn = (FAR struct bluetooth_conn_s *)conn->bc_node.flink) + conn = (FAR struct bluetooth_conn_s *)conn->bc_conn.node.flink) { /* match protocol and channel first */ @@ -303,7 +303,7 @@ FAR struct bluetooth_conn_s * } else { - return (FAR struct bluetooth_conn_s *)conn->bc_node.flink; + return (FAR struct bluetooth_conn_s *)conn->bc_conn.node.flink; } }