summaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_conn.c
diff options
context:
space:
mode:
authorGustavo F. Padovan <padovan@profusion.mobi>2011-12-14 22:54:12 -0200
committerGustavo F. Padovan <padovan@profusion.mobi>2011-12-18 17:07:56 -0200
commitbf4c63252490ba78fb833cc7acf1a5b1900c970f (patch)
tree628e5d6a2b0214a8d6d4c85ce61177a9fd59cbc5 /net/bluetooth/hci_conn.c
parent8192edef03f9b47f1cc1120724db525e63e218f3 (diff)
downloadlinux-bf4c63252490ba78fb833cc7acf1a5b1900c970f.tar.bz2
Bluetooth: convert conn hash to RCU
Handling hci_conn_hash with RCU make us avoid some locking and disable tasklets. Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth/hci_conn.c')
-rw-r--r--net/bluetooth/hci_conn.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index b04467674a13..5e9e193ac71e 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -418,18 +418,17 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst)
hci_dev_hold(hdev);
- tasklet_disable(&hdev->tx_task);
-
hci_conn_hash_add(hdev, conn);
- if (hdev->notify)
+ if (hdev->notify) {
+ tasklet_disable(&hdev->tx_task);
hdev->notify(hdev, HCI_NOTIFY_CONN_ADD);
+ tasklet_enable(&hdev->tx_task);
+ }
atomic_set(&conn->devref, 0);
hci_conn_init_sysfs(conn);
- tasklet_enable(&hdev->tx_task);
-
return conn;
}
@@ -465,15 +464,15 @@ int hci_conn_del(struct hci_conn *conn)
}
}
- tasklet_disable(&hdev->tx_task);
hci_chan_list_flush(conn);
hci_conn_hash_del(hdev, conn);
- if (hdev->notify)
+ if (hdev->notify) {
+ tasklet_disable(&hdev->tx_task);
hdev->notify(hdev, HCI_NOTIFY_CONN_DEL);
-
- tasklet_enable(&hdev->tx_task);
+ tasklet_enable(&hdev->tx_task);
+ }
skb_queue_purge(&conn->data_q);
@@ -808,7 +807,7 @@ void hci_conn_hash_flush(struct hci_dev *hdev)
BT_DBG("hdev %s", hdev->name);
- list_for_each_entry(c, &h->list, list) {
+ list_for_each_entry_rcu(c, &h->list, list) {
c->state = BT_CLOSED;
hci_proto_disconn_cfm(c, HCI_ERROR_LOCAL_HOST_TERM);