diff options
Diffstat (limited to 'net/bluetooth/hci_request.c')
-rw-r--r-- | net/bluetooth/hci_request.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c index f857e765e081..55e096d20a0f 100644 --- a/net/bluetooth/hci_request.c +++ b/net/bluetooth/hci_request.c | |||
@@ -270,7 +270,7 @@ void hci_req_add_le_passive_scan(struct hci_request *req) | |||
270 | * and 0x01 (whitelist enabled) use the new filter policies | 270 | * and 0x01 (whitelist enabled) use the new filter policies |
271 | * 0x02 (no whitelist) and 0x03 (whitelist enabled). | 271 | * 0x02 (no whitelist) and 0x03 (whitelist enabled). |
272 | */ | 272 | */ |
273 | if (test_bit(HCI_PRIVACY, &hdev->dev_flags) && | 273 | if (hci_dev_test_flag(hdev, HCI_PRIVACY) && |
274 | (hdev->le_features[0] & HCI_LE_EXT_SCAN_POLICY)) | 274 | (hdev->le_features[0] & HCI_LE_EXT_SCAN_POLICY)) |
275 | filter_policy |= 0x02; | 275 | filter_policy |= 0x02; |
276 | 276 | ||
@@ -304,10 +304,10 @@ static void set_random_addr(struct hci_request *req, bdaddr_t *rpa) | |||
304 | * In this kind of scenario skip the update and let the random | 304 | * In this kind of scenario skip the update and let the random |
305 | * address be updated at the next cycle. | 305 | * address be updated at the next cycle. |
306 | */ | 306 | */ |
307 | if (test_bit(HCI_LE_ADV, &hdev->dev_flags) || | 307 | if (hci_dev_test_flag(hdev, HCI_LE_ADV) || |
308 | hci_conn_hash_lookup_state(hdev, LE_LINK, BT_CONNECT)) { | 308 | hci_conn_hash_lookup_state(hdev, LE_LINK, BT_CONNECT)) { |
309 | BT_DBG("Deferring random address update"); | 309 | BT_DBG("Deferring random address update"); |
310 | set_bit(HCI_RPA_EXPIRED, &hdev->dev_flags); | 310 | hci_dev_set_flag(hdev, HCI_RPA_EXPIRED); |
311 | return; | 311 | return; |
312 | } | 312 | } |
313 | 313 | ||
@@ -324,12 +324,12 @@ int hci_update_random_address(struct hci_request *req, bool require_privacy, | |||
324 | * current RPA has expired or there is something else than | 324 | * current RPA has expired or there is something else than |
325 | * the current RPA in use, then generate a new one. | 325 | * the current RPA in use, then generate a new one. |
326 | */ | 326 | */ |
327 | if (test_bit(HCI_PRIVACY, &hdev->dev_flags)) { | 327 | if (hci_dev_test_flag(hdev, HCI_PRIVACY)) { |
328 | int to; | 328 | int to; |
329 | 329 | ||
330 | *own_addr_type = ADDR_LE_DEV_RANDOM; | 330 | *own_addr_type = ADDR_LE_DEV_RANDOM; |
331 | 331 | ||
332 | if (!test_and_clear_bit(HCI_RPA_EXPIRED, &hdev->dev_flags) && | 332 | if (!hci_dev_test_and_clear_flag(hdev, HCI_RPA_EXPIRED) && |
333 | !bacmp(&hdev->random_addr, &hdev->rpa)) | 333 | !bacmp(&hdev->random_addr, &hdev->rpa)) |
334 | return 0; | 334 | return 0; |
335 | 335 | ||
@@ -383,9 +383,9 @@ int hci_update_random_address(struct hci_request *req, bool require_privacy, | |||
383 | * and a static address has been configured, then use that | 383 | * and a static address has been configured, then use that |
384 | * address instead of the public BR/EDR address. | 384 | * address instead of the public BR/EDR address. |
385 | */ | 385 | */ |
386 | if (test_bit(HCI_FORCE_STATIC_ADDR, &hdev->dbg_flags) || | 386 | if (hci_dev_test_flag(hdev, HCI_FORCE_STATIC_ADDR) || |
387 | !bacmp(&hdev->bdaddr, BDADDR_ANY) || | 387 | !bacmp(&hdev->bdaddr, BDADDR_ANY) || |
388 | (!test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags) && | 388 | (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED) && |
389 | bacmp(&hdev->static_addr, BDADDR_ANY))) { | 389 | bacmp(&hdev->static_addr, BDADDR_ANY))) { |
390 | *own_addr_type = ADDR_LE_DEV_RANDOM; | 390 | *own_addr_type = ADDR_LE_DEV_RANDOM; |
391 | if (bacmp(&hdev->static_addr, &hdev->random_addr)) | 391 | if (bacmp(&hdev->static_addr, &hdev->random_addr)) |
@@ -425,7 +425,7 @@ void __hci_update_page_scan(struct hci_request *req) | |||
425 | struct hci_dev *hdev = req->hdev; | 425 | struct hci_dev *hdev = req->hdev; |
426 | u8 scan; | 426 | u8 scan; |
427 | 427 | ||
428 | if (!test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags)) | 428 | if (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED)) |
429 | return; | 429 | return; |
430 | 430 | ||
431 | if (!hdev_is_powered(hdev)) | 431 | if (!hdev_is_powered(hdev)) |
@@ -434,7 +434,7 @@ void __hci_update_page_scan(struct hci_request *req) | |||
434 | if (mgmt_powering_down(hdev)) | 434 | if (mgmt_powering_down(hdev)) |
435 | return; | 435 | return; |
436 | 436 | ||
437 | if (test_bit(HCI_CONNECTABLE, &hdev->dev_flags) || | 437 | if (hci_dev_test_flag(hdev, HCI_CONNECTABLE) || |
438 | disconnected_whitelist_entries(hdev)) | 438 | disconnected_whitelist_entries(hdev)) |
439 | scan = SCAN_PAGE; | 439 | scan = SCAN_PAGE; |
440 | else | 440 | else |
@@ -443,7 +443,7 @@ void __hci_update_page_scan(struct hci_request *req) | |||
443 | if (test_bit(HCI_PSCAN, &hdev->flags) == !!(scan & SCAN_PAGE)) | 443 | if (test_bit(HCI_PSCAN, &hdev->flags) == !!(scan & SCAN_PAGE)) |
444 | return; | 444 | return; |
445 | 445 | ||
446 | if (test_bit(HCI_DISCOVERABLE, &hdev->dev_flags)) | 446 | if (hci_dev_test_flag(hdev, HCI_DISCOVERABLE)) |
447 | scan |= SCAN_INQUIRY; | 447 | scan |= SCAN_INQUIRY; |
448 | 448 | ||
449 | hci_req_add(req, HCI_OP_WRITE_SCAN_ENABLE, 1, &scan); | 449 | hci_req_add(req, HCI_OP_WRITE_SCAN_ENABLE, 1, &scan); |
@@ -471,14 +471,14 @@ void __hci_update_background_scan(struct hci_request *req) | |||
471 | 471 | ||
472 | if (!test_bit(HCI_UP, &hdev->flags) || | 472 | if (!test_bit(HCI_UP, &hdev->flags) || |
473 | test_bit(HCI_INIT, &hdev->flags) || | 473 | test_bit(HCI_INIT, &hdev->flags) || |
474 | test_bit(HCI_SETUP, &hdev->dev_flags) || | 474 | hci_dev_test_flag(hdev, HCI_SETUP) || |
475 | test_bit(HCI_CONFIG, &hdev->dev_flags) || | 475 | hci_dev_test_flag(hdev, HCI_CONFIG) || |
476 | test_bit(HCI_AUTO_OFF, &hdev->dev_flags) || | 476 | hci_dev_test_flag(hdev, HCI_AUTO_OFF) || |
477 | test_bit(HCI_UNREGISTER, &hdev->dev_flags)) | 477 | hci_dev_test_flag(hdev, HCI_UNREGISTER)) |
478 | return; | 478 | return; |
479 | 479 | ||
480 | /* No point in doing scanning if LE support hasn't been enabled */ | 480 | /* No point in doing scanning if LE support hasn't been enabled */ |
481 | if (!test_bit(HCI_LE_ENABLED, &hdev->dev_flags)) | 481 | if (!hci_dev_test_flag(hdev, HCI_LE_ENABLED)) |
482 | return; | 482 | return; |
483 | 483 | ||
484 | /* If discovery is active don't interfere with it */ | 484 | /* If discovery is active don't interfere with it */ |
@@ -502,7 +502,7 @@ void __hci_update_background_scan(struct hci_request *req) | |||
502 | */ | 502 | */ |
503 | 503 | ||
504 | /* If controller is not scanning we are done. */ | 504 | /* If controller is not scanning we are done. */ |
505 | if (!test_bit(HCI_LE_SCAN, &hdev->dev_flags)) | 505 | if (!hci_dev_test_flag(hdev, HCI_LE_SCAN)) |
506 | return; | 506 | return; |
507 | 507 | ||
508 | hci_req_add_le_scan_disable(req); | 508 | hci_req_add_le_scan_disable(req); |
@@ -524,7 +524,7 @@ void __hci_update_background_scan(struct hci_request *req) | |||
524 | /* If controller is currently scanning, we stop it to ensure we | 524 | /* If controller is currently scanning, we stop it to ensure we |
525 | * don't miss any advertising (due to duplicates filter). | 525 | * don't miss any advertising (due to duplicates filter). |
526 | */ | 526 | */ |
527 | if (test_bit(HCI_LE_SCAN, &hdev->dev_flags)) | 527 | if (hci_dev_test_flag(hdev, HCI_LE_SCAN)) |
528 | hci_req_add_le_scan_disable(req); | 528 | hci_req_add_le_scan_disable(req); |
529 | 529 | ||
530 | hci_req_add_le_passive_scan(req); | 530 | hci_req_add_le_passive_scan(req); |