Skip to content

Commit 92048ab

Browse files
committed
Bluetooth: hci_core: Remove usage of hci_req_sync
hci_request functions are considered deprecated so this replaces the usage of hci_req_sync with hci_inquiry_sync. Signed-off-by: Luiz Augusto von Dentz <[email protected]>
1 parent 88b73fd commit 92048ab

File tree

3 files changed

+11
-30
lines changed

3 files changed

+11
-30
lines changed

include/net/bluetooth/hci_sync.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ int hci_update_discoverable(struct hci_dev *hdev);
131131

132132
int hci_update_connectable_sync(struct hci_dev *hdev);
133133

134+
int hci_inquiry_sync(struct hci_dev *hdev, u8 length, u8 num_rsp);
135+
134136
int hci_start_discovery_sync(struct hci_dev *hdev);
135137
int hci_stop_discovery_sync(struct hci_dev *hdev);
136138

net/bluetooth/hci_core.c

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -312,33 +312,12 @@ static int inquiry_cache_dump(struct hci_dev *hdev, int num, __u8 *buf)
312312
return copied;
313313
}
314314

315-
static int hci_inq_req(struct hci_request *req, unsigned long opt)
316-
{
317-
struct hci_inquiry_req *ir = (struct hci_inquiry_req *) opt;
318-
struct hci_dev *hdev = req->hdev;
319-
struct hci_cp_inquiry cp;
320-
321-
BT_DBG("%s", hdev->name);
322-
323-
if (test_bit(HCI_INQUIRY, &hdev->flags))
324-
return 0;
325-
326-
/* Start Inquiry */
327-
memcpy(&cp.lap, &ir->lap, 3);
328-
cp.length = ir->length;
329-
cp.num_rsp = ir->num_rsp;
330-
hci_req_add(req, HCI_OP_INQUIRY, sizeof(cp), &cp);
331-
332-
return 0;
333-
}
334-
335315
int hci_inquiry(void __user *arg)
336316
{
337317
__u8 __user *ptr = arg;
338318
struct hci_inquiry_req ir;
339319
struct hci_dev *hdev;
340320
int err = 0, do_inquiry = 0, max_rsp;
341-
long timeo;
342321
__u8 *buf;
343322

344323
if (copy_from_user(&ir, ptr, sizeof(ir)))
@@ -377,11 +356,11 @@ int hci_inquiry(void __user *arg)
377356
}
378357
hci_dev_unlock(hdev);
379358

380-
timeo = ir.length * msecs_to_jiffies(2000);
381-
382359
if (do_inquiry) {
383-
err = hci_req_sync(hdev, hci_inq_req, (unsigned long) &ir,
384-
timeo, NULL);
360+
hci_req_sync_lock(hdev);
361+
err = hci_inquiry_sync(hdev, ir.length, ir.num_rsp);
362+
hci_req_sync_unlock(hdev);
363+
385364
if (err < 0)
386365
goto done;
387366

net/bluetooth/hci_sync.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -347,10 +347,9 @@ static int scan_disable_sync(struct hci_dev *hdev, void *data)
347347
return hci_scan_disable_sync(hdev);
348348
}
349349

350-
static int hci_inquiry_sync(struct hci_dev *hdev, u8 length);
351350
static int interleaved_inquiry_sync(struct hci_dev *hdev, void *data)
352351
{
353-
return hci_inquiry_sync(hdev, DISCOV_INTERLEAVED_INQUIRY_LEN);
352+
return hci_inquiry_sync(hdev, DISCOV_INTERLEAVED_INQUIRY_LEN, 0);
354353
}
355354

356355
static void le_scan_disable(struct work_struct *work)
@@ -5662,7 +5661,7 @@ int hci_update_connectable_sync(struct hci_dev *hdev)
56625661
return hci_update_passive_scan_sync(hdev);
56635662
}
56645663

5665-
static int hci_inquiry_sync(struct hci_dev *hdev, u8 length)
5664+
int hci_inquiry_sync(struct hci_dev *hdev, u8 length, u8 num_rsp)
56665665
{
56675666
const u8 giac[3] = { 0x33, 0x8b, 0x9e };
56685667
const u8 liac[3] = { 0x00, 0x8b, 0x9e };
@@ -5685,6 +5684,7 @@ static int hci_inquiry_sync(struct hci_dev *hdev, u8 length)
56855684
memcpy(&cp.lap, giac, sizeof(cp.lap));
56865685

56875686
cp.length = length;
5687+
cp.num_rsp = num_rsp;
56885688

56895689
return __hci_cmd_sync_status(hdev, HCI_OP_INQUIRY,
56905690
sizeof(cp), &cp, HCI_CMD_TIMEOUT);
@@ -5771,7 +5771,7 @@ static int hci_start_interleaved_discovery_sync(struct hci_dev *hdev)
57715771
if (err)
57725772
return err;
57735773

5774-
return hci_inquiry_sync(hdev, DISCOV_BREDR_INQUIRY_LEN);
5774+
return hci_inquiry_sync(hdev, DISCOV_BREDR_INQUIRY_LEN, 0);
57755775
}
57765776

57775777
int hci_start_discovery_sync(struct hci_dev *hdev)
@@ -5783,7 +5783,7 @@ int hci_start_discovery_sync(struct hci_dev *hdev)
57835783

57845784
switch (hdev->discovery.type) {
57855785
case DISCOV_TYPE_BREDR:
5786-
return hci_inquiry_sync(hdev, DISCOV_BREDR_INQUIRY_LEN);
5786+
return hci_inquiry_sync(hdev, DISCOV_BREDR_INQUIRY_LEN, 0);
57875787
case DISCOV_TYPE_INTERLEAVED:
57885788
/* When running simultaneous discovery, the LE scanning time
57895789
* should occupy the whole discovery time sine BR/EDR inquiry

0 commit comments

Comments
 (0)