Commit 7a92906f authored by Abhishek Pandit-Subedi's avatar Abhishek Pandit-Subedi Committed by Johan Hedberg

Bluetooth: Replace wakeable list with flag

Since the classic device list now supports flags, convert the wakeable
list into a flag on the existing device list.
Signed-off-by: default avatarAbhishek Pandit-Subedi <abhishekpandit@chromium.org>
Reviewed-by: default avatarAlain Michaud <alainm@chromium.org>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
parent 8baaa403
...@@ -143,6 +143,16 @@ struct bdaddr_list_with_flags { ...@@ -143,6 +143,16 @@ struct bdaddr_list_with_flags {
u32 current_flags; u32 current_flags;
}; };
enum hci_conn_flags {
HCI_CONN_FLAG_REMOTE_WAKEUP,
HCI_CONN_FLAG_MAX
};
#define hci_conn_test_flag(nr, flags) ((flags) & (1U << nr))
/* Make sure number of flags doesn't exceed sizeof(current_flags) */
static_assert(HCI_CONN_FLAG_MAX < 32);
struct bt_uuid { struct bt_uuid {
struct list_head list; struct list_head list;
u8 uuid[16]; u8 uuid[16];
...@@ -463,7 +473,6 @@ struct hci_dev { ...@@ -463,7 +473,6 @@ struct hci_dev {
struct list_head mgmt_pending; struct list_head mgmt_pending;
struct list_head blacklist; struct list_head blacklist;
struct list_head whitelist; struct list_head whitelist;
struct list_head wakeable;
struct list_head uuids; struct list_head uuids;
struct list_head link_keys; struct list_head link_keys;
struct list_head long_term_keys; struct list_head long_term_keys;
......
...@@ -3499,7 +3499,6 @@ struct hci_dev *hci_alloc_dev(void) ...@@ -3499,7 +3499,6 @@ struct hci_dev *hci_alloc_dev(void)
INIT_LIST_HEAD(&hdev->mgmt_pending); INIT_LIST_HEAD(&hdev->mgmt_pending);
INIT_LIST_HEAD(&hdev->blacklist); INIT_LIST_HEAD(&hdev->blacklist);
INIT_LIST_HEAD(&hdev->whitelist); INIT_LIST_HEAD(&hdev->whitelist);
INIT_LIST_HEAD(&hdev->wakeable);
INIT_LIST_HEAD(&hdev->uuids); INIT_LIST_HEAD(&hdev->uuids);
INIT_LIST_HEAD(&hdev->link_keys); INIT_LIST_HEAD(&hdev->link_keys);
INIT_LIST_HEAD(&hdev->long_term_keys); INIT_LIST_HEAD(&hdev->long_term_keys);
......
...@@ -968,15 +968,19 @@ static void hci_req_clear_event_filter(struct hci_request *req) ...@@ -968,15 +968,19 @@ static void hci_req_clear_event_filter(struct hci_request *req)
static void hci_req_set_event_filter(struct hci_request *req) static void hci_req_set_event_filter(struct hci_request *req)
{ {
struct bdaddr_list *b; struct bdaddr_list_with_flags *b;
struct hci_cp_set_event_filter f; struct hci_cp_set_event_filter f;
struct hci_dev *hdev = req->hdev; struct hci_dev *hdev = req->hdev;
u8 scan; u8 scan = SCAN_DISABLED;
/* Always clear event filter when starting */ /* Always clear event filter when starting */
hci_req_clear_event_filter(req); hci_req_clear_event_filter(req);
list_for_each_entry(b, &hdev->wakeable, list) { list_for_each_entry(b, &hdev->whitelist, list) {
if (!hci_conn_test_flag(HCI_CONN_FLAG_REMOTE_WAKEUP,
b->current_flags))
continue;
memset(&f, 0, sizeof(f)); memset(&f, 0, sizeof(f));
bacpy(&f.addr_conn_flt.bdaddr, &b->bdaddr); bacpy(&f.addr_conn_flt.bdaddr, &b->bdaddr);
f.flt_type = HCI_FLT_CONN_SETUP; f.flt_type = HCI_FLT_CONN_SETUP;
...@@ -985,9 +989,9 @@ static void hci_req_set_event_filter(struct hci_request *req) ...@@ -985,9 +989,9 @@ static void hci_req_set_event_filter(struct hci_request *req)
bt_dev_dbg(hdev, "Adding event filters for %pMR", &b->bdaddr); bt_dev_dbg(hdev, "Adding event filters for %pMR", &b->bdaddr);
hci_req_add(req, HCI_OP_SET_EVENT_FLT, sizeof(f), &f); hci_req_add(req, HCI_OP_SET_EVENT_FLT, sizeof(f), &f);
scan = SCAN_PAGE;
} }
scan = !list_empty(&hdev->wakeable) ? SCAN_PAGE : SCAN_DISABLED;
hci_req_add(req, HCI_OP_WRITE_SCAN_ENABLE, 1, &scan); hci_req_add(req, HCI_OP_WRITE_SCAN_ENABLE, 1, &scan);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment