summaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorAndrei Emeltchenko <andrei.emeltchenko@intel.com>2011-12-19 16:14:18 +0200
committerGustavo F. Padovan <padovan@profusion.mobi>2011-12-22 14:03:24 -0200
commit68a8aea45973c8d0bc05f58389ce9e82e04bb5f6 (patch)
treee28685f45585430c836427e50a8fb78d4aecb817 /net/bluetooth
parent8a154a8feb805394d1fd46281becaf876e18860a (diff)
downloadlinux-68a8aea45973c8d0bc05f58389ce9e82e04bb5f6.tar.gz
linux-68a8aea45973c8d0bc05f58389ce9e82e04bb5f6.tar.bz2
linux-68a8aea45973c8d0bc05f58389ce9e82e04bb5f6.zip
Bluetooth: Remove magic numbers from le scan cmd
Make code readable by removing magic numbers. Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/hci_event.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index b9d77be92d3b..919e3c0e74aa 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -1033,7 +1033,8 @@ static void hci_cc_le_set_scan_enable(struct hci_dev *hdev,
if (!cp)
return;
- if (cp->enable == 0x01) {
+ switch (cp->enable) {
+ case LE_SCANNING_ENABLED:
set_bit(HCI_LE_SCAN, &hdev->dev_flags);
cancel_delayed_work_sync(&hdev->adv_work);
@@ -1041,12 +1042,19 @@ static void hci_cc_le_set_scan_enable(struct hci_dev *hdev,
hci_dev_lock(hdev);
hci_adv_entries_clear(hdev);
hci_dev_unlock(hdev);
- } else if (cp->enable == 0x00) {
+ break;
+
+ case LE_SCANNING_DISABLED:
clear_bit(HCI_LE_SCAN, &hdev->dev_flags);
cancel_delayed_work_sync(&hdev->adv_work);
queue_delayed_work(hdev->workqueue, &hdev->adv_work,
jiffies + ADV_CLEAR_TIMEOUT);
+ break;
+
+ default:
+ BT_ERR("Used reserved LE_Scan_Enable param %d", cp->enable);
+ break;
}
}