summaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_request.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2015-11-26 12:15:59 +0200
committerMarcel Holtmann <marcel@holtmann.org>2015-12-10 00:51:49 +0100
commit17fd08ffb5981cff2c921eb479f46b872b02b2b9 (patch)
tree7c60ea06dddddd510508ffed7580dc2efc4fe8d0 /net/bluetooth/hci_request.c
parent02c04afea93fbba7925984df455bc63e7d92da97 (diff)
downloadop-kernel-dev-17fd08ffb5981cff2c921eb479f46b872b02b2b9.zip
op-kernel-dev-17fd08ffb5981cff2c921eb479f46b872b02b2b9.tar.gz
Bluetooth: Remove unnecessary HCI_ADVERTISING_INSTANCE flag
This flag just tells us whether hdev->adv_instances is empty or not. We can equally well use the list_empty() function to get this information. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/hci_request.c')
-rw-r--r--net/bluetooth/hci_request.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c
index 7cc24f1..adfcd6f 100644
--- a/net/bluetooth/hci_request.c
+++ b/net/bluetooth/hci_request.c
@@ -822,7 +822,7 @@ static u8 get_current_adv_instance(struct hci_dev *hdev)
* setting was set. When neither apply, default to the global settings,
* represented by instance "0".
*/
- if (hci_dev_test_flag(hdev, HCI_ADVERTISING_INSTANCE) &&
+ if (!list_empty(&hdev->adv_instances) &&
!hci_dev_test_flag(hdev, HCI_ADVERTISING))
return hdev->cur_adv_instance;
@@ -1144,7 +1144,7 @@ void hci_req_reenable_advertising(struct hci_dev *hdev)
u8 instance;
if (!hci_dev_test_flag(hdev, HCI_ADVERTISING) &&
- !hci_dev_test_flag(hdev, HCI_ADVERTISING_INSTANCE))
+ list_empty(&hdev->adv_instances))
return;
instance = get_current_adv_instance(hdev);
@@ -1202,7 +1202,7 @@ int __hci_req_schedule_adv_instance(struct hci_request *req, u8 instance,
u16 timeout;
if (hci_dev_test_flag(hdev, HCI_ADVERTISING) ||
- !hci_dev_test_flag(hdev, HCI_ADVERTISING_INSTANCE))
+ list_empty(&hdev->adv_instances))
return -EPERM;
if (hdev->adv_instance_timeout)
@@ -1319,10 +1319,8 @@ void hci_req_clear_adv_instance(struct hci_dev *hdev, struct hci_request *req,
}
}
- if (list_empty(&hdev->adv_instances)) {
+ if (list_empty(&hdev->adv_instances))
hdev->cur_adv_instance = 0x00;
- hci_dev_clear_flag(hdev, HCI_ADVERTISING_INSTANCE);
- }
if (!req || !hdev_is_powered(hdev) ||
hci_dev_test_flag(hdev, HCI_ADVERTISING))
@@ -1525,7 +1523,7 @@ static int connectable_update(struct hci_request *req, unsigned long opt)
/* Update the advertising parameters if necessary */
if (hci_dev_test_flag(hdev, HCI_ADVERTISING) ||
- hci_dev_test_flag(hdev, HCI_ADVERTISING_INSTANCE))
+ !list_empty(&hdev->adv_instances))
__hci_req_enable_advertising(req);
__hci_update_background_scan(req);
@@ -2226,13 +2224,12 @@ static int powered_update_hci(struct hci_request *req, unsigned long opt)
*/
if (hci_dev_test_flag(hdev, HCI_LE_ENABLED) &&
(hci_dev_test_flag(hdev, HCI_ADVERTISING) ||
- !hci_dev_test_flag(hdev, HCI_ADVERTISING_INSTANCE))) {
+ list_empty(&hdev->adv_instances))) {
__hci_req_update_adv_data(req, HCI_ADV_CURRENT);
__hci_req_update_scan_rsp_data(req, HCI_ADV_CURRENT);
}
- if (hci_dev_test_flag(hdev, HCI_ADVERTISING_INSTANCE) &&
- hdev->cur_adv_instance == 0x00 &&
+ if (hdev->cur_adv_instance == 0x00 &&
!list_empty(&hdev->adv_instances)) {
adv_instance = list_first_entry(&hdev->adv_instances,
struct adv_info, list);
@@ -2241,7 +2238,7 @@ static int powered_update_hci(struct hci_request *req, unsigned long opt)
if (hci_dev_test_flag(hdev, HCI_ADVERTISING))
__hci_req_enable_advertising(req);
- else if (hci_dev_test_flag(hdev, HCI_ADVERTISING_INSTANCE) &&
+ else if (!list_empty(&hdev->adv_instances) &&
hdev->cur_adv_instance)
__hci_req_schedule_adv_instance(req,
hdev->cur_adv_instance,
OpenPOWER on IntegriCloud