Skip to content

Commit bb87672

Browse files
bgixVudentz
authored andcommitted
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: Brian Gix <brian.gix@intel.com> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
1 parent ec2904c commit bb87672

File tree

7 files changed

+17
-29
lines changed

7 files changed

+17
-29
lines changed

include/net/bluetooth/hci_core.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,6 @@ struct hci_dev {
517517
struct work_struct cmd_work;
518518
struct work_struct tx_work;
519519

520-
struct work_struct scan_update;
521520
struct delayed_work le_scan_disable;
522521
struct delayed_work le_scan_restart;
523522

include/net/bluetooth/hci_sync.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ int hci_read_clock_sync(struct hci_dev *hdev, struct hci_cp_read_clock *cp);
7878

7979
int hci_write_fast_connectable_sync(struct hci_dev *hdev, bool enable);
8080
int hci_update_scan_sync(struct hci_dev *hdev);
81+
int hci_update_scan(struct hci_dev *hdev);
8182

8283
int hci_write_le_host_supported_sync(struct hci_dev *hdev, u8 le, u8 simul);
8384
int hci_remove_ext_adv_instance_sync(struct hci_dev *hdev, u8 instance,

net/bluetooth/hci_event.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3173,7 +3173,7 @@ static void hci_conn_complete_evt(struct hci_dev *hdev, void *data,
31733173
hci_send_cmd(hdev, HCI_OP_READ_REMOTE_FEATURES,
31743174
sizeof(cp), &cp);
31753175

3176-
hci_req_update_scan(hdev);
3176+
hci_update_scan(hdev);
31773177
}
31783178

31793179
/* Set packet type for incoming connection */
@@ -3371,7 +3371,7 @@ static void hci_disconn_complete_evt(struct hci_dev *hdev, void *data,
33713371
if (test_and_clear_bit(HCI_CONN_FLUSH_KEY, &conn->flags))
33723372
hci_remove_link_key(hdev, &conn->dst);
33733373

3374-
hci_req_update_scan(hdev);
3374+
hci_update_scan(hdev);
33753375
}
33763376

33773377
params = hci_conn_params_lookup(hdev, &conn->dst, conn->dst_type);

net/bluetooth/hci_request.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1835,21 +1835,6 @@ void __hci_req_update_scan(struct hci_request *req)
18351835
hci_req_add(req, HCI_OP_WRITE_SCAN_ENABLE, 1, &scan);
18361836
}
18371837

1838-
static int update_scan(struct hci_request *req, unsigned long opt)
1839-
{
1840-
hci_dev_lock(req->hdev);
1841-
__hci_req_update_scan(req);
1842-
hci_dev_unlock(req->hdev);
1843-
return 0;
1844-
}
1845-
1846-
static void scan_update_work(struct work_struct *work)
1847-
{
1848-
struct hci_dev *hdev = container_of(work, struct hci_dev, scan_update);
1849-
1850-
hci_req_sync(hdev, update_scan, 0, HCI_CMD_TIMEOUT, NULL);
1851-
}
1852-
18531838
static u8 get_service_classes(struct hci_dev *hdev)
18541839
{
18551840
struct bt_uuid *uuid;
@@ -2348,7 +2333,6 @@ static void discov_off(struct work_struct *work)
23482333

23492334
void hci_request_setup(struct hci_dev *hdev)
23502335
{
2351-
INIT_WORK(&hdev->scan_update, scan_update_work);
23522336
INIT_DELAYED_WORK(&hdev->discov_off, discov_off);
23532337
INIT_DELAYED_WORK(&hdev->le_scan_disable, le_scan_disable_work);
23542338
INIT_DELAYED_WORK(&hdev->le_scan_restart, le_scan_restart_work);
@@ -2360,7 +2344,6 @@ void hci_request_cancel_all(struct hci_dev *hdev)
23602344
{
23612345
__hci_cmd_sync_cancel(hdev, ENODEV);
23622346

2363-
cancel_work_sync(&hdev->scan_update);
23642347
cancel_delayed_work_sync(&hdev->discov_off);
23652348
cancel_delayed_work_sync(&hdev->le_scan_disable);
23662349
cancel_delayed_work_sync(&hdev->le_scan_restart);

net/bluetooth/hci_request.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,6 @@ bool hci_req_stop_discovery(struct hci_request *req);
108108

109109
int hci_req_configure_datapath(struct hci_dev *hdev, struct bt_codec *codec);
110110

111-
static inline void hci_req_update_scan(struct hci_dev *hdev)
112-
{
113-
queue_work(hdev->req_workqueue, &hdev->scan_update);
114-
}
115-
116111
void __hci_req_update_scan(struct hci_request *req);
117112

118113
int hci_update_random_address(struct hci_request *req, bool require_privacy,

net/bluetooth/hci_sync.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2236,6 +2236,16 @@ int hci_update_passive_scan_sync(struct hci_dev *hdev)
22362236
return err;
22372237
}
22382238

2239+
static int update_scan_sync(struct hci_dev *hdev, void *data)
2240+
{
2241+
return hci_update_scan_sync(hdev);
2242+
}
2243+
2244+
int hci_update_scan(struct hci_dev *hdev)
2245+
{
2246+
return hci_cmd_sync_queue(hdev, update_scan_sync, NULL, NULL);
2247+
}
2248+
22392249
static int update_passive_scan_sync(struct hci_dev *hdev, void *data)
22402250
{
22412251
return hci_update_passive_scan_sync(hdev);

net/bluetooth/mgmt.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1611,7 +1611,7 @@ static int set_connectable_update_settings(struct hci_dev *hdev,
16111611
return err;
16121612

16131613
if (changed) {
1614-
hci_req_update_scan(hdev);
1614+
hci_update_scan(hdev);
16151615
hci_update_passive_scan(hdev);
16161616
return new_settings(hdev, sk);
16171617
}
@@ -7081,7 +7081,7 @@ static int add_device(struct sock *sk, struct hci_dev *hdev,
70817081
if (err)
70827082
goto unlock;
70837083

7084-
hci_req_update_scan(hdev);
7084+
hci_update_scan(hdev);
70857085

70867086
goto added;
70877087
}
@@ -7193,7 +7193,7 @@ static int remove_device(struct sock *sk, struct hci_dev *hdev,
71937193
goto unlock;
71947194
}
71957195

7196-
hci_req_update_scan(hdev);
7196+
hci_update_scan(hdev);
71977197

71987198
device_removed(sk, hdev, &cp->addr.bdaddr,
71997199
cp->addr.type);
@@ -7257,7 +7257,7 @@ static int remove_device(struct sock *sk, struct hci_dev *hdev,
72577257
kfree(b);
72587258
}
72597259

7260-
hci_req_update_scan(hdev);
7260+
hci_update_scan(hdev);
72617261

72627262
list_for_each_entry_safe(p, tmp, &hdev->le_conn_params, list) {
72637263
if (p->auto_connect == HCI_AUTO_CONN_DISABLED)

0 commit comments

Comments
 (0)