aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/mgmt.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2012-02-23 14:30:12 -0500
committerJohan Hedberg <johan.hedberg@intel.com>2012-02-23 15:02:27 -0500
commit4004b6d96a14edbd157a62ae25bf61022d7caccc (patch)
treed35340b52ec5a9878ee40ead24f96b1d3774f149 /net/bluetooth/mgmt.c
parent9997a5332320dbaaee64b5c0581ccaa6589a15c9 (diff)
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: 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.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 000abc07bc1..30a30b7b301 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -617,10 +617,6 @@ static void mgmt_init_hdev(struct hci_dev *hdev)
617 */ 617 */
618 clear_bit(HCI_PAIRABLE, &hdev->dev_flags); 618 clear_bit(HCI_PAIRABLE, &hdev->dev_flags);
619 } 619 }
620
621 if (!test_and_set_bit(HCI_SERVICE_CACHE, &hdev->dev_flags))
622 schedule_delayed_work(&hdev->service_cache,
623 msecs_to_jiffies(SERVICE_CACHE_TIMEOUT));
624} 620}
625 621
626static int read_controller_info(struct sock *sk, u16 index) 622static 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 1395
1400 if (memcmp(cp->uuid, bt_uuid_any, 16) == 0) { 1396 if (memcmp(cp->uuid, bt_uuid_any, 16) == 0) {
1401 err = hci_uuids_clear(hdev); 1397 err = hci_uuids_clear(hdev);
1398
1399 if (hdev_is_powered(hdev) &&
1400 !test_and_set_bit(HCI_SERVICE_CACHE, &hdev->dev_flags))
1401 schedule_delayed_work(&hdev->service_cache,
1402 msecs_to_jiffies(SERVICE_CACHE_TIMEOUT));
1403
1402 goto unlock; 1404 goto unlock;
1403 } 1405 }
1404 1406