Commit bb876725 authored by Brian Gix's avatar Brian Gix Committed by Luiz Augusto von Dentz

Bluetooth: Remove update_scan hci_request dependancy

This removes the remaining calls to HCI_OP_WRITE_SCAN_ENABLE from
hci_request call chains, and converts them to hci_sync calls.
Signed-off-by: default avatarBrian Gix <brian.gix@intel.com>
Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
parent ec2904c2
...@@ -517,7 +517,6 @@ struct hci_dev { ...@@ -517,7 +517,6 @@ struct hci_dev {
struct work_struct cmd_work; struct work_struct cmd_work;
struct work_struct tx_work; struct work_struct tx_work;
struct work_struct scan_update;
struct delayed_work le_scan_disable; struct delayed_work le_scan_disable;
struct delayed_work le_scan_restart; struct delayed_work le_scan_restart;
......
...@@ -78,6 +78,7 @@ int hci_read_clock_sync(struct hci_dev *hdev, struct hci_cp_read_clock *cp); ...@@ -78,6 +78,7 @@ int hci_read_clock_sync(struct hci_dev *hdev, struct hci_cp_read_clock *cp);
int hci_write_fast_connectable_sync(struct hci_dev *hdev, bool enable); int hci_write_fast_connectable_sync(struct hci_dev *hdev, bool enable);
int hci_update_scan_sync(struct hci_dev *hdev); int hci_update_scan_sync(struct hci_dev *hdev);
int hci_update_scan(struct hci_dev *hdev);
int hci_write_le_host_supported_sync(struct hci_dev *hdev, u8 le, u8 simul); int hci_write_le_host_supported_sync(struct hci_dev *hdev, u8 le, u8 simul);
int hci_remove_ext_adv_instance_sync(struct hci_dev *hdev, u8 instance, int hci_remove_ext_adv_instance_sync(struct hci_dev *hdev, u8 instance,
......
...@@ -3173,7 +3173,7 @@ static void hci_conn_complete_evt(struct hci_dev *hdev, void *data, ...@@ -3173,7 +3173,7 @@ static void hci_conn_complete_evt(struct hci_dev *hdev, void *data,
hci_send_cmd(hdev, HCI_OP_READ_REMOTE_FEATURES, hci_send_cmd(hdev, HCI_OP_READ_REMOTE_FEATURES,
sizeof(cp), &cp); sizeof(cp), &cp);
hci_req_update_scan(hdev); hci_update_scan(hdev);
} }
/* Set packet type for incoming connection */ /* Set packet type for incoming connection */
...@@ -3371,7 +3371,7 @@ static void hci_disconn_complete_evt(struct hci_dev *hdev, void *data, ...@@ -3371,7 +3371,7 @@ static void hci_disconn_complete_evt(struct hci_dev *hdev, void *data,
if (test_and_clear_bit(HCI_CONN_FLUSH_KEY, &conn->flags)) if (test_and_clear_bit(HCI_CONN_FLUSH_KEY, &conn->flags))
hci_remove_link_key(hdev, &conn->dst); hci_remove_link_key(hdev, &conn->dst);
hci_req_update_scan(hdev); hci_update_scan(hdev);
} }
params = hci_conn_params_lookup(hdev, &conn->dst, conn->dst_type); params = hci_conn_params_lookup(hdev, &conn->dst, conn->dst_type);
......
...@@ -1835,21 +1835,6 @@ void __hci_req_update_scan(struct hci_request *req) ...@@ -1835,21 +1835,6 @@ void __hci_req_update_scan(struct hci_request *req)
hci_req_add(req, HCI_OP_WRITE_SCAN_ENABLE, 1, &scan); hci_req_add(req, HCI_OP_WRITE_SCAN_ENABLE, 1, &scan);
} }
static int update_scan(struct hci_request *req, unsigned long opt)
{
hci_dev_lock(req->hdev);
__hci_req_update_scan(req);
hci_dev_unlock(req->hdev);
return 0;
}
static void scan_update_work(struct work_struct *work)
{
struct hci_dev *hdev = container_of(work, struct hci_dev, scan_update);
hci_req_sync(hdev, update_scan, 0, HCI_CMD_TIMEOUT, NULL);
}
static u8 get_service_classes(struct hci_dev *hdev) static u8 get_service_classes(struct hci_dev *hdev)
{ {
struct bt_uuid *uuid; struct bt_uuid *uuid;
...@@ -2348,7 +2333,6 @@ static void discov_off(struct work_struct *work) ...@@ -2348,7 +2333,6 @@ static void discov_off(struct work_struct *work)
void hci_request_setup(struct hci_dev *hdev) void hci_request_setup(struct hci_dev *hdev)
{ {
INIT_WORK(&hdev->scan_update, scan_update_work);
INIT_DELAYED_WORK(&hdev->discov_off, discov_off); INIT_DELAYED_WORK(&hdev->discov_off, discov_off);
INIT_DELAYED_WORK(&hdev->le_scan_disable, le_scan_disable_work); INIT_DELAYED_WORK(&hdev->le_scan_disable, le_scan_disable_work);
INIT_DELAYED_WORK(&hdev->le_scan_restart, le_scan_restart_work); INIT_DELAYED_WORK(&hdev->le_scan_restart, le_scan_restart_work);
...@@ -2360,7 +2344,6 @@ void hci_request_cancel_all(struct hci_dev *hdev) ...@@ -2360,7 +2344,6 @@ void hci_request_cancel_all(struct hci_dev *hdev)
{ {
__hci_cmd_sync_cancel(hdev, ENODEV); __hci_cmd_sync_cancel(hdev, ENODEV);
cancel_work_sync(&hdev->scan_update);
cancel_delayed_work_sync(&hdev->discov_off); cancel_delayed_work_sync(&hdev->discov_off);
cancel_delayed_work_sync(&hdev->le_scan_disable); cancel_delayed_work_sync(&hdev->le_scan_disable);
cancel_delayed_work_sync(&hdev->le_scan_restart); cancel_delayed_work_sync(&hdev->le_scan_restart);
......
...@@ -108,11 +108,6 @@ bool hci_req_stop_discovery(struct hci_request *req); ...@@ -108,11 +108,6 @@ bool hci_req_stop_discovery(struct hci_request *req);
int hci_req_configure_datapath(struct hci_dev *hdev, struct bt_codec *codec); int hci_req_configure_datapath(struct hci_dev *hdev, struct bt_codec *codec);
static inline void hci_req_update_scan(struct hci_dev *hdev)
{
queue_work(hdev->req_workqueue, &hdev->scan_update);
}
void __hci_req_update_scan(struct hci_request *req); void __hci_req_update_scan(struct hci_request *req);
int hci_update_random_address(struct hci_request *req, bool require_privacy, int hci_update_random_address(struct hci_request *req, bool require_privacy,
......
...@@ -2236,6 +2236,16 @@ int hci_update_passive_scan_sync(struct hci_dev *hdev) ...@@ -2236,6 +2236,16 @@ int hci_update_passive_scan_sync(struct hci_dev *hdev)
return err; return err;
} }
static int update_scan_sync(struct hci_dev *hdev, void *data)
{
return hci_update_scan_sync(hdev);
}
int hci_update_scan(struct hci_dev *hdev)
{
return hci_cmd_sync_queue(hdev, update_scan_sync, NULL, NULL);
}
static int update_passive_scan_sync(struct hci_dev *hdev, void *data) static int update_passive_scan_sync(struct hci_dev *hdev, void *data)
{ {
return hci_update_passive_scan_sync(hdev); return hci_update_passive_scan_sync(hdev);
......
...@@ -1611,7 +1611,7 @@ static int set_connectable_update_settings(struct hci_dev *hdev, ...@@ -1611,7 +1611,7 @@ static int set_connectable_update_settings(struct hci_dev *hdev,
return err; return err;
if (changed) { if (changed) {
hci_req_update_scan(hdev); hci_update_scan(hdev);
hci_update_passive_scan(hdev); hci_update_passive_scan(hdev);
return new_settings(hdev, sk); return new_settings(hdev, sk);
} }
...@@ -7081,7 +7081,7 @@ static int add_device(struct sock *sk, struct hci_dev *hdev, ...@@ -7081,7 +7081,7 @@ static int add_device(struct sock *sk, struct hci_dev *hdev,
if (err) if (err)
goto unlock; goto unlock;
hci_req_update_scan(hdev); hci_update_scan(hdev);
goto added; goto added;
} }
...@@ -7193,7 +7193,7 @@ static int remove_device(struct sock *sk, struct hci_dev *hdev, ...@@ -7193,7 +7193,7 @@ static int remove_device(struct sock *sk, struct hci_dev *hdev,
goto unlock; goto unlock;
} }
hci_req_update_scan(hdev); hci_update_scan(hdev);
device_removed(sk, hdev, &cp->addr.bdaddr, device_removed(sk, hdev, &cp->addr.bdaddr,
cp->addr.type); cp->addr.type);
...@@ -7257,7 +7257,7 @@ static int remove_device(struct sock *sk, struct hci_dev *hdev, ...@@ -7257,7 +7257,7 @@ static int remove_device(struct sock *sk, struct hci_dev *hdev,
kfree(b); kfree(b);
} }
hci_req_update_scan(hdev); hci_update_scan(hdev);
list_for_each_entry_safe(p, tmp, &hdev->le_conn_params, list) { list_for_each_entry_safe(p, tmp, &hdev->le_conn_params, list) {
if (p->auto_connect == HCI_AUTO_CONN_DISABLED) if (p->auto_connect == HCI_AUTO_CONN_DISABLED)
......
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