if (lmp_bredr_capable(hdev))
bredr_setup(req);
else
- clear_bit(HCI_BREDR_ENABLED, &hdev->dev_flags);
+ hci_dev_clear_flag(hdev, HCI_BREDR_ENABLED);
if (lmp_le_capable(hdev))
le_setup(req);
if (hdev->discov_timeout > 0) {
cancel_delayed_work(&hdev->discov_off);
hdev->discov_timeout = 0;
- clear_bit(HCI_DISCOVERABLE, &hdev->dev_flags);
- clear_bit(HCI_LIMITED_DISCOVERABLE, &hdev->dev_flags);
+ hci_dev_clear_flag(hdev, HCI_DISCOVERABLE);
+ hci_dev_clear_flag(hdev, HCI_LIMITED_DISCOVERABLE);
}
if (test_and_clear_bit(HCI_SERVICE_CACHE, &hdev->dev_flags))
discov_changed = !test_and_set_bit(HCI_DISCOVERABLE,
&hdev->dev_flags);
} else {
- clear_bit(HCI_LIMITED_DISCOVERABLE, &hdev->dev_flags);
+ hci_dev_clear_flag(hdev, HCI_LIMITED_DISCOVERABLE);
discov_changed = test_and_clear_bit(HCI_DISCOVERABLE,
&hdev->dev_flags);
}
!hci_dev_test_flag(hdev, HCI_CONFIG))
hci_dev_do_close(hdev);
} else {
- clear_bit(HCI_RFKILLED, &hdev->dev_flags);
+ hci_dev_clear_flag(hdev, HCI_RFKILLED);
}
return 0;
(hdev->dev_type == HCI_BREDR &&
!bacmp(&hdev->bdaddr, BDADDR_ANY) &&
!bacmp(&hdev->static_addr, BDADDR_ANY))) {
- clear_bit(HCI_AUTO_OFF, &hdev->dev_flags);
+ hci_dev_clear_flag(hdev, HCI_AUTO_OFF);
hci_dev_do_close(hdev);
} else if (hci_dev_test_flag(hdev, HCI_AUTO_OFF)) {
queue_delayed_work(hdev->req_workqueue, &hdev->power_off,
if (status)
return;
- clear_bit(HCI_PERIODIC_INQ, &hdev->dev_flags);
+ hci_dev_clear_flag(hdev, HCI_PERIODIC_INQ);
hci_conn_check_pending(hdev);
}
if (sent->mode)
hci_dev_set_flag(hdev, HCI_SSP_ENABLED);
else
- clear_bit(HCI_SSP_ENABLED, &hdev->dev_flags);
+ hci_dev_clear_flag(hdev, HCI_SSP_ENABLED);
}
hci_dev_unlock(hdev);
if (sent->support)
hci_dev_set_flag(hdev, HCI_SC_ENABLED);
else
- clear_bit(HCI_SC_ENABLED, &hdev->dev_flags);
+ hci_dev_clear_flag(hdev, HCI_SC_ENABLED);
}
hci_dev_unlock(hdev);
&conn->le_conn_timeout,
conn->conn_timeout);
} else {
- clear_bit(HCI_LE_ADV, &hdev->dev_flags);
+ hci_dev_clear_flag(hdev, HCI_LE_ADV);
}
hci_dev_unlock(hdev);
*/
cancel_delayed_work(&hdev->le_scan_disable);
- clear_bit(HCI_LE_SCAN, &hdev->dev_flags);
+ hci_dev_clear_flag(hdev, HCI_LE_SCAN);
/* The HCI_LE_SCAN_INTERRUPTED flag indicates that we
* interrupted scanning due to a connect request. Mark
hci_dev_set_flag(hdev, HCI_LE_ENABLED);
} else {
hdev->features[1][0] &= ~LMP_HOST_LE;
- clear_bit(HCI_LE_ENABLED, &hdev->dev_flags);
- clear_bit(HCI_ADVERTISING, &hdev->dev_flags);
+ hci_dev_clear_flag(hdev, HCI_LE_ENABLED);
+ hci_dev_clear_flag(hdev, HCI_ADVERTISING);
}
if (sent->simul)
/* All controllers implicitly stop advertising in the event of a
* connection, so ensure that the state bit is cleared.
*/
- clear_bit(HCI_LE_ADV, &hdev->dev_flags);
+ hci_dev_clear_flag(hdev, HCI_LE_ADV);
conn = hci_conn_hash_lookup_state(hdev, LE_LINK, BT_CONNECT);
if (!conn) {
* 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;
}
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)) {
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);
}
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);
/* 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);
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);