Bluetooth: Reduce critical region.
authorAndre Guedes <andre.guedes@openbossa.org>
Fri, 9 Sep 2011 21:56:24 +0000 (18:56 -0300)
committerGustavo F. Padovan <padovan@profusion.mobi>
Wed, 21 Sep 2011 15:59:16 +0000 (12:59 -0300)
This patch reduces the critial region (protected by hdev->lock) in
hci_cc_le_set_scan_enable(). This way, only really required code is
synchronized.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
net/bluetooth/hci_event.c

index fd6eea0941b636907af644729f2c0aa4b441a8bf..35083f2aa2ea0c0ae23608b4fa421f0646b9b08d 100644 (file)
@@ -898,16 +898,15 @@ static void hci_cc_le_set_scan_enable(struct hci_dev *hdev,
        if (!cp)
                return;
 
-       hci_dev_lock(hdev);
-
        if (cp->enable == 0x01) {
                del_timer(&hdev->adv_timer);
+
+               hci_dev_lock(hdev);
                hci_adv_entries_clear(hdev);
+               hci_dev_unlock(hdev);
        } else if (cp->enable == 0x00) {
                mod_timer(&hdev->adv_timer, jiffies + ADV_CLEAR_TIMEOUT);
        }
-
-       hci_dev_unlock(hdev);
 }
 
 static void hci_cc_le_ltk_reply(struct hci_dev *hdev, struct sk_buff *skb)