Bluetooth: Fix event sending with DISCOVERY_STOPPED state
authorAndre Guedes <andre.guedes@openbossa.org>
Mon, 13 Feb 2012 18:41:02 +0000 (15:41 -0300)
committerJohan Hedberg <johan.hedberg@intel.com>
Wed, 15 Feb 2012 13:23:36 +0000 (15:23 +0200)
We are not supposed to send mgmt_discovering events if we are transiting
from DISCOVERY_STARTING to DISCOVERY_STOPPED state. It doesn't make
sense to send mgmt_discovering event once discovery procedure has not
been even started.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
net/bluetooth/hci_core.c

index 9ada16449aed63b588adf5257c6e1037e65e1e80..dc31e7d6028e33ae1f409a52c453deaad380ae0c 100644 (file)
@@ -380,7 +380,8 @@ void hci_discovery_set_state(struct hci_dev *hdev, int state)
 
        switch (state) {
        case DISCOVERY_STOPPED:
-               mgmt_discovering(hdev, 0);
+               if (hdev->discovery.state != DISCOVERY_STARTING)
+                       mgmt_discovering(hdev, 0);
                break;
        case DISCOVERY_STARTING:
                break;