Bluetooth: remove struct hci_chan_hash
Only the list member of the struct was used, so we now fold it into hci_conn. Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
This commit is contained in:
@@ -67,12 +67,6 @@ struct hci_conn_hash {
|
|||||||
unsigned int le_num;
|
unsigned int le_num;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct hci_chan_hash {
|
|
||||||
struct list_head list;
|
|
||||||
spinlock_t lock;
|
|
||||||
unsigned int num;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct bdaddr_list {
|
struct bdaddr_list {
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
bdaddr_t bdaddr;
|
bdaddr_t bdaddr;
|
||||||
@@ -301,7 +295,7 @@ struct hci_conn {
|
|||||||
unsigned int sent;
|
unsigned int sent;
|
||||||
|
|
||||||
struct sk_buff_head data_q;
|
struct sk_buff_head data_q;
|
||||||
struct hci_chan_hash chan_hash;
|
struct list_head chan_list;
|
||||||
|
|
||||||
struct timer_list disc_timer;
|
struct timer_list disc_timer;
|
||||||
struct timer_list idle_timer;
|
struct timer_list idle_timer;
|
||||||
@@ -390,7 +384,6 @@ static inline void hci_conn_hash_init(struct hci_dev *hdev)
|
|||||||
{
|
{
|
||||||
struct hci_conn_hash *h = &hdev->conn_hash;
|
struct hci_conn_hash *h = &hdev->conn_hash;
|
||||||
INIT_LIST_HEAD(&h->list);
|
INIT_LIST_HEAD(&h->list);
|
||||||
spin_lock_init(&h->lock);
|
|
||||||
h->acl_num = 0;
|
h->acl_num = 0;
|
||||||
h->sco_num = 0;
|
h->sco_num = 0;
|
||||||
}
|
}
|
||||||
@@ -492,28 +485,6 @@ static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void hci_chan_hash_init(struct hci_conn *c)
|
|
||||||
{
|
|
||||||
struct hci_chan_hash *h = &c->chan_hash;
|
|
||||||
INIT_LIST_HEAD(&h->list);
|
|
||||||
spin_lock_init(&h->lock);
|
|
||||||
h->num = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void hci_chan_hash_add(struct hci_conn *c, struct hci_chan *chan)
|
|
||||||
{
|
|
||||||
struct hci_chan_hash *h = &c->chan_hash;
|
|
||||||
list_add(&chan->list, &h->list);
|
|
||||||
h->num++;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void hci_chan_hash_del(struct hci_conn *c, struct hci_chan *chan)
|
|
||||||
{
|
|
||||||
struct hci_chan_hash *h = &c->chan_hash;
|
|
||||||
list_del(&chan->list);
|
|
||||||
h->num--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void hci_acl_connect(struct hci_conn *conn);
|
void hci_acl_connect(struct hci_conn *conn);
|
||||||
void hci_acl_disconn(struct hci_conn *conn, __u8 reason);
|
void hci_acl_disconn(struct hci_conn *conn, __u8 reason);
|
||||||
void hci_add_sco(struct hci_conn *conn, __u16 handle);
|
void hci_add_sco(struct hci_conn *conn, __u16 handle);
|
||||||
@@ -527,7 +498,7 @@ void hci_conn_check_pending(struct hci_dev *hdev);
|
|||||||
|
|
||||||
struct hci_chan *hci_chan_create(struct hci_conn *conn);
|
struct hci_chan *hci_chan_create(struct hci_conn *conn);
|
||||||
int hci_chan_del(struct hci_chan *chan);
|
int hci_chan_del(struct hci_chan *chan);
|
||||||
void hci_chan_hash_flush(struct hci_conn *conn);
|
void hci_chan_list_flush(struct hci_conn *conn);
|
||||||
|
|
||||||
struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst,
|
struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst,
|
||||||
__u8 sec_level, __u8 auth_type);
|
__u8 sec_level, __u8 auth_type);
|
||||||
|
@@ -374,7 +374,7 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst)
|
|||||||
|
|
||||||
skb_queue_head_init(&conn->data_q);
|
skb_queue_head_init(&conn->data_q);
|
||||||
|
|
||||||
hci_chan_hash_init(conn);
|
INIT_LIST_HEAD(&conn->chan_list);;
|
||||||
|
|
||||||
setup_timer(&conn->disc_timer, hci_conn_timeout, (unsigned long)conn);
|
setup_timer(&conn->disc_timer, hci_conn_timeout, (unsigned long)conn);
|
||||||
setup_timer(&conn->idle_timer, hci_conn_idle, (unsigned long)conn);
|
setup_timer(&conn->idle_timer, hci_conn_idle, (unsigned long)conn);
|
||||||
@@ -434,7 +434,7 @@ int hci_conn_del(struct hci_conn *conn)
|
|||||||
|
|
||||||
tasklet_disable(&hdev->tx_task);
|
tasklet_disable(&hdev->tx_task);
|
||||||
|
|
||||||
hci_chan_hash_flush(conn);
|
hci_chan_list_flush(conn);
|
||||||
|
|
||||||
hci_conn_hash_del(hdev, conn);
|
hci_conn_hash_del(hdev, conn);
|
||||||
if (hdev->notify)
|
if (hdev->notify)
|
||||||
@@ -970,7 +970,7 @@ struct hci_chan *hci_chan_create(struct hci_conn *conn)
|
|||||||
skb_queue_head_init(&chan->data_q);
|
skb_queue_head_init(&chan->data_q);
|
||||||
|
|
||||||
tasklet_disable(&hdev->tx_task);
|
tasklet_disable(&hdev->tx_task);
|
||||||
hci_chan_hash_add(conn, chan);
|
list_add(&conn->chan_list, &chan->list);
|
||||||
tasklet_enable(&hdev->tx_task);
|
tasklet_enable(&hdev->tx_task);
|
||||||
|
|
||||||
return chan;
|
return chan;
|
||||||
@@ -984,7 +984,7 @@ int hci_chan_del(struct hci_chan *chan)
|
|||||||
BT_DBG("%s conn %p chan %p", hdev->name, conn, chan);
|
BT_DBG("%s conn %p chan %p", hdev->name, conn, chan);
|
||||||
|
|
||||||
tasklet_disable(&hdev->tx_task);
|
tasklet_disable(&hdev->tx_task);
|
||||||
hci_chan_hash_del(conn, chan);
|
list_del(&chan->list);
|
||||||
tasklet_enable(&hdev->tx_task);
|
tasklet_enable(&hdev->tx_task);
|
||||||
|
|
||||||
skb_queue_purge(&chan->data_q);
|
skb_queue_purge(&chan->data_q);
|
||||||
@@ -993,13 +993,12 @@ int hci_chan_del(struct hci_chan *chan)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void hci_chan_hash_flush(struct hci_conn *conn)
|
void hci_chan_list_flush(struct hci_conn *conn)
|
||||||
{
|
{
|
||||||
struct hci_chan_hash *h = &conn->chan_hash;
|
|
||||||
struct hci_chan *chan, *tmp;
|
struct hci_chan *chan, *tmp;
|
||||||
|
|
||||||
BT_DBG("conn %p", conn);
|
BT_DBG("conn %p", conn);
|
||||||
|
|
||||||
list_for_each_entry_safe(chan, tmp, &h->list, list)
|
list_for_each_entry_safe(chan, tmp, &conn->chan_list, list)
|
||||||
hci_chan_del(chan);
|
hci_chan_del(chan);
|
||||||
}
|
}
|
||||||
|
@@ -2125,7 +2125,6 @@ static inline struct hci_chan *hci_chan_sent(struct hci_dev *hdev, __u8 type,
|
|||||||
BT_DBG("%s", hdev->name);
|
BT_DBG("%s", hdev->name);
|
||||||
|
|
||||||
list_for_each_entry(conn, &h->list, list) {
|
list_for_each_entry(conn, &h->list, list) {
|
||||||
struct hci_chan_hash *ch;
|
|
||||||
struct hci_chan *tmp;
|
struct hci_chan *tmp;
|
||||||
|
|
||||||
if (conn->type != type)
|
if (conn->type != type)
|
||||||
@@ -2136,9 +2135,7 @@ static inline struct hci_chan *hci_chan_sent(struct hci_dev *hdev, __u8 type,
|
|||||||
|
|
||||||
conn_num++;
|
conn_num++;
|
||||||
|
|
||||||
ch = &conn->chan_hash;
|
list_for_each_entry(tmp, &conn->chan_list, list) {
|
||||||
|
|
||||||
list_for_each_entry(tmp, &ch->list, list) {
|
|
||||||
struct sk_buff *skb;
|
struct sk_buff *skb;
|
||||||
|
|
||||||
if (skb_queue_empty(&tmp->data_q))
|
if (skb_queue_empty(&tmp->data_q))
|
||||||
@@ -2200,7 +2197,6 @@ static void hci_prio_recalculate(struct hci_dev *hdev, __u8 type)
|
|||||||
BT_DBG("%s", hdev->name);
|
BT_DBG("%s", hdev->name);
|
||||||
|
|
||||||
list_for_each_entry(conn, &h->list, list) {
|
list_for_each_entry(conn, &h->list, list) {
|
||||||
struct hci_chan_hash *ch;
|
|
||||||
struct hci_chan *chan;
|
struct hci_chan *chan;
|
||||||
|
|
||||||
if (conn->type != type)
|
if (conn->type != type)
|
||||||
@@ -2211,8 +2207,7 @@ static void hci_prio_recalculate(struct hci_dev *hdev, __u8 type)
|
|||||||
|
|
||||||
num++;
|
num++;
|
||||||
|
|
||||||
ch = &conn->chan_hash;
|
list_for_each_entry(chan, &conn->chan_list, list) {
|
||||||
list_for_each_entry(chan, &ch->list, list) {
|
|
||||||
struct sk_buff *skb;
|
struct sk_buff *skb;
|
||||||
|
|
||||||
if (chan->sent) {
|
if (chan->sent) {
|
||||||
|
Reference in New Issue
Block a user