Lines Matching refs:req
30 void hci_req_init(struct hci_request *req, struct hci_dev *hdev) in hci_req_init() argument
32 skb_queue_head_init(&req->cmd_q); in hci_req_init()
33 req->hdev = hdev; in hci_req_init()
34 req->err = 0; in hci_req_init()
37 static int req_run(struct hci_request *req, hci_req_complete_t complete, in req_run() argument
40 struct hci_dev *hdev = req->hdev; in req_run()
44 BT_DBG("length %u", skb_queue_len(&req->cmd_q)); in req_run()
49 if (req->err) { in req_run()
50 skb_queue_purge(&req->cmd_q); in req_run()
51 return req->err; in req_run()
55 if (skb_queue_empty(&req->cmd_q)) in req_run()
58 skb = skb_peek_tail(&req->cmd_q); in req_run()
59 bt_cb(skb)->req.complete = complete; in req_run()
60 bt_cb(skb)->req.complete_skb = complete_skb; in req_run()
63 skb_queue_splice_tail(&req->cmd_q, &hdev->cmd_q); in req_run()
71 int hci_req_run(struct hci_request *req, hci_req_complete_t complete) in hci_req_run() argument
73 return req_run(req, complete, NULL); in hci_req_run()
76 int hci_req_run_skb(struct hci_request *req, hci_req_complete_skb_t complete) in hci_req_run_skb() argument
78 return req_run(req, NULL, complete); in hci_req_run_skb()
108 void hci_req_add_ev(struct hci_request *req, u16 opcode, u32 plen, in hci_req_add_ev() argument
111 struct hci_dev *hdev = req->hdev; in hci_req_add_ev()
119 if (req->err) in hci_req_add_ev()
126 req->err = -ENOMEM; in hci_req_add_ev()
130 if (skb_queue_empty(&req->cmd_q)) in hci_req_add_ev()
131 bt_cb(skb)->req.start = true; in hci_req_add_ev()
133 bt_cb(skb)->req.event = event; in hci_req_add_ev()
135 skb_queue_tail(&req->cmd_q, skb); in hci_req_add_ev()
138 void hci_req_add(struct hci_request *req, u16 opcode, u32 plen, in hci_req_add() argument
141 hci_req_add_ev(req, opcode, plen, param, 0); in hci_req_add()
144 void hci_req_add_le_scan_disable(struct hci_request *req) in hci_req_add_le_scan_disable() argument
150 hci_req_add(req, HCI_OP_LE_SET_SCAN_ENABLE, sizeof(cp), &cp); in hci_req_add_le_scan_disable()
153 static void add_to_white_list(struct hci_request *req, in add_to_white_list() argument
161 hci_req_add(req, HCI_OP_LE_ADD_TO_WHITE_LIST, sizeof(cp), &cp); in add_to_white_list()
164 static u8 update_white_list(struct hci_request *req) in update_white_list() argument
166 struct hci_dev *hdev = req->hdev; in update_white_list()
191 hci_req_add(req, HCI_OP_LE_DEL_FROM_WHITE_LIST, in update_white_list()
222 add_to_white_list(req, params); in update_white_list()
246 add_to_white_list(req, params); in update_white_list()
253 void hci_req_add_le_passive_scan(struct hci_request *req) in hci_req_add_le_passive_scan() argument
257 struct hci_dev *hdev = req->hdev; in hci_req_add_le_passive_scan()
267 if (hci_update_random_address(req, false, &own_addr_type)) in hci_req_add_le_passive_scan()
274 filter_policy = update_white_list(req); in hci_req_add_le_passive_scan()
295 hci_req_add(req, HCI_OP_LE_SET_SCAN_PARAM, sizeof(param_cp), in hci_req_add_le_passive_scan()
301 hci_req_add(req, HCI_OP_LE_SET_SCAN_ENABLE, sizeof(enable_cp), in hci_req_add_le_passive_scan()
305 static void set_random_addr(struct hci_request *req, bdaddr_t *rpa) in set_random_addr() argument
307 struct hci_dev *hdev = req->hdev; in set_random_addr()
326 hci_req_add(req, HCI_OP_LE_SET_RANDOM_ADDR, 6, rpa); in set_random_addr()
329 int hci_update_random_address(struct hci_request *req, bool require_privacy, in hci_update_random_address() argument
332 struct hci_dev *hdev = req->hdev; in hci_update_random_address()
354 set_random_addr(req, &hdev->rpa); in hci_update_random_address()
385 set_random_addr(req, &nrpa); in hci_update_random_address()
404 hci_req_add(req, HCI_OP_LE_SET_RANDOM_ADDR, 6, in hci_update_random_address()
435 void __hci_update_page_scan(struct hci_request *req) in __hci_update_page_scan() argument
437 struct hci_dev *hdev = req->hdev; in __hci_update_page_scan()
461 hci_req_add(req, HCI_OP_WRITE_SCAN_ENABLE, 1, &scan); in __hci_update_page_scan()
466 struct hci_request req; in hci_update_page_scan() local
468 hci_req_init(&req, hdev); in hci_update_page_scan()
469 __hci_update_page_scan(&req); in hci_update_page_scan()
470 hci_req_run(&req, NULL); in hci_update_page_scan()
479 void __hci_update_background_scan(struct hci_request *req) in __hci_update_background_scan() argument
481 struct hci_dev *hdev = req->hdev; in __hci_update_background_scan()
520 hci_req_add_le_scan_disable(req); in __hci_update_background_scan()
540 hci_req_add_le_scan_disable(req); in __hci_update_background_scan()
542 hci_req_add_le_passive_scan(req); in __hci_update_background_scan()
559 struct hci_request req; in hci_update_background_scan() local
561 hci_req_init(&req, hdev); in hci_update_background_scan()
563 __hci_update_background_scan(&req); in hci_update_background_scan()
565 err = hci_req_run(&req, update_background_scan_complete); in hci_update_background_scan()