Bluetooth: prevent dup DISCOVERY_STOP's pending

It is possible to redundently request Discovery
operations.  This fix cleans up some stored state to
prevent MGMT event overload when discovery finally completes.

Change-Id: I2ffb5c0749df95e40cd39e8c64c87a62a93fb896
CRs-fixed: 329657
Signed-off-by: Brian Gix <bgix@codeaurora.org>
This commit is contained in:
Brian Gix
2012-01-14 20:21:55 -08:00
committed by Stephen Boyd
parent 6fefa46cee
commit f5bca82175

View File

@@ -2040,10 +2040,13 @@ static int start_discovery(struct sock *sk, u16 index)
if (err < 0)
mgmt_pending_remove(cmd);
else if (lmp_le_capable(hdev)) {
cmd = mgmt_pending_find(MGMT_OP_STOP_DISCOVERY, index);
if (!cmd)
mgmt_pending_add(sk, MGMT_OP_STOP_DISCOVERY, index,
NULL, 0);
hdev->disco_int_phase = 1;
hdev->disco_int_count = 0;
hdev->disco_state = SCAN_BR;
mgmt_pending_add(sk, MGMT_OP_STOP_DISCOVERY, index, NULL, 0);
del_timer(&hdev->disco_le_timer);
del_timer(&hdev->disco_timer);
mod_timer(&hdev->disco_timer,