mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-07 13:43:51 +00:00
Bluetooth: hci_sync: Move handling of interleave_scan
This moves handling of interleave_scan work to hci_sync.c since hci_request.c is deprecated. Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
parent
176cbeceb5
commit
8bedf130c2
@ -2552,7 +2552,6 @@ struct hci_dev *hci_alloc_dev_priv(int sizeof_priv)
|
|||||||
INIT_DELAYED_WORK(&hdev->ncmd_timer, hci_ncmd_timeout);
|
INIT_DELAYED_WORK(&hdev->ncmd_timer, hci_ncmd_timeout);
|
||||||
|
|
||||||
hci_devcd_setup(hdev);
|
hci_devcd_setup(hdev);
|
||||||
hci_request_setup(hdev);
|
|
||||||
|
|
||||||
hci_init_sysfs(hdev);
|
hci_init_sysfs(hdev);
|
||||||
discovery_init(hdev);
|
discovery_init(hdev);
|
||||||
@ -4074,7 +4073,7 @@ static void hci_send_cmd_sync(struct hci_dev *hdev, struct sk_buff *skb)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hci_req_status_pend(hdev) &&
|
if (hdev->req_status == HCI_REQ_PEND &&
|
||||||
!hci_dev_test_and_set_flag(hdev, HCI_CMD_PENDING)) {
|
!hci_dev_test_and_set_flag(hdev, HCI_CMD_PENDING)) {
|
||||||
kfree_skb(hdev->req_skb);
|
kfree_skb(hdev->req_skb);
|
||||||
hdev->req_skb = skb_clone(hdev->sent_cmd, GFP_KERNEL);
|
hdev->req_skb = skb_clone(hdev->sent_cmd, GFP_KERNEL);
|
||||||
|
@ -566,6 +566,53 @@ static void adv_timeout_expire(struct work_struct *work)
|
|||||||
hci_dev_unlock(hdev);
|
hci_dev_unlock(hdev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool is_interleave_scanning(struct hci_dev *hdev)
|
||||||
|
{
|
||||||
|
return hdev->interleave_scan_state != INTERLEAVE_SCAN_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int hci_passive_scan_sync(struct hci_dev *hdev);
|
||||||
|
|
||||||
|
static void interleave_scan_work(struct work_struct *work)
|
||||||
|
{
|
||||||
|
struct hci_dev *hdev = container_of(work, struct hci_dev,
|
||||||
|
interleave_scan.work);
|
||||||
|
unsigned long timeout;
|
||||||
|
|
||||||
|
if (hdev->interleave_scan_state == INTERLEAVE_SCAN_ALLOWLIST) {
|
||||||
|
timeout = msecs_to_jiffies(hdev->advmon_allowlist_duration);
|
||||||
|
} else if (hdev->interleave_scan_state == INTERLEAVE_SCAN_NO_FILTER) {
|
||||||
|
timeout = msecs_to_jiffies(hdev->advmon_no_filter_duration);
|
||||||
|
} else {
|
||||||
|
bt_dev_err(hdev, "unexpected error");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
hci_passive_scan_sync(hdev);
|
||||||
|
|
||||||
|
hci_dev_lock(hdev);
|
||||||
|
|
||||||
|
switch (hdev->interleave_scan_state) {
|
||||||
|
case INTERLEAVE_SCAN_ALLOWLIST:
|
||||||
|
bt_dev_dbg(hdev, "next state: allowlist");
|
||||||
|
hdev->interleave_scan_state = INTERLEAVE_SCAN_NO_FILTER;
|
||||||
|
break;
|
||||||
|
case INTERLEAVE_SCAN_NO_FILTER:
|
||||||
|
bt_dev_dbg(hdev, "next state: no filter");
|
||||||
|
hdev->interleave_scan_state = INTERLEAVE_SCAN_ALLOWLIST;
|
||||||
|
break;
|
||||||
|
case INTERLEAVE_SCAN_NONE:
|
||||||
|
bt_dev_err(hdev, "unexpected error");
|
||||||
|
}
|
||||||
|
|
||||||
|
hci_dev_unlock(hdev);
|
||||||
|
|
||||||
|
/* Don't continue interleaving if it was canceled */
|
||||||
|
if (is_interleave_scanning(hdev))
|
||||||
|
queue_delayed_work(hdev->req_workqueue,
|
||||||
|
&hdev->interleave_scan, timeout);
|
||||||
|
}
|
||||||
|
|
||||||
void hci_cmd_sync_init(struct hci_dev *hdev)
|
void hci_cmd_sync_init(struct hci_dev *hdev)
|
||||||
{
|
{
|
||||||
INIT_WORK(&hdev->cmd_sync_work, hci_cmd_sync_work);
|
INIT_WORK(&hdev->cmd_sync_work, hci_cmd_sync_work);
|
||||||
@ -577,6 +624,7 @@ void hci_cmd_sync_init(struct hci_dev *hdev)
|
|||||||
INIT_WORK(&hdev->reenable_adv_work, reenable_adv);
|
INIT_WORK(&hdev->reenable_adv_work, reenable_adv);
|
||||||
INIT_DELAYED_WORK(&hdev->le_scan_disable, le_scan_disable);
|
INIT_DELAYED_WORK(&hdev->le_scan_disable, le_scan_disable);
|
||||||
INIT_DELAYED_WORK(&hdev->adv_instance_expire, adv_timeout_expire);
|
INIT_DELAYED_WORK(&hdev->adv_instance_expire, adv_timeout_expire);
|
||||||
|
INIT_DELAYED_WORK(&hdev->interleave_scan, interleave_scan_work);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _hci_cmd_sync_cancel_entry(struct hci_dev *hdev,
|
static void _hci_cmd_sync_cancel_entry(struct hci_dev *hdev,
|
||||||
@ -2110,11 +2158,6 @@ static void hci_start_interleave_scan(struct hci_dev *hdev)
|
|||||||
&hdev->interleave_scan, 0);
|
&hdev->interleave_scan, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool is_interleave_scanning(struct hci_dev *hdev)
|
|
||||||
{
|
|
||||||
return hdev->interleave_scan_state != INTERLEAVE_SCAN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void cancel_interleave_scan(struct hci_dev *hdev)
|
static void cancel_interleave_scan(struct hci_dev *hdev)
|
||||||
{
|
{
|
||||||
bt_dev_dbg(hdev, "cancelling interleave scan");
|
bt_dev_dbg(hdev, "cancelling interleave scan");
|
||||||
|
Loading…
Reference in New Issue
Block a user