diff options
author | Andre Guedes <andre.guedes@openbossa.org> | 2013-03-27 20:04:56 -0300 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2013-04-04 11:12:33 +0300 |
commit | 3e13fa1e1fab479940728272b6425d343e0c0f84 (patch) | |
tree | 1d4557f4d37cb982a95aec9456cf9c57e7500fa3 /net/bluetooth/hci_event.c | |
parent | 33720450bb811a0cec1f0147bf8a1801113fa94d (diff) | |
download | talos-obmc-linux-3e13fa1e1fab479940728272b6425d343e0c0f84.tar.gz talos-obmc-linux-3e13fa1e1fab479940728272b6425d343e0c0f84.zip |
Bluetooth: Fix hci_inquiry ioctl usage
Since the HCI request framework was properly fixed, the hci_req_sync
call, in hci_inquiry, will return as soon as the HCI command completes
(not the Inquiry procedure). However, in inquiry ioctl implementation,
we want to sleep the user process until the inquiry procedure finishes.
This patch changes hci_inquiry so, in case the HCI Inquiry command
was executed successfully, it waits the HCI_INQUIRY flag to be cleared.
This way, the user process will sleep until the inquiry procedure
finishes.
Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth/hci_event.c')
-rw-r--r-- | net/bluetooth/hci_event.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 8efb9c0d9b2c..7e7fbca59439 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -48,6 +48,8 @@ static void hci_cc_inquiry_cancel(struct hci_dev *hdev, struct sk_buff *skb) } clear_bit(HCI_INQUIRY, &hdev->flags); + smp_mb__after_clear_bit(); /* wake_up_bit advises about this barrier */ + wake_up_bit(&hdev->flags, HCI_INQUIRY); hci_dev_lock(hdev); hci_discovery_set_state(hdev, DISCOVERY_STOPPED); @@ -1603,6 +1605,9 @@ static void hci_inquiry_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) if (!test_and_clear_bit(HCI_INQUIRY, &hdev->flags)) return; + smp_mb__after_clear_bit(); /* wake_up_bit advises about this barrier */ + wake_up_bit(&hdev->flags, HCI_INQUIRY); + if (!test_bit(HCI_MGMT, &hdev->dev_flags)) return; |