Bluetooth: Introduce hci_dev_test_flag helper macro
Instead of manually coding test_bit on hdev->dev_flags all the time, use hci_dev_test_flag helper macro. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:

committed by
Johan Hedberg

parent
cc91cb042c
commit
d7a5a11d7f
@@ -571,7 +571,7 @@ struct hci_dev *hci_get_route(bdaddr_t *dst, bdaddr_t *src)
|
||||
|
||||
list_for_each_entry(d, &hci_dev_list, list) {
|
||||
if (!test_bit(HCI_UP, &d->flags) ||
|
||||
test_bit(HCI_USER_CHANNEL, &d->dev_flags) ||
|
||||
hci_dev_test_flag(d, HCI_USER_CHANNEL) ||
|
||||
d->dev_type != HCI_BREDR)
|
||||
continue;
|
||||
|
||||
@@ -734,7 +734,7 @@ struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst,
|
||||
int err;
|
||||
|
||||
/* Let's make sure that le is enabled.*/
|
||||
if (!test_bit(HCI_LE_ENABLED, &hdev->dev_flags)) {
|
||||
if (!hci_dev_test_flag(hdev, HCI_LE_ENABLED)) {
|
||||
if (lmp_le_capable(hdev))
|
||||
return ERR_PTR(-ECONNREFUSED);
|
||||
|
||||
@@ -799,7 +799,7 @@ struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst,
|
||||
* anyway have to disable it in order to start directed
|
||||
* advertising.
|
||||
*/
|
||||
if (test_bit(HCI_LE_ADV, &hdev->dev_flags)) {
|
||||
if (hci_dev_test_flag(hdev, HCI_LE_ADV)) {
|
||||
u8 enable = 0x00;
|
||||
hci_req_add(&req, HCI_OP_LE_SET_ADV_ENABLE, sizeof(enable),
|
||||
&enable);
|
||||
@@ -810,7 +810,7 @@ struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst,
|
||||
/* If we're active scanning most controllers are unable
|
||||
* to initiate advertising. Simply reject the attempt.
|
||||
*/
|
||||
if (test_bit(HCI_LE_SCAN, &hdev->dev_flags) &&
|
||||
if (hci_dev_test_flag(hdev, HCI_LE_SCAN) &&
|
||||
hdev->le_scan_type == LE_SCAN_ACTIVE) {
|
||||
skb_queue_purge(&req.cmd_q);
|
||||
hci_conn_del(conn);
|
||||
@@ -840,7 +840,7 @@ struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst,
|
||||
* handler for scan disabling knows to set the correct discovery
|
||||
* state.
|
||||
*/
|
||||
if (test_bit(HCI_LE_SCAN, &hdev->dev_flags)) {
|
||||
if (hci_dev_test_flag(hdev, HCI_LE_SCAN)) {
|
||||
hci_req_add_le_scan_disable(&req);
|
||||
set_bit(HCI_LE_SCAN_INTERRUPTED, &hdev->dev_flags);
|
||||
}
|
||||
@@ -864,7 +864,7 @@ struct hci_conn *hci_connect_acl(struct hci_dev *hdev, bdaddr_t *dst,
|
||||
{
|
||||
struct hci_conn *acl;
|
||||
|
||||
if (!test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags)) {
|
||||
if (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED)) {
|
||||
if (lmp_bredr_capable(hdev))
|
||||
return ERR_PTR(-ECONNREFUSED);
|
||||
|
||||
@@ -942,7 +942,7 @@ int hci_conn_check_link_mode(struct hci_conn *conn)
|
||||
* Connections is used and the link is encrypted with AES-CCM
|
||||
* using a P-256 authenticated combination key.
|
||||
*/
|
||||
if (test_bit(HCI_SC_ONLY, &conn->hdev->flags)) {
|
||||
if (hci_dev_test_flag(conn->hdev, HCI_SC_ONLY)) {
|
||||
if (!hci_conn_sc_enabled(conn) ||
|
||||
!test_bit(HCI_CONN_AES_CCM, &conn->flags) ||
|
||||
conn->key_type != HCI_LK_AUTH_COMBINATION_P256)
|
||||
|
Reference in New Issue
Block a user