diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2011-11-08 13:40:15 -0500 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-11-09 09:33:39 -0500 |
commit | 2e58ef3e11d0775795345a20185b5a7c4bdae194 (patch) | |
tree | 3187787dd2693ad0c43fb3e3c7f5ec959c7713e7 /net/bluetooth/hci_core.c | |
parent | 744cf19eadcf4de914394e0eb227f94f4318f5e4 (diff) |
Bluetooth: Move pending management command list into struct hci_dev
This patch moves the pending management command list (previously global
to mgmt.c) into struct hci_dev. This makes it possible to do proper
locking when accessing it (through the existing hci_dev locks) and
thereby avoid race conditions.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth/hci_core.c')
-rw-r--r-- | net/bluetooth/hci_core.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index e4b5c6345095..e5cf01396773 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -1481,6 +1481,8 @@ int hci_register_dev(struct hci_dev *hdev) | |||
1481 | 1481 | ||
1482 | hci_conn_hash_init(hdev); | 1482 | hci_conn_hash_init(hdev); |
1483 | 1483 | ||
1484 | INIT_LIST_HEAD(&hdev->mgmt_pending); | ||
1485 | |||
1484 | INIT_LIST_HEAD(&hdev->blacklist); | 1486 | INIT_LIST_HEAD(&hdev->blacklist); |
1485 | 1487 | ||
1486 | INIT_LIST_HEAD(&hdev->uuids); | 1488 | INIT_LIST_HEAD(&hdev->uuids); |
@@ -1562,6 +1564,10 @@ void hci_unregister_dev(struct hci_dev *hdev) | |||
1562 | !test_bit(HCI_SETUP, &hdev->flags)) | 1564 | !test_bit(HCI_SETUP, &hdev->flags)) |
1563 | mgmt_index_removed(hdev); | 1565 | mgmt_index_removed(hdev); |
1564 | 1566 | ||
1567 | /* mgmt_index_removed should take care of emptying the | ||
1568 | * pending list */ | ||
1569 | BUG_ON(!list_empty(&hdev->mgmt_pending)); | ||
1570 | |||
1565 | hci_notify(hdev, HCI_DEV_UNREG); | 1571 | hci_notify(hdev, HCI_DEV_UNREG); |
1566 | 1572 | ||
1567 | if (hdev->rfkill) { | 1573 | if (hdev->rfkill) { |