aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGustavo F. Padovan <padovan@profusion.mobi>2011-12-14 10:02:51 -0500
committerGustavo F. Padovan <padovan@profusion.mobi>2011-12-16 15:16:14 -0500
commit2c33c06a8fd2f784ca763ad150d5d63c3c49946e (patch)
treec8ccf68c9df1f1d8cdc7ef8da2a182b25f584a8a
parent5a13b09531420d230616bd524b68a5b0c23cd487 (diff)
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>
-rw-r--r--include/net/bluetooth/hci_core.h33
-rw-r--r--net/bluetooth/hci_conn.c13
-rw-r--r--net/bluetooth/hci_core.c9
3 files changed, 10 insertions, 45 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index e34cd71a586e..fb2cce2b633f 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -67,12 +67,6 @@ struct hci_conn_hash {
67 unsigned int le_num; 67 unsigned int le_num;
68}; 68};
69 69
70struct hci_chan_hash {
71 struct list_head list;
72 spinlock_t lock;
73 unsigned int num;
74};
75
76struct bdaddr_list { 70struct bdaddr_list {
77 struct list_head list; 71 struct list_head list;
78 bdaddr_t bdaddr; 72 bdaddr_t bdaddr;
@@ -301,7 +295,7 @@ struct hci_conn {
301 unsigned int sent; 295 unsigned int sent;
302 296
303 struct sk_buff_head data_q; 297 struct sk_buff_head data_q;
304 struct hci_chan_hash chan_hash; 298 struct list_head chan_list;
305 299
306 struct timer_list disc_timer; 300 struct timer_list disc_timer;
307 struct timer_list idle_timer; 301 struct timer_list idle_timer;
@@ -390,7 +384,6 @@ static inline void hci_conn_hash_init(struct hci_dev *hdev)
390{ 384{
391 struct hci_conn_hash *h = &hdev->conn_hash; 385 struct hci_conn_hash *h = &hdev->conn_hash;
392 INIT_LIST_HEAD(&h->list); 386 INIT_LIST_HEAD(&h->list);
393 spin_lock_init(&h->lock);
394 h->acl_num = 0; 387 h->acl_num = 0;
395 h->sco_num = 0; 388 h->sco_num = 0;
396} 389}
@@ -492,28 +485,6 @@ static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev,
492 return NULL; 485 return NULL;
493} 486}
494 487
495static inline void hci_chan_hash_init(struct hci_conn *c)
496{
497 struct hci_chan_hash *h = &c->chan_hash;
498 INIT_LIST_HEAD(&h->list);
499 spin_lock_init(&h->lock);
500 h->num = 0;
501}
502
503static inline void hci_chan_hash_add(struct hci_conn *c, struct hci_chan *chan)
504{
505 struct hci_chan_hash *h = &c->chan_hash;
506 list_add(&chan->list, &h->list);
507 h->num++;
508}
509
510static inline void hci_chan_hash_del(struct hci_conn *c, struct hci_chan *chan)
511{
512 struct hci_chan_hash *h = &c->chan_hash;
513 list_del(&chan->list);
514 h->num--;
515}
516
517void hci_acl_connect(struct hci_conn *conn); 488void hci_acl_connect(struct hci_conn *conn);
518void hci_acl_disconn(struct hci_conn *conn, __u8 reason); 489void hci_acl_disconn(struct hci_conn *conn, __u8 reason);
519void hci_add_sco(struct hci_conn *conn, __u16 handle); 490void hci_add_sco(struct hci_conn *conn, __u16 handle);
@@ -527,7 +498,7 @@ void hci_conn_check_pending(struct hci_dev *hdev);
527 498
528struct hci_chan *hci_chan_create(struct hci_conn *conn); 499struct hci_chan *hci_chan_create(struct hci_conn *conn);
529int hci_chan_del(struct hci_chan *chan); 500int hci_chan_del(struct hci_chan *chan);
530void hci_chan_hash_flush(struct hci_conn *conn); 501void hci_chan_list_flush(struct hci_conn *conn);
531 502
532struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, 503struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst,
533 __u8 sec_level, __u8 auth_type); 504 __u8 sec_level, __u8 auth_type);
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index b328ac611ccd..1a076941829b 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -374,7 +374,7 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst)
374 374
375 skb_queue_head_init(&conn->data_q); 375 skb_queue_head_init(&conn->data_q);
376 376
377 hci_chan_hash_init(conn); 377 INIT_LIST_HEAD(&conn->chan_list);;
378 378
379 setup_timer(&conn->disc_timer, hci_conn_timeout, (unsigned long)conn); 379 setup_timer(&conn->disc_timer, hci_conn_timeout, (unsigned long)conn);
380 setup_timer(&conn->idle_timer, hci_conn_idle, (unsigned long)conn); 380 setup_timer(&conn->idle_timer, hci_conn_idle, (unsigned long)conn);
@@ -434,7 +434,7 @@ int hci_conn_del(struct hci_conn *conn)
434 434
435 tasklet_disable(&hdev->tx_task); 435 tasklet_disable(&hdev->tx_task);
436 436
437 hci_chan_hash_flush(conn); 437 hci_chan_list_flush(conn);
438 438
439 hci_conn_hash_del(hdev, conn); 439 hci_conn_hash_del(hdev, conn);
440 if (hdev->notify) 440 if (hdev->notify)
@@ -970,7 +970,7 @@ struct hci_chan *hci_chan_create(struct hci_conn *conn)
970 skb_queue_head_init(&chan->data_q); 970 skb_queue_head_init(&chan->data_q);
971 971
972 tasklet_disable(&hdev->tx_task); 972 tasklet_disable(&hdev->tx_task);
973 hci_chan_hash_add(conn, chan); 973 list_add(&conn->chan_list, &chan->list);
974 tasklet_enable(&hdev->tx_task); 974 tasklet_enable(&hdev->tx_task);
975 975
976 return chan; 976 return chan;
@@ -984,7 +984,7 @@ int hci_chan_del(struct hci_chan *chan)
984 BT_DBG("%s conn %p chan %p", hdev->name, conn, chan); 984 BT_DBG("%s conn %p chan %p", hdev->name, conn, chan);
985 985
986 tasklet_disable(&hdev->tx_task); 986 tasklet_disable(&hdev->tx_task);
987 hci_chan_hash_del(conn, chan); 987 list_del(&chan->list);
988 tasklet_enable(&hdev->tx_task); 988 tasklet_enable(&hdev->tx_task);
989 989
990 skb_queue_purge(&chan->data_q); 990 skb_queue_purge(&chan->data_q);
@@ -993,13 +993,12 @@ int hci_chan_del(struct hci_chan *chan)
993 return 0; 993 return 0;
994} 994}
995 995
996void hci_chan_hash_flush(struct hci_conn *conn) 996void hci_chan_list_flush(struct hci_conn *conn)
997{ 997{
998 struct hci_chan_hash *h = &conn->chan_hash;
999 struct hci_chan *chan, *tmp; 998 struct hci_chan *chan, *tmp;
1000 999
1001 BT_DBG("conn %p", conn); 1000 BT_DBG("conn %p", conn);
1002 1001
1003 list_for_each_entry_safe(chan, tmp, &h->list, list) 1002 list_for_each_entry_safe(chan, tmp, &conn->chan_list, list)
1004 hci_chan_del(chan); 1003 hci_chan_del(chan);
1005} 1004}
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index ce3727ecc0c4..700d0abdf2b1 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2125,7 +2125,6 @@ static inline struct hci_chan *hci_chan_sent(struct hci_dev *hdev, __u8 type,
2125 BT_DBG("%s", hdev->name); 2125 BT_DBG("%s", hdev->name);
2126 2126
2127 list_for_each_entry(conn, &h->list, list) { 2127 list_for_each_entry(conn, &h->list, list) {
2128 struct hci_chan_hash *ch;
2129 struct hci_chan *tmp; 2128 struct hci_chan *tmp;
2130 2129
2131 if (conn->type != type) 2130 if (conn->type != type)
@@ -2136,9 +2135,7 @@ static inline struct hci_chan *hci_chan_sent(struct hci_dev *hdev, __u8 type,
2136 2135
2137 conn_num++; 2136 conn_num++;
2138 2137
2139 ch = &conn->chan_hash; 2138 list_for_each_entry(tmp, &conn->chan_list, list) {
2140
2141 list_for_each_entry(tmp, &ch->list, list) {
2142 struct sk_buff *skb; 2139 struct sk_buff *skb;
2143 2140
2144 if (skb_queue_empty(&tmp->data_q)) 2141 if (skb_queue_empty(&tmp->data_q))
@@ -2200,7 +2197,6 @@ static void hci_prio_recalculate(struct hci_dev *hdev, __u8 type)
2200 BT_DBG("%s", hdev->name); 2197 BT_DBG("%s", hdev->name);
2201 2198
2202 list_for_each_entry(conn, &h->list, list) { 2199 list_for_each_entry(conn, &h->list, list) {
2203 struct hci_chan_hash *ch;
2204 struct hci_chan *chan; 2200 struct hci_chan *chan;
2205 2201
2206 if (conn->type != type) 2202 if (conn->type != type)
@@ -2211,8 +2207,7 @@ static void hci_prio_recalculate(struct hci_dev *hdev, __u8 type)
2211 2207
2212 num++; 2208 num++;
2213 2209
2214 ch = &conn->chan_hash; 2210 list_for_each_entry(chan, &conn->chan_list, list) {
2215 list_for_each_entry(chan, &ch->list, list) {
2216 struct sk_buff *skb; 2211 struct sk_buff *skb;
2217 2212
2218 if (chan->sent) { 2213 if (chan->sent) {