static void mgmt_init_hdev(struct sock *sk, struct hci_dev *hdev)
{
- if (test_and_set_bit(HCI_MGMT, &hdev->dev_flags))
+ if (hci_dev_test_and_set_flag(hdev, HCI_MGMT))
return;
INIT_DELAYED_WORK(&hdev->service_cache, service_cache_off);
cp = cmd->param;
if (cp->val) {
- changed = !test_and_set_bit(HCI_DISCOVERABLE,
- &hdev->dev_flags);
+ changed = !hci_dev_test_and_set_flag(hdev, HCI_DISCOVERABLE);
if (hdev->discov_timeout > 0) {
int to = msecs_to_jiffies(hdev->discov_timeout * 1000);
cp = cmd->param;
if (cp->val) {
- conn_changed = !test_and_set_bit(HCI_CONNECTABLE,
- &hdev->dev_flags);
+ conn_changed = !hci_dev_test_and_set_flag(hdev,
+ HCI_CONNECTABLE);
discov_changed = false;
} else {
conn_changed = hci_dev_test_and_clear_flag(hdev,
hci_dev_lock(hdev);
if (cp->val)
- changed = !test_and_set_bit(HCI_BONDABLE, &hdev->dev_flags);
+ changed = !hci_dev_test_and_set_flag(hdev, HCI_BONDABLE);
else
changed = hci_dev_test_and_clear_flag(hdev, HCI_BONDABLE);
bool changed;
if (cp->val) {
- changed = !test_and_set_bit(HCI_SSP_ENABLED,
- &hdev->dev_flags);
+ changed = !hci_dev_test_and_set_flag(hdev,
+ HCI_SSP_ENABLED);
} else {
changed = hci_dev_test_and_clear_flag(hdev,
HCI_SSP_ENABLED);
}
if (cp->val) {
- changed = !test_and_set_bit(HCI_HS_ENABLED, &hdev->dev_flags);
+ changed = !hci_dev_test_and_set_flag(hdev, HCI_HS_ENABLED);
} else {
if (hdev_is_powered(hdev)) {
err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_HS,
if (!hdev_is_powered(hdev))
return false;
- if (!test_and_set_bit(HCI_SERVICE_CACHE, &hdev->dev_flags)) {
+ if (!hci_dev_test_and_set_flag(hdev, HCI_SERVICE_CACHE)) {
queue_delayed_work(hdev->workqueue, &hdev->service_cache,
CACHE_TIMEOUT);
return true;
hci_link_keys_clear(hdev);
if (cp->debug_keys)
- changed = !test_and_set_bit(HCI_KEEP_DEBUG_KEYS,
- &hdev->dev_flags);
+ changed = !hci_dev_test_and_set_flag(hdev, HCI_KEEP_DEBUG_KEYS);
else
changed = hci_dev_test_and_clear_flag(hdev,
HCI_KEEP_DEBUG_KEYS);
bool changed;
if (cp->val) {
- changed = !test_and_set_bit(HCI_ADVERTISING,
- &hdev->dev_flags);
+ changed = !hci_dev_test_and_set_flag(hdev, HCI_ADVERTISING);
if (cp->val == 0x02)
hci_dev_set_flag(hdev, HCI_ADVERTISING_CONNECTABLE);
else
bool changed;
if (cp->val) {
- changed = !test_and_set_bit(HCI_SC_ENABLED,
- &hdev->dev_flags);
+ changed = !hci_dev_test_and_set_flag(hdev,
+ HCI_SC_ENABLED);
if (cp->val == 0x02)
hci_dev_set_flag(hdev, HCI_SC_ONLY);
else
hci_dev_lock(hdev);
if (cp->val)
- changed = !test_and_set_bit(HCI_KEEP_DEBUG_KEYS,
- &hdev->dev_flags);
+ changed = !hci_dev_test_and_set_flag(hdev, HCI_KEEP_DEBUG_KEYS);
else
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);
+ use_changed = !hci_dev_test_and_set_flag(hdev,
+ HCI_USE_DEBUG_KEYS);
else
use_changed = hci_dev_test_and_clear_flag(hdev,
HCI_USE_DEBUG_KEYS);
hci_dev_set_flag(hdev, HCI_RPA_RESOLVING);
if (cp->privacy) {
- changed = !test_and_set_bit(HCI_PRIVACY, &hdev->dev_flags);
+ changed = !hci_dev_test_and_set_flag(hdev, HCI_PRIVACY);
memcpy(hdev->irk, cp->irk, sizeof(hdev->irk));
hci_dev_set_flag(hdev, HCI_RPA_EXPIRED);
} else {
hci_dev_lock(hdev);
if (cp->config)
- changed = !test_and_set_bit(HCI_EXT_CONFIGURED,
- &hdev->dev_flags);
+ changed = !hci_dev_test_and_set_flag(hdev, HCI_EXT_CONFIGURED);
else
changed = hci_dev_test_and_clear_flag(hdev, HCI_EXT_CONFIGURED);
}
if (test_bit(HCI_AUTH, &hdev->flags))
- changed = !test_and_set_bit(HCI_LINK_SECURITY,
- &hdev->dev_flags);
+ changed = !hci_dev_test_and_set_flag(hdev, HCI_LINK_SECURITY);
else
changed = hci_dev_test_and_clear_flag(hdev, HCI_LINK_SECURITY);
}
if (enable) {
- changed = !test_and_set_bit(HCI_SSP_ENABLED, &hdev->dev_flags);
+ changed = !hci_dev_test_and_set_flag(hdev, HCI_SSP_ENABLED);
} else {
changed = hci_dev_test_and_clear_flag(hdev, HCI_SSP_ENABLED);
if (!changed)