Commit 24b78d0f authored by Johan Hedberg's avatar Johan Hedberg

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: default avatarJohan Hedberg <johan.hedberg@intel.com>
Acked-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 90e70454
...@@ -1394,6 +1394,20 @@ static int add_uuid(struct sock *sk, u16 index, void *data, u16 len) ...@@ -1394,6 +1394,20 @@ static int add_uuid(struct sock *sk, u16 index, void *data, u16 len)
return err; return err;
} }
static bool enable_service_cache(struct hci_dev *hdev)
{
if (!hdev_is_powered(hdev))
return false;
if (!test_and_set_bit(HCI_SERVICE_CACHE, &hdev->dev_flags)) {
schedule_delayed_work(&hdev->service_cache,
msecs_to_jiffies(SERVICE_CACHE_TIMEOUT));
return true;
}
return false;
}
static int remove_uuid(struct sock *sk, u16 index, void *data, u16 len) static int remove_uuid(struct sock *sk, u16 index, void *data, u16 len)
{ {
struct mgmt_cp_remove_uuid *cp = data; 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,10 +1439,11 @@ static int remove_uuid(struct sock *sk, u16 index, void *data, u16 len)
if (memcmp(cp->uuid, bt_uuid_any, 16) == 0) { if (memcmp(cp->uuid, bt_uuid_any, 16) == 0) {
err = hci_uuids_clear(hdev); err = hci_uuids_clear(hdev);
if (hdev_is_powered(hdev) && if (enable_service_cache(hdev)) {
!test_and_set_bit(HCI_SERVICE_CACHE, &hdev->dev_flags)) err = cmd_complete(sk, index, MGMT_OP_REMOVE_UUID, 0,
schedule_delayed_work(&hdev->service_cache, hdev->dev_class, 3);
msecs_to_jiffies(SERVICE_CACHE_TIMEOUT)); goto unlock;
}
goto update_class; goto update_class;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment