diff options
-rw-r--r-- | include/net/bluetooth/hci_core.h | 1 | ||||
-rw-r--r-- | net/bluetooth/hci_core.c | 22 |
2 files changed, 23 insertions, 0 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 7191217c6bd1..67fe661259ba 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -1048,6 +1048,7 @@ struct hci_request { | |||
1048 | 1048 | ||
1049 | void hci_req_init(struct hci_request *req, struct hci_dev *hdev); | 1049 | void hci_req_init(struct hci_request *req, struct hci_dev *hdev); |
1050 | int hci_req_run(struct hci_request *req, hci_req_complete_t complete); | 1050 | int hci_req_run(struct hci_request *req, hci_req_complete_t complete); |
1051 | int hci_req_add(struct hci_request *req, u16 opcode, u32 plen, void *param); | ||
1051 | 1052 | ||
1052 | int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, void *param); | 1053 | int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, void *param); |
1053 | void hci_send_acl(struct hci_chan *chan, struct sk_buff *skb, __u16 flags); | 1054 | void hci_send_acl(struct hci_chan *chan, struct sk_buff *skb, __u16 flags); |
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index d2edcc4643c3..6e6a9dd8a155 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -2517,6 +2517,28 @@ int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, void *param) | |||
2517 | return 0; | 2517 | return 0; |
2518 | } | 2518 | } |
2519 | 2519 | ||
2520 | /* Queue a command to an asynchronous HCI request */ | ||
2521 | int hci_req_add(struct hci_request *req, u16 opcode, u32 plen, void *param) | ||
2522 | { | ||
2523 | struct hci_dev *hdev = req->hdev; | ||
2524 | struct sk_buff *skb; | ||
2525 | |||
2526 | BT_DBG("%s opcode 0x%4.4x plen %d", hdev->name, opcode, plen); | ||
2527 | |||
2528 | skb = hci_prepare_cmd(hdev, opcode, plen, param); | ||
2529 | if (!skb) { | ||
2530 | BT_ERR("%s no memory for command", hdev->name); | ||
2531 | return -ENOMEM; | ||
2532 | } | ||
2533 | |||
2534 | if (skb_queue_empty(&req->cmd_q)) | ||
2535 | bt_cb(skb)->req.start = true; | ||
2536 | |||
2537 | skb_queue_tail(&req->cmd_q, skb); | ||
2538 | |||
2539 | return 0; | ||
2540 | } | ||
2541 | |||
2520 | /* Get data from the previously sent command */ | 2542 | /* Get data from the previously sent command */ |
2521 | void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode) | 2543 | void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode) |
2522 | { | 2544 | { |