Bluetooth: Fix __hci_request synchronization for hci_open_dev
The initialization function used by hci_open_dev (hci_init_req) sends many different HCI commands. The __hci_request function should only return when all of these commands have completed (or a timeout occurs). Several of these commands cause hci_req_complete to be called which causes __hci_request to return prematurely. This patch fixes the issue by adding a new hdev->req_last_cmd variable which is set during the initialization procedure. The hci_req_complete function will no longer mark the request as complete until the command matching hdev->req_last_cmd completes. Signed-off-by: Johan Hedberg <johan.hedberg@nokia.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
This commit is contained in:
committed by
Gustavo F. Padovan
parent
c71e97bfaa
commit
23bb57633d
@@ -129,6 +129,7 @@ struct hci_dev {
|
||||
wait_queue_head_t req_wait_q;
|
||||
__u32 req_status;
|
||||
__u32 req_result;
|
||||
__u16 req_last_cmd;
|
||||
|
||||
struct inquiry_cache inq_cache;
|
||||
struct hci_conn_hash conn_hash;
|
||||
@@ -693,6 +694,6 @@ struct hci_sec_filter {
|
||||
#define hci_req_lock(d) mutex_lock(&d->req_lock)
|
||||
#define hci_req_unlock(d) mutex_unlock(&d->req_lock)
|
||||
|
||||
void hci_req_complete(struct hci_dev *hdev, int result);
|
||||
void hci_req_complete(struct hci_dev *hdev, __u16 cmd, int result);
|
||||
|
||||
#endif /* __HCI_CORE_H */
|
||||
|
||||
Reference in New Issue
Block a user