diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2012-02-23 16:24:30 -0500 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2012-02-23 17:15:26 -0500 |
commit | 24b78d0f49b94f658e8bae707c158962535053dd (patch) | |
tree | f44e28b00ac8f811939685873d48bfd3100abd84 /net/bluetooth/mgmt.c | |
parent | 90e704543d6702971ecfe3fe2325829d89b76f6b (diff) |
Bluetooth: mgmt: Fix clear_uuids response
Since the clear_uuids operation doesn't send an immediate HCI command
but just sets off a timer to wait for subsequent add_uuid calls it
doesn't make sense to wait until the timer fires off to send the
response. Instead send the response immediately.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/mgmt.c')
-rw-r--r-- | net/bluetooth/mgmt.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 7a906d6e0236..07e31f73f703 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -1394,6 +1394,20 @@ failed: | |||
1394 | return err; | 1394 | return err; |
1395 | } | 1395 | } |
1396 | 1396 | ||
1397 | static bool enable_service_cache(struct hci_dev *hdev) | ||
1398 | { | ||
1399 | if (!hdev_is_powered(hdev)) | ||
1400 | return false; | ||
1401 | |||
1402 | if (!test_and_set_bit(HCI_SERVICE_CACHE, &hdev->dev_flags)) { | ||
1403 | schedule_delayed_work(&hdev->service_cache, | ||
1404 | msecs_to_jiffies(SERVICE_CACHE_TIMEOUT)); | ||
1405 | return true; | ||
1406 | } | ||
1407 | |||
1408 | return false; | ||
1409 | } | ||
1410 | |||
1397 | static int remove_uuid(struct sock *sk, u16 index, void *data, u16 len) | 1411 | static int remove_uuid(struct sock *sk, u16 index, void *data, u16 len) |
1398 | { | 1412 | { |
1399 | struct mgmt_cp_remove_uuid *cp = data; | 1413 | struct mgmt_cp_remove_uuid *cp = data; |
@@ -1425,10 +1439,11 @@ static int remove_uuid(struct sock *sk, u16 index, void *data, u16 len) | |||
1425 | if (memcmp(cp->uuid, bt_uuid_any, 16) == 0) { | 1439 | if (memcmp(cp->uuid, bt_uuid_any, 16) == 0) { |
1426 | err = hci_uuids_clear(hdev); | 1440 | err = hci_uuids_clear(hdev); |
1427 | 1441 | ||
1428 | if (hdev_is_powered(hdev) && | 1442 | if (enable_service_cache(hdev)) { |
1429 | !test_and_set_bit(HCI_SERVICE_CACHE, &hdev->dev_flags)) | 1443 | err = cmd_complete(sk, index, MGMT_OP_REMOVE_UUID, 0, |
1430 | schedule_delayed_work(&hdev->service_cache, | 1444 | hdev->dev_class, 3); |
1431 | msecs_to_jiffies(SERVICE_CACHE_TIMEOUT)); | 1445 | goto unlock; |
1446 | } | ||
1432 | 1447 | ||
1433 | goto update_class; | 1448 | goto update_class; |
1434 | } | 1449 | } |