diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2012-02-23 06:30:41 -0500 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2012-02-23 10:01:49 -0500 |
commit | 504c8dcd6b0ec3cd36ab221695c5516e88cf3d79 (patch) | |
tree | fcc0639d4532ffe12898d793f0383e03c5ae5101 /net/bluetooth/mgmt.c | |
parent | 69775ff6d101ccf435bd26ae822c24bbb20e11cf (diff) |
Bluetooth: mgmt: Fix update_eir/class with HCI_AUTO_OFF flag set
If we're powered but still have the HCI_AUTO_OFF flag set the
update_eir and update_class functions should not do anything.
Additionally these functions need to be called when the flag is finally
cleared through set_powered or when powering on for real.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Gustavo F. Padovan <padovan@profusion.mobi>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/mgmt.c')
-rw-r--r-- | net/bluetooth/mgmt.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 7fdba8fb9808..4e4889490635 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -532,7 +532,7 @@ static int update_eir(struct hci_dev *hdev) | |||
532 | { | 532 | { |
533 | struct hci_cp_write_eir cp; | 533 | struct hci_cp_write_eir cp; |
534 | 534 | ||
535 | if (!test_bit(HCI_UP, &hdev->flags)) | 535 | if (!hdev_is_powered(hdev)) |
536 | return 0; | 536 | return 0; |
537 | 537 | ||
538 | if (!(hdev->features[6] & LMP_EXT_INQ)) | 538 | if (!(hdev->features[6] & LMP_EXT_INQ)) |
@@ -573,7 +573,7 @@ static int update_class(struct hci_dev *hdev) | |||
573 | 573 | ||
574 | BT_DBG("%s", hdev->name); | 574 | BT_DBG("%s", hdev->name); |
575 | 575 | ||
576 | if (!test_bit(HCI_UP, &hdev->flags)) | 576 | if (!hdev_is_powered(hdev)) |
577 | return 0; | 577 | return 0; |
578 | 578 | ||
579 | if (test_bit(HCI_SERVICE_CACHE, &hdev->dev_flags)) | 579 | if (test_bit(HCI_SERVICE_CACHE, &hdev->dev_flags)) |
@@ -3121,6 +3121,9 @@ int mgmt_powered(struct hci_dev *hdev, u8 powered) | |||
3121 | 3121 | ||
3122 | if (scan) | 3122 | if (scan) |
3123 | hci_send_cmd(hdev, HCI_OP_WRITE_SCAN_ENABLE, 1, &scan); | 3123 | hci_send_cmd(hdev, HCI_OP_WRITE_SCAN_ENABLE, 1, &scan); |
3124 | |||
3125 | update_class(hdev); | ||
3126 | update_eir(hdev); | ||
3124 | } else { | 3127 | } else { |
3125 | u8 status = ENETDOWN; | 3128 | u8 status = ENETDOWN; |
3126 | mgmt_pending_foreach(0, hdev, cmd_status_rsp, &status); | 3129 | mgmt_pending_foreach(0, hdev, cmd_status_rsp, &status); |