提交 4004b6d9 编写于 作者: J Johan Hedberg

Bluetooth: mgmt: Move service cache setting to a more sensible place

Since we can now add UUIDs when powered off we don't really need to
always use the service cache to avoid large bursts of HCI commands.
Instead, the only important use case is when we're already powered and
user space starts to initialize itself. This can be easiest detected by
a "clear UUIDs" operation which is where this patch moves the service
cache setting.
Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
Acked-by: NMarcel Holtmann <marcel@holtmann.org>
上级 9997a533
...@@ -617,10 +617,6 @@ static void mgmt_init_hdev(struct hci_dev *hdev) ...@@ -617,10 +617,6 @@ static void mgmt_init_hdev(struct hci_dev *hdev)
*/ */
clear_bit(HCI_PAIRABLE, &hdev->dev_flags); clear_bit(HCI_PAIRABLE, &hdev->dev_flags);
} }
if (!test_and_set_bit(HCI_SERVICE_CACHE, &hdev->dev_flags))
schedule_delayed_work(&hdev->service_cache,
msecs_to_jiffies(SERVICE_CACHE_TIMEOUT));
} }
static int read_controller_info(struct sock *sk, u16 index) static int read_controller_info(struct sock *sk, u16 index)
...@@ -1399,6 +1395,12 @@ static int remove_uuid(struct sock *sk, u16 index, void *data, u16 len) ...@@ -1399,6 +1395,12 @@ 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) &&
!test_and_set_bit(HCI_SERVICE_CACHE, &hdev->dev_flags))
schedule_delayed_work(&hdev->service_cache,
msecs_to_jiffies(SERVICE_CACHE_TIMEOUT));
goto unlock; goto unlock;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册