Bluetooth: Only send mgmt_ops messages for BR-EDR devices
Signed-off-by: Peter Krystad <pkrystad@codeaurora.org>
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 2528c7f..b47ae16 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -579,7 +579,8 @@
hci_dev_hold(hdev);
set_bit(HCI_UP, &hdev->flags);
hci_notify(hdev, HCI_DEV_UP);
- if (!test_bit(HCI_SETUP, &hdev->flags))
+ if (!test_bit(HCI_SETUP, &hdev->flags) &&
+ hdev->dev_type == HCI_BREDR)
mgmt_powered(hdev->id, 1);
} else {
/* Init failed, cleanup */
@@ -664,7 +665,8 @@
* and no tasks are scheduled. */
hdev->close(hdev);
- mgmt_powered(hdev->id, 0);
+ if (hdev->dev_type == HCI_BREDR)
+ mgmt_powered(hdev->id, 0);
/* Clear flags */
hdev->flags = 0;
@@ -965,11 +967,13 @@
if (hci_dev_open(hdev->id) < 0 && !test_bit(HCI_UP, &hdev->flags))
return;
- if (test_bit(HCI_AUTO_OFF, &hdev->flags))
+ if (test_bit(HCI_AUTO_OFF, &hdev->flags) &&
+ hdev->dev_type == HCI_BREDR)
mod_timer(&hdev->off_timer,
jiffies + msecs_to_jiffies(AUTO_OFF_TIMEOUT));
- if (test_and_clear_bit(HCI_SETUP, &hdev->flags))
+ if (test_and_clear_bit(HCI_SETUP, &hdev->flags) &&
+ hdev->dev_type == HCI_BREDR)
mgmt_index_added(hdev->id);
}
@@ -1499,7 +1503,8 @@
kfree_skb(hdev->reassembly[i]);
if (!test_bit(HCI_INIT, &hdev->flags) &&
- !test_bit(HCI_SETUP, &hdev->flags))
+ !test_bit(HCI_SETUP, &hdev->flags) &&
+ hdev->dev_type == HCI_BREDR)
mgmt_index_removed(hdev->id);
if (!IS_ERR(hdev->tfm))
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 3b63aee..6ec00d5 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -146,6 +146,9 @@
count = 0;
list_for_each(p, &hci_dev_list) {
+ struct hci_dev *d = list_entry(p, struct hci_dev, list);
+ if (d->dev_type != HCI_BREDR)
+ continue;
count++;
}
@@ -164,6 +167,9 @@
hci_del_off_timer(d);
+ if (d->dev_type != HCI_BREDR)
+ continue;
+
set_bit(HCI_MGMT, &d->flags);
if (test_bit(HCI_SETUP, &d->flags))