* 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;
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);
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)
}
}
- 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))
/* 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);
*/
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);
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,
* set up earlier, then re-enable multi-instance advertising.
*/
if (hci_dev_test_flag(hdev, HCI_ADVERTISING) ||
- !hci_dev_test_flag(hdev, HCI_ADVERTISING_INSTANCE) ||
list_empty(&hdev->adv_instances))
goto unlock;
cmd = pending_find(MGMT_OP_ADD_ADVERTISING, hdev);
- if (status)
- hci_dev_clear_flag(hdev, HCI_ADVERTISING_INSTANCE);
-
list_for_each_entry_safe(adv_instance, n, &hdev->adv_instances, list) {
if (!adv_instance->pending)
continue;
if (hdev->adv_instance_cnt > prev_instance_cnt)
mgmt_advertising_added(sk, hdev, cp->instance);
- hci_dev_set_flag(hdev, HCI_ADVERTISING_INSTANCE);
-
if (hdev->cur_adv_instance == cp->instance) {
/* If the currently advertised instance is being changed then
* cancel the current advertising and schedule the next
goto unlock;
}
- if (!hci_dev_test_flag(hdev, HCI_ADVERTISING_INSTANCE)) {
+ if (list_empty(&hdev->adv_instances)) {
err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_REMOVE_ADVERTISING,
MGMT_STATUS_INVALID_PARAMS);
goto unlock;