* particularly important if the setup procedure has not yet
* completed.
*/
- if (test_and_clear_bit(HCI_AUTO_OFF, &hdev->dev_flags))
+ if (hci_dev_test_and_clear_flag(hdev, HCI_AUTO_OFF))
cancel_delayed_work(&hdev->power_off);
/* After this call it is guaranteed that the setup procedure
hci_dev_clear_flag(hdev, HCI_LIMITED_DISCOVERABLE);
}
- if (test_and_clear_bit(HCI_SERVICE_CACHE, &hdev->dev_flags))
+ if (hci_dev_test_and_clear_flag(hdev, HCI_SERVICE_CACHE))
cancel_delayed_work(&hdev->service_cache);
cancel_delayed_work_sync(&hdev->le_scan_disable);
hci_discovery_set_state(hdev, DISCOVERY_STOPPED);
- if (!test_and_clear_bit(HCI_AUTO_OFF, &hdev->dev_flags)) {
+ if (!hci_dev_test_and_clear_flag(hdev, HCI_AUTO_OFF)) {
if (hdev->dev_type == HCI_BREDR)
mgmt_powered(hdev, 0);
}
goto done;
}
- if (test_and_clear_bit(HCI_AUTO_OFF, &hdev->dev_flags))
+ if (hci_dev_test_and_clear_flag(hdev, HCI_AUTO_OFF))
cancel_delayed_work(&hdev->power_off);
err = hci_dev_do_close(hdev);
conn_changed = !test_and_set_bit(HCI_CONNECTABLE,
&hdev->dev_flags);
else
- conn_changed = test_and_clear_bit(HCI_CONNECTABLE,
- &hdev->dev_flags);
+ conn_changed = hci_dev_test_and_clear_flag(hdev,
+ HCI_CONNECTABLE);
if ((scan & SCAN_INQUIRY)) {
discov_changed = !test_and_set_bit(HCI_DISCOVERABLE,
&hdev->dev_flags);
} else {
hci_dev_clear_flag(hdev, HCI_LIMITED_DISCOVERABLE);
- discov_changed = test_and_clear_bit(HCI_DISCOVERABLE,
- &hdev->dev_flags);
+ discov_changed = hci_dev_test_and_clear_flag(hdev,
+ HCI_DISCOVERABLE);
}
if (!hci_dev_test_flag(hdev, HCI_MGMT))
HCI_AUTO_OFF_TIMEOUT);
}
- if (test_and_clear_bit(HCI_SETUP, &hdev->dev_flags)) {
+ if (hci_dev_test_and_clear_flag(hdev, HCI_SETUP)) {
/* For unconfigured devices, set the HCI_RAW flag
* so that userspace can easily identify them.
*/
* and no event will be send.
*/
mgmt_index_added(hdev);
- } else if (test_and_clear_bit(HCI_CONFIG, &hdev->dev_flags)) {
+ } else if (hci_dev_test_and_clear_flag(hdev, HCI_CONFIG)) {
/* When the controller is now configured, then it
* is important to clear the HCI_RAW flag.
*/
service_cache.work);
struct hci_request req;
- if (!test_and_clear_bit(HCI_SERVICE_CACHE, &hdev->dev_flags))
+ if (!hci_dev_test_and_clear_flag(hdev, HCI_SERVICE_CACHE))
return;
hci_req_init(&req, hdev);
goto failed;
}
- if (test_and_clear_bit(HCI_AUTO_OFF, &hdev->dev_flags)) {
+ if (hci_dev_test_and_clear_flag(hdev, HCI_AUTO_OFF)) {
cancel_delayed_work(&hdev->power_off);
if (cp->val) {
to);
}
} else {
- changed = test_and_clear_bit(HCI_DISCOVERABLE,
- &hdev->dev_flags);
+ changed = hci_dev_test_and_clear_flag(hdev, HCI_DISCOVERABLE);
}
send_settings_rsp(cmd->sk, MGMT_OP_SET_DISCOVERABLE, hdev);
&hdev->dev_flags);
discov_changed = false;
} else {
- conn_changed = test_and_clear_bit(HCI_CONNECTABLE,
- &hdev->dev_flags);
- discov_changed = test_and_clear_bit(HCI_DISCOVERABLE,
- &hdev->dev_flags);
+ conn_changed = hci_dev_test_and_clear_flag(hdev,
+ HCI_CONNECTABLE);
+ discov_changed = hci_dev_test_and_clear_flag(hdev,
+ HCI_DISCOVERABLE);
}
send_settings_rsp(cmd->sk, MGMT_OP_SET_CONNECTABLE, hdev);
if (cp->val)
changed = !test_and_set_bit(HCI_BONDABLE, &hdev->dev_flags);
else
- changed = test_and_clear_bit(HCI_BONDABLE, &hdev->dev_flags);
+ changed = hci_dev_test_and_clear_flag(hdev, HCI_BONDABLE);
err = send_settings_rsp(sk, MGMT_OP_SET_BONDABLE, hdev);
if (err < 0)
changed = !test_and_set_bit(HCI_SSP_ENABLED,
&hdev->dev_flags);
} else {
- changed = test_and_clear_bit(HCI_SSP_ENABLED,
- &hdev->dev_flags);
+ changed = hci_dev_test_and_clear_flag(hdev,
+ HCI_SSP_ENABLED);
if (!changed)
- changed = test_and_clear_bit(HCI_HS_ENABLED,
- &hdev->dev_flags);
+ changed = hci_dev_test_and_clear_flag(hdev,
+ HCI_HS_ENABLED);
else
hci_dev_clear_flag(hdev, HCI_HS_ENABLED);
}
goto unlock;
}
- changed = test_and_clear_bit(HCI_HS_ENABLED, &hdev->dev_flags);
+ changed = hci_dev_test_and_clear_flag(hdev, HCI_HS_ENABLED);
}
err = send_settings_rsp(sk, MGMT_OP_SET_HS, hdev);
hci_req_init(&req, hdev);
- if (test_and_clear_bit(HCI_SERVICE_CACHE, &hdev->dev_flags)) {
+ if (hci_dev_test_and_clear_flag(hdev, HCI_SERVICE_CACHE)) {
hci_dev_unlock(hdev);
cancel_delayed_work_sync(&hdev->service_cache);
hci_dev_lock(hdev);
changed = !test_and_set_bit(HCI_KEEP_DEBUG_KEYS,
&hdev->dev_flags);
else
- changed = test_and_clear_bit(HCI_KEEP_DEBUG_KEYS,
- &hdev->dev_flags);
+ changed = hci_dev_test_and_clear_flag(hdev,
+ HCI_KEEP_DEBUG_KEYS);
if (changed)
new_settings(hdev, NULL);
else
hci_dev_clear_flag(hdev, HCI_ADVERTISING_CONNECTABLE);
} else {
- changed = test_and_clear_bit(HCI_ADVERTISING,
- &hdev->dev_flags);
+ changed = hci_dev_test_and_clear_flag(hdev, HCI_ADVERTISING);
hci_dev_clear_flag(hdev, HCI_ADVERTISING_CONNECTABLE);
}
else
hci_dev_clear_flag(hdev, HCI_SC_ONLY);
} else {
- changed = test_and_clear_bit(HCI_SC_ENABLED,
- &hdev->dev_flags);
+ changed = hci_dev_test_and_clear_flag(hdev,
+ HCI_SC_ENABLED);
hci_dev_clear_flag(hdev, HCI_SC_ONLY);
}
changed = !test_and_set_bit(HCI_KEEP_DEBUG_KEYS,
&hdev->dev_flags);
else
- changed = test_and_clear_bit(HCI_KEEP_DEBUG_KEYS,
- &hdev->dev_flags);
+ changed = hci_dev_test_and_clear_flag(hdev,
+ HCI_KEEP_DEBUG_KEYS);
if (cp->val == 0x02)
use_changed = !test_and_set_bit(HCI_USE_DEBUG_KEYS,
&hdev->dev_flags);
else
- use_changed = test_and_clear_bit(HCI_USE_DEBUG_KEYS,
- &hdev->dev_flags);
+ use_changed = hci_dev_test_and_clear_flag(hdev,
+ HCI_USE_DEBUG_KEYS);
if (hdev_is_powered(hdev) && use_changed &&
hci_dev_test_flag(hdev, HCI_SSP_ENABLED)) {
memcpy(hdev->irk, cp->irk, sizeof(hdev->irk));
hci_dev_set_flag(hdev, HCI_RPA_EXPIRED);
} else {
- changed = test_and_clear_bit(HCI_PRIVACY, &hdev->dev_flags);
+ changed = hci_dev_test_and_clear_flag(hdev, HCI_PRIVACY);
memset(hdev->irk, 0, sizeof(hdev->irk));
hci_dev_clear_flag(hdev, HCI_RPA_EXPIRED);
}
changed = !test_and_set_bit(HCI_EXT_CONFIGURED,
&hdev->dev_flags);
else
- changed = test_and_clear_bit(HCI_EXT_CONFIGURED,
- &hdev->dev_flags);
+ changed = hci_dev_test_and_clear_flag(hdev, HCI_EXT_CONFIGURED);
err = send_options_rsp(sk, MGMT_OP_SET_EXTERNAL_CONFIG, hdev);
if (err < 0)
changed = !test_and_set_bit(HCI_LINK_SECURITY,
&hdev->dev_flags);
else
- changed = test_and_clear_bit(HCI_LINK_SECURITY,
- &hdev->dev_flags);
+ changed = hci_dev_test_and_clear_flag(hdev, HCI_LINK_SECURITY);
mgmt_pending_foreach(MGMT_OP_SET_LINK_SECURITY, hdev, settings_rsp,
&match);
if (status) {
u8 mgmt_err = mgmt_status(status);
- if (enable && test_and_clear_bit(HCI_SSP_ENABLED,
- &hdev->dev_flags)) {
+ if (enable && hci_dev_test_and_clear_flag(hdev,
+ HCI_SSP_ENABLED)) {
hci_dev_clear_flag(hdev, HCI_HS_ENABLED);
new_settings(hdev, NULL);
}
if (enable) {
changed = !test_and_set_bit(HCI_SSP_ENABLED, &hdev->dev_flags);
} else {
- changed = test_and_clear_bit(HCI_SSP_ENABLED, &hdev->dev_flags);
+ changed = hci_dev_test_and_clear_flag(hdev, HCI_SSP_ENABLED);
if (!changed)
- changed = test_and_clear_bit(HCI_HS_ENABLED,
- &hdev->dev_flags);
+ changed = hci_dev_test_and_clear_flag(hdev,
+ HCI_HS_ENABLED);
else
hci_dev_clear_flag(hdev, HCI_HS_ENABLED);
}