Skip to content

Commit f2d8977

Browse files
committed
Bluetooth: hci_sync: Remove remaining dependencies of hci_request
This removes the dependencies of hci_req_init and hci_request_cancel_all from hci_sync.c. Signed-off-by: Luiz Augusto von Dentz <[email protected]>
1 parent 8bedf13 commit f2d8977

File tree

3 files changed

+28
-20
lines changed

3 files changed

+28
-20
lines changed

include/net/bluetooth/hci_sync.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,23 @@
88
#define UINT_PTR(_handle) ((void *)((uintptr_t)_handle))
99
#define PTR_UINT(_ptr) ((uintptr_t)((void *)_ptr))
1010

11+
#define HCI_REQ_DONE 0
12+
#define HCI_REQ_PEND 1
13+
#define HCI_REQ_CANCELED 2
14+
15+
#define hci_req_sync_lock(hdev) mutex_lock(&hdev->req_lock)
16+
#define hci_req_sync_unlock(hdev) mutex_unlock(&hdev->req_lock)
17+
18+
struct hci_request {
19+
struct hci_dev *hdev;
20+
struct sk_buff_head cmd_q;
21+
22+
/* If something goes wrong when building the HCI request, the error
23+
* value is stored in this field.
24+
*/
25+
int err;
26+
};
27+
1128
typedef int (*hci_cmd_sync_work_func_t)(struct hci_dev *hdev, void *data);
1229
typedef void (*hci_cmd_sync_work_destroy_t)(struct hci_dev *hdev, void *data,
1330
int err);

net/bluetooth/hci_request.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,6 @@
2222

2323
#include <asm/unaligned.h>
2424

25-
#define HCI_REQ_DONE 0
26-
#define HCI_REQ_PEND 1
27-
#define HCI_REQ_CANCELED 2
28-
29-
#define hci_req_sync_lock(hdev) mutex_lock(&hdev->req_lock)
30-
#define hci_req_sync_unlock(hdev) mutex_unlock(&hdev->req_lock)
31-
32-
struct hci_request {
33-
struct hci_dev *hdev;
34-
struct sk_buff_head cmd_q;
35-
36-
/* If something goes wrong when building the HCI request, the error
37-
* value is stored in this field.
38-
*/
39-
int err;
40-
};
41-
4225
void hci_req_init(struct hci_request *req, struct hci_dev *hdev);
4326
void hci_req_purge(struct hci_request *req);
4427
bool hci_req_status_pend(struct hci_dev *hdev);

net/bluetooth/hci_sync.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include <net/bluetooth/hci_core.h>
1313
#include <net/bluetooth/mgmt.h>
1414

15-
#include "hci_request.h"
1615
#include "hci_codec.h"
1716
#include "hci_debugfs.h"
1817
#include "smp.h"
@@ -146,6 +145,13 @@ static int hci_cmd_sync_run(struct hci_request *req)
146145
return 0;
147146
}
148147

148+
static void hci_request_init(struct hci_request *req, struct hci_dev *hdev)
149+
{
150+
skb_queue_head_init(&req->cmd_q);
151+
req->hdev = hdev;
152+
req->err = 0;
153+
}
154+
149155
/* This function requires the caller holds hdev->req_lock. */
150156
struct sk_buff *__hci_cmd_sync_sk(struct hci_dev *hdev, u16 opcode, u32 plen,
151157
const void *param, u8 event, u32 timeout,
@@ -157,7 +163,7 @@ struct sk_buff *__hci_cmd_sync_sk(struct hci_dev *hdev, u16 opcode, u32 plen,
157163

158164
bt_dev_dbg(hdev, "Opcode 0x%4.4x", opcode);
159165

160-
hci_req_init(&req, hdev);
166+
hci_request_init(&req, hdev);
161167

162168
hci_cmd_sync_add(&req, opcode, plen, param, event, sk);
163169

@@ -5056,7 +5062,9 @@ int hci_dev_close_sync(struct hci_dev *hdev)
50565062
cancel_delayed_work(&hdev->ncmd_timer);
50575063
cancel_delayed_work(&hdev->le_scan_disable);
50585064

5059-
hci_request_cancel_all(hdev);
5065+
hci_cmd_sync_cancel_sync(hdev, ENODEV);
5066+
5067+
cancel_interleave_scan(hdev);
50605068

50615069
if (hdev->adv_instance_timeout) {
50625070
cancel_delayed_work_sync(&hdev->adv_instance_expire);

0 commit comments

Comments
 (0)