* and write a new random address. The flag will be set back on
* as soon as the SET_ADV_ENABLE HCI command completes.
*/
- clear_bit(HCI_LE_ADV, &hdev->dev_flags);
+ hci_dev_clear_flag(hdev, HCI_LE_ADV);
if (hci_dev_test_flag(hdev, HCI_ADVERTISING_CONNECTABLE))
connectable = true;
* for mgmt we require user-space to explicitly enable
* it
*/
- clear_bit(HCI_BONDABLE, &hdev->dev_flags);
+ hci_dev_clear_flag(hdev, HCI_BONDABLE);
}
static int read_controller_info(struct sock *sk, struct hci_dev *hdev,
if (status) {
u8 mgmt_err = mgmt_status(status);
mgmt_cmd_status(cmd->sk, cmd->index, cmd->opcode, mgmt_err);
- clear_bit(HCI_LIMITED_DISCOVERABLE, &hdev->dev_flags);
+ hci_dev_clear_flag(hdev, HCI_LIMITED_DISCOVERABLE);
goto remove_cmd;
}
* and so no need to check HCI_LIMITED_DISCOVERABLE.
*/
if (!!cp->val != hci_dev_test_flag(hdev, HCI_DISCOVERABLE)) {
- change_bit(HCI_DISCOVERABLE, &hdev->dev_flags);
+ hci_dev_change_flag(hdev, HCI_DISCOVERABLE);
changed = true;
}
if (cp->val == 0x02)
hci_dev_set_flag(hdev, HCI_LIMITED_DISCOVERABLE);
else
- clear_bit(HCI_LIMITED_DISCOVERABLE, &hdev->dev_flags);
+ hci_dev_clear_flag(hdev, HCI_LIMITED_DISCOVERABLE);
hci_req_init(&req, hdev);
scan |= SCAN_INQUIRY;
} else {
- clear_bit(HCI_LIMITED_DISCOVERABLE, &hdev->dev_flags);
+ hci_dev_clear_flag(hdev, HCI_LIMITED_DISCOVERABLE);
}
hci_req_add(&req, HCI_OP_WRITE_SCAN_ENABLE, sizeof(scan), &scan);
if (val) {
hci_dev_set_flag(hdev, HCI_CONNECTABLE);
} else {
- clear_bit(HCI_CONNECTABLE, &hdev->dev_flags);
- clear_bit(HCI_DISCOVERABLE, &hdev->dev_flags);
+ hci_dev_clear_flag(hdev, HCI_CONNECTABLE);
+ hci_dev_clear_flag(hdev, HCI_DISCOVERABLE);
}
err = send_settings_rsp(sk, MGMT_OP_SET_CONNECTABLE, hdev);
*/
if (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED)) {
if (!cp->val) {
- clear_bit(HCI_LIMITED_DISCOVERABLE, &hdev->dev_flags);
- clear_bit(HCI_DISCOVERABLE, &hdev->dev_flags);
+ hci_dev_clear_flag(hdev, HCI_LIMITED_DISCOVERABLE);
+ hci_dev_clear_flag(hdev, HCI_DISCOVERABLE);
}
update_adv_data(&req);
} else if (cp->val != test_bit(HCI_PSCAN, &hdev->flags)) {
bool changed = false;
if (!!cp->val != hci_dev_test_flag(hdev, HCI_LINK_SECURITY)) {
- change_bit(HCI_LINK_SECURITY, &hdev->dev_flags);
+ hci_dev_change_flag(hdev, HCI_LINK_SECURITY);
changed = true;
}
changed = test_and_clear_bit(HCI_HS_ENABLED,
&hdev->dev_flags);
else
- clear_bit(HCI_HS_ENABLED, &hdev->dev_flags);
+ hci_dev_clear_flag(hdev, HCI_HS_ENABLED);
}
err = send_settings_rsp(sk, MGMT_OP_SET_SSP, hdev);
bool changed = false;
if (val != hci_dev_test_flag(hdev, HCI_LE_ENABLED)) {
- change_bit(HCI_LE_ENABLED, &hdev->dev_flags);
+ hci_dev_change_flag(hdev, HCI_LE_ENABLED);
changed = true;
}
if (!val && hci_dev_test_flag(hdev, HCI_ADVERTISING)) {
- clear_bit(HCI_ADVERTISING, &hdev->dev_flags);
+ hci_dev_clear_flag(hdev, HCI_ADVERTISING);
changed = true;
}
if (hci_dev_test_flag(hdev, HCI_LE_ADV))
hci_dev_set_flag(hdev, HCI_ADVERTISING);
else
- clear_bit(HCI_ADVERTISING, &hdev->dev_flags);
+ hci_dev_clear_flag(hdev, HCI_ADVERTISING);
mgmt_pending_foreach(MGMT_OP_SET_ADVERTISING, hdev, settings_rsp,
&match);
if (cp->val == 0x02)
hci_dev_set_flag(hdev, HCI_ADVERTISING_CONNECTABLE);
else
- clear_bit(HCI_ADVERTISING_CONNECTABLE,
- &hdev->dev_flags);
+ hci_dev_clear_flag(hdev, HCI_ADVERTISING_CONNECTABLE);
} else {
changed = test_and_clear_bit(HCI_ADVERTISING,
&hdev->dev_flags);
- clear_bit(HCI_ADVERTISING_CONNECTABLE,
- &hdev->dev_flags);
+ hci_dev_clear_flag(hdev, HCI_ADVERTISING_CONNECTABLE);
}
err = send_settings_rsp(sk, MGMT_OP_SET_ADVERTISING, hdev);
if (cp->val == 0x02)
hci_dev_set_flag(hdev, HCI_ADVERTISING_CONNECTABLE);
else
- clear_bit(HCI_ADVERTISING_CONNECTABLE, &hdev->dev_flags);
+ hci_dev_clear_flag(hdev, HCI_ADVERTISING_CONNECTABLE);
if (val)
enable_advertising(&req);
if (cp->val)
hci_dev_set_flag(hdev, HCI_FAST_CONNECTABLE);
else
- clear_bit(HCI_FAST_CONNECTABLE, &hdev->dev_flags);
+ hci_dev_clear_flag(hdev, HCI_FAST_CONNECTABLE);
send_settings_rsp(cmd->sk, MGMT_OP_SET_FAST_CONNECTABLE, hdev);
new_settings(hdev, cmd->sk);
}
if (!hdev_is_powered(hdev)) {
- change_bit(HCI_FAST_CONNECTABLE, &hdev->dev_flags);
+ hci_dev_change_flag(hdev, HCI_FAST_CONNECTABLE);
err = send_settings_rsp(sk, MGMT_OP_SET_FAST_CONNECTABLE,
hdev);
new_settings(hdev, sk);
/* We need to restore the flag if related HCI commands
* failed.
*/
- clear_bit(HCI_BREDR_ENABLED, &hdev->dev_flags);
+ hci_dev_clear_flag(hdev, HCI_BREDR_ENABLED);
mgmt_cmd_status(cmd->sk, cmd->index, cmd->opcode, mgmt_err);
} else {
if (!hdev_is_powered(hdev)) {
if (!cp->val) {
- clear_bit(HCI_DISCOVERABLE, &hdev->dev_flags);
- clear_bit(HCI_SSP_ENABLED, &hdev->dev_flags);
- clear_bit(HCI_LINK_SECURITY, &hdev->dev_flags);
- clear_bit(HCI_FAST_CONNECTABLE, &hdev->dev_flags);
- clear_bit(HCI_HS_ENABLED, &hdev->dev_flags);
+ hci_dev_clear_flag(hdev, HCI_DISCOVERABLE);
+ hci_dev_clear_flag(hdev, HCI_SSP_ENABLED);
+ hci_dev_clear_flag(hdev, HCI_LINK_SECURITY);
+ hci_dev_clear_flag(hdev, HCI_FAST_CONNECTABLE);
+ hci_dev_clear_flag(hdev, HCI_HS_ENABLED);
}
- change_bit(HCI_BREDR_ENABLED, &hdev->dev_flags);
+ hci_dev_change_flag(hdev, HCI_BREDR_ENABLED);
err = send_settings_rsp(sk, MGMT_OP_SET_BREDR, hdev);
if (err < 0)
switch (cp->val) {
case 0x00:
- clear_bit(HCI_SC_ENABLED, &hdev->dev_flags);
- clear_bit(HCI_SC_ONLY, &hdev->dev_flags);
+ hci_dev_clear_flag(hdev, HCI_SC_ENABLED);
+ hci_dev_clear_flag(hdev, HCI_SC_ONLY);
break;
case 0x01:
hci_dev_set_flag(hdev, HCI_SC_ENABLED);
- clear_bit(HCI_SC_ONLY, &hdev->dev_flags);
+ hci_dev_clear_flag(hdev, HCI_SC_ONLY);
break;
case 0x02:
hci_dev_set_flag(hdev, HCI_SC_ENABLED);
if (cp->val == 0x02)
hci_dev_set_flag(hdev, HCI_SC_ONLY);
else
- clear_bit(HCI_SC_ONLY, &hdev->dev_flags);
+ hci_dev_clear_flag(hdev, HCI_SC_ONLY);
} else {
changed = test_and_clear_bit(HCI_SC_ENABLED,
&hdev->dev_flags);
- clear_bit(HCI_SC_ONLY, &hdev->dev_flags);
+ hci_dev_clear_flag(hdev, HCI_SC_ONLY);
}
err = send_settings_rsp(sk, MGMT_OP_SET_SECURE_CONN, hdev);
} else {
changed = test_and_clear_bit(HCI_PRIVACY, &hdev->dev_flags);
memset(hdev->irk, 0, sizeof(hdev->irk));
- clear_bit(HCI_RPA_EXPIRED, &hdev->dev_flags);
+ hci_dev_clear_flag(hdev, HCI_RPA_EXPIRED);
}
err = send_settings_rsp(sk, MGMT_OP_SET_PRIVACY, hdev);
if (is_configured(hdev)) {
mgmt_index_removed(hdev);
- clear_bit(HCI_UNCONFIGURED, &hdev->dev_flags);
+ hci_dev_clear_flag(hdev, HCI_UNCONFIGURED);
hci_dev_set_flag(hdev, HCI_CONFIG);
hci_dev_set_flag(hdev, HCI_AUTO_OFF);
* of a timeout triggered from general discoverable, it is
* safe to unconditionally clear the flag.
*/
- clear_bit(HCI_LIMITED_DISCOVERABLE, &hdev->dev_flags);
- clear_bit(HCI_DISCOVERABLE, &hdev->dev_flags);
+ hci_dev_clear_flag(hdev, HCI_LIMITED_DISCOVERABLE);
+ hci_dev_clear_flag(hdev, HCI_DISCOVERABLE);
hci_req_init(&req, hdev);
if (hci_dev_test_flag(hdev, HCI_BREDR_ENABLED)) {
if (enable && test_and_clear_bit(HCI_SSP_ENABLED,
&hdev->dev_flags)) {
- clear_bit(HCI_HS_ENABLED, &hdev->dev_flags);
+ hci_dev_clear_flag(hdev, HCI_HS_ENABLED);
new_settings(hdev, NULL);
}
changed = test_and_clear_bit(HCI_HS_ENABLED,
&hdev->dev_flags);
else
- clear_bit(HCI_HS_ENABLED, &hdev->dev_flags);
+ hci_dev_clear_flag(hdev, HCI_HS_ENABLED);
}
mgmt_pending_foreach(MGMT_OP_SET_SSP, hdev, settings_rsp, &match);