Lines Matching refs:req

141 	struct hci_request req;
146 hci_req_init(&req, hdev);
148 hci_req_add_ev(&req, opcode, plen, param, event);
152 err = hci_req_run(&req, hci_req_sync_complete);
200 void (*func)(struct hci_request *req,
204 struct hci_request req;
210 hci_req_init(&req, hdev);
214 func(&req, opt);
216 err = hci_req_run(&req, hci_req_sync_complete);
263 void (*req)(struct hci_request *req,
274 ret = __hci_req_sync(hdev, req, opt, timeout);
280 static void hci_reset_req(struct hci_request *req, unsigned long opt)
282 BT_DBG("%s %ld", req->hdev->name, opt);
285 set_bit(HCI_RESET, &req->hdev->flags);
286 hci_req_add(req, HCI_OP_RESET, 0, NULL);
289 static void bredr_init(struct hci_request *req)
291 req->hdev->flow_ctl_mode = HCI_FLOW_CTL_MODE_PACKET_BASED;
294 hci_req_add(req, HCI_OP_READ_LOCAL_FEATURES, 0, NULL);
297 hci_req_add(req, HCI_OP_READ_LOCAL_VERSION, 0, NULL);
300 hci_req_add(req, HCI_OP_READ_BD_ADDR, 0, NULL);
303 static void amp_init(struct hci_request *req)
305 req->hdev->flow_ctl_mode = HCI_FLOW_CTL_MODE_BLOCK_BASED;
308 hci_req_add(req, HCI_OP_READ_LOCAL_VERSION, 0, NULL);
311 hci_req_add(req, HCI_OP_READ_LOCAL_AMP_INFO, 0, NULL);
314 hci_req_add(req, HCI_OP_READ_DATA_BLOCK_SIZE, 0, NULL);
317 static void hci_init1_req(struct hci_request *req, unsigned long opt)
319 struct hci_dev *hdev = req->hdev;
325 hci_reset_req(req, 0);
329 bredr_init(req);
333 amp_init(req);
342 static void bredr_setup(struct hci_request *req)
348 hci_req_add(req, HCI_OP_READ_BUFFER_SIZE, 0, NULL);
351 hci_req_add(req, HCI_OP_READ_CLASS_OF_DEV, 0, NULL);
354 hci_req_add(req, HCI_OP_READ_LOCAL_NAME, 0, NULL);
357 hci_req_add(req, HCI_OP_READ_VOICE_SETTING, 0, NULL);
361 hci_req_add(req, HCI_OP_SET_EVENT_FLT, 1, &flt_type);
365 hci_req_add(req, HCI_OP_WRITE_CA_TIMEOUT, 2, &param);
368 if (req->hdev->hci_ver > BLUETOOTH_VER_1_1) {
369 hci_req_add(req, HCI_OP_READ_PAGE_SCAN_ACTIVITY, 0, NULL);
370 hci_req_add(req, HCI_OP_READ_PAGE_SCAN_TYPE, 0, NULL);
374 static void le_setup(struct hci_request *req)
376 struct hci_dev *hdev = req->hdev;
379 hci_req_add(req, HCI_OP_LE_READ_BUFFER_SIZE, 0, NULL);
382 hci_req_add(req, HCI_OP_LE_READ_LOCAL_FEATURES, 0, NULL);
385 hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);
388 hci_req_add(req, HCI_OP_LE_READ_WHITE_LIST_SIZE, 0, NULL);
391 hci_req_add(req, HCI_OP_LE_READ_SUPPORTED_STATES, 0, NULL);
426 static void hci_setup_inquiry_mode(struct hci_request *req)
430 mode = hci_get_inquiry_mode(req->hdev);
432 hci_req_add(req, HCI_OP_WRITE_INQUIRY_MODE, 1, &mode);
435 static void hci_setup_event_mask(struct hci_request *req)
437 struct hci_dev *hdev = req->hdev;
494 hci_req_add(req, HCI_OP_SET_EVENT_MASK, sizeof(events), events);
499 hci_req_add(req, HCI_OP_LE_SET_EVENT_MASK,
504 static void hci_init2_req(struct hci_request *req, unsigned long opt)
506 struct hci_dev *hdev = req->hdev;
509 bredr_setup(req);
512 le_setup(req);
514 hci_setup_event_mask(req);
517 hci_req_add(req, HCI_OP_READ_LOCAL_COMMANDS, 0, NULL);
522 hci_req_add(req, HCI_OP_WRITE_SSP_MODE,
530 hci_req_add(req, HCI_OP_WRITE_EIR, sizeof(cp), &cp);
535 hci_setup_inquiry_mode(req);
538 hci_req_add(req, HCI_OP_READ_INQ_RSP_TX_POWER, 0, NULL);
544 hci_req_add(req, HCI_OP_READ_LOCAL_EXT_FEATURES,
550 hci_req_add(req, HCI_OP_WRITE_AUTH_ENABLE, sizeof(enable),
555 static void hci_setup_link_policy(struct hci_request *req)
557 struct hci_dev *hdev = req->hdev;
571 hci_req_add(req, HCI_OP_WRITE_DEF_LINK_POLICY, sizeof(cp), &cp);
574 static void hci_set_le_support(struct hci_request *req)
576 struct hci_dev *hdev = req->hdev;
591 hci_req_add(req, HCI_OP_WRITE_LE_HOST_SUPPORTED, sizeof(cp),
595 static void hci_init3_req(struct hci_request *req, unsigned long opt)
597 struct hci_dev *hdev = req->hdev;
606 hci_req_add(req, HCI_OP_DELETE_STORED_LINK_KEY,
611 hci_setup_link_policy(req);
614 hci_set_le_support(req);
615 hci_update_ad(req);
623 hci_req_add(req, HCI_OP_READ_LOCAL_EXT_FEATURES,
650 static void hci_scan_req(struct hci_request *req, unsigned long opt)
654 BT_DBG("%s %x", req->hdev->name, scan);
657 hci_req_add(req, HCI_OP_WRITE_SCAN_ENABLE, 1, &scan);
660 static void hci_auth_req(struct hci_request *req, unsigned long opt)
664 BT_DBG("%s %x", req->hdev->name, auth);
667 hci_req_add(req, HCI_OP_WRITE_AUTH_ENABLE, 1, &auth);
670 static void hci_encrypt_req(struct hci_request *req, unsigned long opt)
674 BT_DBG("%s %x", req->hdev->name, encrypt);
677 hci_req_add(req, HCI_OP_WRITE_ENCRYPT_MODE, 1, &encrypt);
680 static void hci_linkpol_req(struct hci_request *req, unsigned long opt)
684 BT_DBG("%s %x", req->hdev->name, policy);
687 hci_req_add(req, HCI_OP_WRITE_DEF_LINK_POLICY, 2, &policy);
924 static void hci_inq_req(struct hci_request *req, unsigned long opt)
927 struct hci_dev *hdev = req->hdev;
939 hci_req_add(req, HCI_OP_INQUIRY, sizeof(cp), &cp);
1081 void hci_update_ad(struct hci_request *req)
1083 struct hci_dev *hdev = req->hdev;
1103 hci_req_add(req, HCI_OP_LE_SET_ADV_DATA, sizeof(cp), &cp);
1994 static void le_scan_param_req(struct hci_request *req, unsigned long opt)
2004 hci_req_add(req, HCI_OP_LE_SET_SCAN_PARAM, sizeof(cp), &cp);
2007 static void le_scan_enable_req(struct hci_request *req, unsigned long opt)
2015 hci_req_add(req, HCI_OP_LE_SET_SCAN_ENABLE, sizeof(cp), &cp);
2585 void hci_req_init(struct hci_request *req, struct hci_dev *hdev)
2587 skb_queue_head_init(&req->cmd_q);
2588 req->hdev = hdev;
2589 req->err = 0;
2592 int hci_req_run(struct hci_request *req, hci_req_complete_t complete)
2594 struct hci_dev *hdev = req->hdev;
2598 BT_DBG("length %u", skb_queue_len(&req->cmd_q));
2603 if (req->err) {
2604 skb_queue_purge(&req->cmd_q);
2605 return req->err;
2609 if (skb_queue_empty(&req->cmd_q))
2612 skb = skb_peek_tail(&req->cmd_q);
2613 bt_cb(skb)->req.complete = complete;
2616 skb_queue_splice_tail(&req->cmd_q, &hdev->cmd_q);
2667 bt_cb(skb)->req.start = true;
2676 void hci_req_add_ev(struct hci_request *req, u16 opcode, u32 plen,
2679 struct hci_dev *hdev = req->hdev;
2687 if (req->err)
2694 req->err = -ENOMEM;
2698 if (skb_queue_empty(&req->cmd_q))
2699 bt_cb(skb)->req.start = true;
2701 bt_cb(skb)->req.event = event;
2703 skb_queue_tail(&req->cmd_q, skb);
2706 void hci_req_add(struct hci_request *req, u16 opcode, u32 plen,
2709 hci_req_add_ev(req, opcode, plen, param, 0);
3384 return bt_cb(skb)->req.start;
3444 req_complete = bt_cb(hdev->sent_cmd)->req.complete;
3452 if (bt_cb(skb)->req.start) {
3457 req_complete = bt_cb(skb)->req.complete;