diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2015-03-13 05:11:02 -0400 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2015-03-13 06:09:27 -0400 |
commit | a358dc11d80ecaca443aa1fd2fd9d4f3425922e7 (patch) | |
tree | b59d2b813fad4a63b3e33b94e4668b79a6a92885 | |
parent | a1536da255f16f42b8f069b2769134b32558b265 (diff) |
Bluetooth: Introduce hci_dev_clear_flag helper macro
Instead of manually coding clear_bit on hdev->dev_flags all the time,
use hci_dev_clear_flag helper macro.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
-rw-r--r-- | include/net/bluetooth/hci_core.h | 1 | ||||
-rw-r--r-- | net/bluetooth/hci_conn.c | 2 | ||||
-rw-r--r-- | net/bluetooth/hci_core.c | 12 | ||||
-rw-r--r-- | net/bluetooth/hci_event.c | 16 | ||||
-rw-r--r-- | net/bluetooth/hci_sock.c | 4 | ||||
-rw-r--r-- | net/bluetooth/mgmt.c | 68 |
6 files changed, 51 insertions, 52 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index bc2a7e918da7..535b23c73c92 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -503,6 +503,7 @@ extern rwlock_t hci_dev_list_lock; | |||
503 | extern struct mutex hci_cb_list_lock; | 503 | extern struct mutex hci_cb_list_lock; |
504 | 504 | ||
505 | #define hci_dev_set_flag(hdev, nr) set_bit((nr), &(hdev)->dev_flags) | 505 | #define hci_dev_set_flag(hdev, nr) set_bit((nr), &(hdev)->dev_flags) |
506 | #define hci_dev_clear_flag(hdev, nr) clear_bit((nr), &(hdev)->dev_flags) | ||
506 | #define hci_dev_test_flag(hdev, nr) test_bit((nr), &(hdev)->dev_flags) | 507 | #define hci_dev_test_flag(hdev, nr) test_bit((nr), &(hdev)->dev_flags) |
507 | 508 | ||
508 | /* ----- HCI interface to upper protocols ----- */ | 509 | /* ----- HCI interface to upper protocols ----- */ |
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index c0fd42ceff61..ee5e59839b02 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c | |||
@@ -700,7 +700,7 @@ static void hci_req_directed_advertising(struct hci_request *req, | |||
700 | * and write a new random address. The flag will be set back on | 700 | * and write a new random address. The flag will be set back on |
701 | * as soon as the SET_ADV_ENABLE HCI command completes. | 701 | * as soon as the SET_ADV_ENABLE HCI command completes. |
702 | */ | 702 | */ |
703 | clear_bit(HCI_LE_ADV, &hdev->dev_flags); | 703 | hci_dev_clear_flag(hdev, HCI_LE_ADV); |
704 | 704 | ||
705 | /* Set require_privacy to false so that the remote device has a | 705 | /* Set require_privacy to false so that the remote device has a |
706 | * chance of identifying us. | 706 | * chance of identifying us. |
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 252b597362eb..01710698e547 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -591,7 +591,7 @@ static void hci_init2_req(struct hci_request *req, unsigned long opt) | |||
591 | if (lmp_bredr_capable(hdev)) | 591 | if (lmp_bredr_capable(hdev)) |
592 | bredr_setup(req); | 592 | bredr_setup(req); |
593 | else | 593 | else |
594 | clear_bit(HCI_BREDR_ENABLED, &hdev->dev_flags); | 594 | hci_dev_clear_flag(hdev, HCI_BREDR_ENABLED); |
595 | 595 | ||
596 | if (lmp_le_capable(hdev)) | 596 | if (lmp_le_capable(hdev)) |
597 | le_setup(req); | 597 | le_setup(req); |
@@ -1625,8 +1625,8 @@ static int hci_dev_do_close(struct hci_dev *hdev) | |||
1625 | if (hdev->discov_timeout > 0) { | 1625 | if (hdev->discov_timeout > 0) { |
1626 | cancel_delayed_work(&hdev->discov_off); | 1626 | cancel_delayed_work(&hdev->discov_off); |
1627 | hdev->discov_timeout = 0; | 1627 | hdev->discov_timeout = 0; |
1628 | clear_bit(HCI_DISCOVERABLE, &hdev->dev_flags); | 1628 | hci_dev_clear_flag(hdev, HCI_DISCOVERABLE); |
1629 | clear_bit(HCI_LIMITED_DISCOVERABLE, &hdev->dev_flags); | 1629 | hci_dev_clear_flag(hdev, HCI_LIMITED_DISCOVERABLE); |
1630 | } | 1630 | } |
1631 | 1631 | ||
1632 | if (test_and_clear_bit(HCI_SERVICE_CACHE, &hdev->dev_flags)) | 1632 | if (test_and_clear_bit(HCI_SERVICE_CACHE, &hdev->dev_flags)) |
@@ -1846,7 +1846,7 @@ static void hci_update_scan_state(struct hci_dev *hdev, u8 scan) | |||
1846 | discov_changed = !test_and_set_bit(HCI_DISCOVERABLE, | 1846 | discov_changed = !test_and_set_bit(HCI_DISCOVERABLE, |
1847 | &hdev->dev_flags); | 1847 | &hdev->dev_flags); |
1848 | } else { | 1848 | } else { |
1849 | clear_bit(HCI_LIMITED_DISCOVERABLE, &hdev->dev_flags); | 1849 | hci_dev_clear_flag(hdev, HCI_LIMITED_DISCOVERABLE); |
1850 | discov_changed = test_and_clear_bit(HCI_DISCOVERABLE, | 1850 | discov_changed = test_and_clear_bit(HCI_DISCOVERABLE, |
1851 | &hdev->dev_flags); | 1851 | &hdev->dev_flags); |
1852 | } | 1852 | } |
@@ -2087,7 +2087,7 @@ static int hci_rfkill_set_block(void *data, bool blocked) | |||
2087 | !hci_dev_test_flag(hdev, HCI_CONFIG)) | 2087 | !hci_dev_test_flag(hdev, HCI_CONFIG)) |
2088 | hci_dev_do_close(hdev); | 2088 | hci_dev_do_close(hdev); |
2089 | } else { | 2089 | } else { |
2090 | clear_bit(HCI_RFKILLED, &hdev->dev_flags); | 2090 | hci_dev_clear_flag(hdev, HCI_RFKILLED); |
2091 | } | 2091 | } |
2092 | 2092 | ||
2093 | return 0; | 2093 | return 0; |
@@ -2121,7 +2121,7 @@ static void hci_power_on(struct work_struct *work) | |||
2121 | (hdev->dev_type == HCI_BREDR && | 2121 | (hdev->dev_type == HCI_BREDR && |
2122 | !bacmp(&hdev->bdaddr, BDADDR_ANY) && | 2122 | !bacmp(&hdev->bdaddr, BDADDR_ANY) && |
2123 | !bacmp(&hdev->static_addr, BDADDR_ANY))) { | 2123 | !bacmp(&hdev->static_addr, BDADDR_ANY))) { |
2124 | clear_bit(HCI_AUTO_OFF, &hdev->dev_flags); | 2124 | hci_dev_clear_flag(hdev, HCI_AUTO_OFF); |
2125 | hci_dev_do_close(hdev); | 2125 | hci_dev_do_close(hdev); |
2126 | } else if (hci_dev_test_flag(hdev, HCI_AUTO_OFF)) { | 2126 | } else if (hci_dev_test_flag(hdev, HCI_AUTO_OFF)) { |
2127 | queue_delayed_work(hdev->req_workqueue, &hdev->power_off, | 2127 | queue_delayed_work(hdev->req_workqueue, &hdev->power_off, |
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index b01a93efada8..808b78cf8ad0 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -82,7 +82,7 @@ static void hci_cc_exit_periodic_inq(struct hci_dev *hdev, struct sk_buff *skb) | |||
82 | if (status) | 82 | if (status) |
83 | return; | 83 | return; |
84 | 84 | ||
85 | clear_bit(HCI_PERIODIC_INQ, &hdev->dev_flags); | 85 | hci_dev_clear_flag(hdev, HCI_PERIODIC_INQ); |
86 | 86 | ||
87 | hci_conn_check_pending(hdev); | 87 | hci_conn_check_pending(hdev); |
88 | } | 88 | } |
@@ -503,7 +503,7 @@ static void hci_cc_write_ssp_mode(struct hci_dev *hdev, struct sk_buff *skb) | |||
503 | if (sent->mode) | 503 | if (sent->mode) |
504 | hci_dev_set_flag(hdev, HCI_SSP_ENABLED); | 504 | hci_dev_set_flag(hdev, HCI_SSP_ENABLED); |
505 | else | 505 | else |
506 | clear_bit(HCI_SSP_ENABLED, &hdev->dev_flags); | 506 | hci_dev_clear_flag(hdev, HCI_SSP_ENABLED); |
507 | } | 507 | } |
508 | 508 | ||
509 | hci_dev_unlock(hdev); | 509 | hci_dev_unlock(hdev); |
@@ -533,7 +533,7 @@ static void hci_cc_write_sc_support(struct hci_dev *hdev, struct sk_buff *skb) | |||
533 | if (sent->support) | 533 | if (sent->support) |
534 | hci_dev_set_flag(hdev, HCI_SC_ENABLED); | 534 | hci_dev_set_flag(hdev, HCI_SC_ENABLED); |
535 | else | 535 | else |
536 | clear_bit(HCI_SC_ENABLED, &hdev->dev_flags); | 536 | hci_dev_clear_flag(hdev, HCI_SC_ENABLED); |
537 | } | 537 | } |
538 | 538 | ||
539 | hci_dev_unlock(hdev); | 539 | hci_dev_unlock(hdev); |
@@ -1117,7 +1117,7 @@ static void hci_cc_le_set_adv_enable(struct hci_dev *hdev, struct sk_buff *skb) | |||
1117 | &conn->le_conn_timeout, | 1117 | &conn->le_conn_timeout, |
1118 | conn->conn_timeout); | 1118 | conn->conn_timeout); |
1119 | } else { | 1119 | } else { |
1120 | clear_bit(HCI_LE_ADV, &hdev->dev_flags); | 1120 | hci_dev_clear_flag(hdev, HCI_LE_ADV); |
1121 | } | 1121 | } |
1122 | 1122 | ||
1123 | hci_dev_unlock(hdev); | 1123 | hci_dev_unlock(hdev); |
@@ -1217,7 +1217,7 @@ static void hci_cc_le_set_scan_enable(struct hci_dev *hdev, | |||
1217 | */ | 1217 | */ |
1218 | cancel_delayed_work(&hdev->le_scan_disable); | 1218 | cancel_delayed_work(&hdev->le_scan_disable); |
1219 | 1219 | ||
1220 | clear_bit(HCI_LE_SCAN, &hdev->dev_flags); | 1220 | hci_dev_clear_flag(hdev, HCI_LE_SCAN); |
1221 | 1221 | ||
1222 | /* The HCI_LE_SCAN_INTERRUPTED flag indicates that we | 1222 | /* The HCI_LE_SCAN_INTERRUPTED flag indicates that we |
1223 | * interrupted scanning due to a connect request. Mark | 1223 | * interrupted scanning due to a connect request. Mark |
@@ -1391,8 +1391,8 @@ static void hci_cc_write_le_host_supported(struct hci_dev *hdev, | |||
1391 | hci_dev_set_flag(hdev, HCI_LE_ENABLED); | 1391 | hci_dev_set_flag(hdev, HCI_LE_ENABLED); |
1392 | } else { | 1392 | } else { |
1393 | hdev->features[1][0] &= ~LMP_HOST_LE; | 1393 | hdev->features[1][0] &= ~LMP_HOST_LE; |
1394 | clear_bit(HCI_LE_ENABLED, &hdev->dev_flags); | 1394 | hci_dev_clear_flag(hdev, HCI_LE_ENABLED); |
1395 | clear_bit(HCI_ADVERTISING, &hdev->dev_flags); | 1395 | hci_dev_clear_flag(hdev, HCI_ADVERTISING); |
1396 | } | 1396 | } |
1397 | 1397 | ||
1398 | if (sent->simul) | 1398 | if (sent->simul) |
@@ -4409,7 +4409,7 @@ static void hci_le_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
4409 | /* All controllers implicitly stop advertising in the event of a | 4409 | /* All controllers implicitly stop advertising in the event of a |
4410 | * connection, so ensure that the state bit is cleared. | 4410 | * connection, so ensure that the state bit is cleared. |
4411 | */ | 4411 | */ |
4412 | clear_bit(HCI_LE_ADV, &hdev->dev_flags); | 4412 | hci_dev_clear_flag(hdev, HCI_LE_ADV); |
4413 | 4413 | ||
4414 | conn = hci_conn_hash_lookup_state(hdev, LE_LINK, BT_CONNECT); | 4414 | conn = hci_conn_hash_lookup_state(hdev, LE_LINK, BT_CONNECT); |
4415 | if (!conn) { | 4415 | if (!conn) { |
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index b297709d82bf..ca402a0a6740 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c | |||
@@ -474,7 +474,7 @@ static int hci_sock_release(struct socket *sock) | |||
474 | if (hdev) { | 474 | if (hdev) { |
475 | if (hci_pi(sk)->channel == HCI_CHANNEL_USER) { | 475 | if (hci_pi(sk)->channel == HCI_CHANNEL_USER) { |
476 | mgmt_index_added(hdev); | 476 | mgmt_index_added(hdev); |
477 | clear_bit(HCI_USER_CHANNEL, &hdev->dev_flags); | 477 | hci_dev_clear_flag(hdev, HCI_USER_CHANNEL); |
478 | hci_dev_close(hdev->id); | 478 | hci_dev_close(hdev->id); |
479 | } | 479 | } |
480 | 480 | ||
@@ -730,7 +730,7 @@ static int hci_sock_bind(struct socket *sock, struct sockaddr *addr, | |||
730 | 730 | ||
731 | err = hci_dev_open(hdev->id); | 731 | err = hci_dev_open(hdev->id); |
732 | if (err) { | 732 | if (err) { |
733 | clear_bit(HCI_USER_CHANNEL, &hdev->dev_flags); | 733 | hci_dev_clear_flag(hdev, HCI_USER_CHANNEL); |
734 | mgmt_index_added(hdev); | 734 | mgmt_index_added(hdev); |
735 | hci_dev_put(hdev); | 735 | hci_dev_put(hdev); |
736 | goto done; | 736 | goto done; |
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 924bf3ee6261..aa233e37fc93 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -1108,7 +1108,7 @@ static void enable_advertising(struct hci_request *req) | |||
1108 | * and write a new random address. The flag will be set back on | 1108 | * and write a new random address. The flag will be set back on |
1109 | * as soon as the SET_ADV_ENABLE HCI command completes. | 1109 | * as soon as the SET_ADV_ENABLE HCI command completes. |
1110 | */ | 1110 | */ |
1111 | clear_bit(HCI_LE_ADV, &hdev->dev_flags); | 1111 | hci_dev_clear_flag(hdev, HCI_LE_ADV); |
1112 | 1112 | ||
1113 | if (hci_dev_test_flag(hdev, HCI_ADVERTISING_CONNECTABLE)) | 1113 | if (hci_dev_test_flag(hdev, HCI_ADVERTISING_CONNECTABLE)) |
1114 | connectable = true; | 1114 | connectable = true; |
@@ -1189,7 +1189,7 @@ static void mgmt_init_hdev(struct sock *sk, struct hci_dev *hdev) | |||
1189 | * for mgmt we require user-space to explicitly enable | 1189 | * for mgmt we require user-space to explicitly enable |
1190 | * it | 1190 | * it |
1191 | */ | 1191 | */ |
1192 | clear_bit(HCI_BONDABLE, &hdev->dev_flags); | 1192 | hci_dev_clear_flag(hdev, HCI_BONDABLE); |
1193 | } | 1193 | } |
1194 | 1194 | ||
1195 | static int read_controller_info(struct sock *sk, struct hci_dev *hdev, | 1195 | static int read_controller_info(struct sock *sk, struct hci_dev *hdev, |
@@ -1573,7 +1573,7 @@ static void set_discoverable_complete(struct hci_dev *hdev, u8 status, | |||
1573 | if (status) { | 1573 | if (status) { |
1574 | u8 mgmt_err = mgmt_status(status); | 1574 | u8 mgmt_err = mgmt_status(status); |
1575 | mgmt_cmd_status(cmd->sk, cmd->index, cmd->opcode, mgmt_err); | 1575 | mgmt_cmd_status(cmd->sk, cmd->index, cmd->opcode, mgmt_err); |
1576 | clear_bit(HCI_LIMITED_DISCOVERABLE, &hdev->dev_flags); | 1576 | hci_dev_clear_flag(hdev, HCI_LIMITED_DISCOVERABLE); |
1577 | goto remove_cmd; | 1577 | goto remove_cmd; |
1578 | } | 1578 | } |
1579 | 1579 | ||
@@ -1725,7 +1725,7 @@ static int set_discoverable(struct sock *sk, struct hci_dev *hdev, void *data, | |||
1725 | if (cp->val == 0x02) | 1725 | if (cp->val == 0x02) |
1726 | hci_dev_set_flag(hdev, HCI_LIMITED_DISCOVERABLE); | 1726 | hci_dev_set_flag(hdev, HCI_LIMITED_DISCOVERABLE); |
1727 | else | 1727 | else |
1728 | clear_bit(HCI_LIMITED_DISCOVERABLE, &hdev->dev_flags); | 1728 | hci_dev_clear_flag(hdev, HCI_LIMITED_DISCOVERABLE); |
1729 | 1729 | ||
1730 | hci_req_init(&req, hdev); | 1730 | hci_req_init(&req, hdev); |
1731 | 1731 | ||
@@ -1762,7 +1762,7 @@ static int set_discoverable(struct sock *sk, struct hci_dev *hdev, void *data, | |||
1762 | 1762 | ||
1763 | scan |= SCAN_INQUIRY; | 1763 | scan |= SCAN_INQUIRY; |
1764 | } else { | 1764 | } else { |
1765 | clear_bit(HCI_LIMITED_DISCOVERABLE, &hdev->dev_flags); | 1765 | hci_dev_clear_flag(hdev, HCI_LIMITED_DISCOVERABLE); |
1766 | } | 1766 | } |
1767 | 1767 | ||
1768 | hci_req_add(&req, HCI_OP_WRITE_SCAN_ENABLE, sizeof(scan), &scan); | 1768 | hci_req_add(&req, HCI_OP_WRITE_SCAN_ENABLE, sizeof(scan), &scan); |
@@ -1876,8 +1876,8 @@ static int set_connectable_update_settings(struct hci_dev *hdev, | |||
1876 | if (val) { | 1876 | if (val) { |
1877 | hci_dev_set_flag(hdev, HCI_CONNECTABLE); | 1877 | hci_dev_set_flag(hdev, HCI_CONNECTABLE); |
1878 | } else { | 1878 | } else { |
1879 | clear_bit(HCI_CONNECTABLE, &hdev->dev_flags); | 1879 | hci_dev_clear_flag(hdev, HCI_CONNECTABLE); |
1880 | clear_bit(HCI_DISCOVERABLE, &hdev->dev_flags); | 1880 | hci_dev_clear_flag(hdev, HCI_DISCOVERABLE); |
1881 | } | 1881 | } |
1882 | 1882 | ||
1883 | err = send_settings_rsp(sk, MGMT_OP_SET_CONNECTABLE, hdev); | 1883 | err = send_settings_rsp(sk, MGMT_OP_SET_CONNECTABLE, hdev); |
@@ -1941,8 +1941,8 @@ static int set_connectable(struct sock *sk, struct hci_dev *hdev, void *data, | |||
1941 | */ | 1941 | */ |
1942 | if (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED)) { | 1942 | if (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED)) { |
1943 | if (!cp->val) { | 1943 | if (!cp->val) { |
1944 | clear_bit(HCI_LIMITED_DISCOVERABLE, &hdev->dev_flags); | 1944 | hci_dev_clear_flag(hdev, HCI_LIMITED_DISCOVERABLE); |
1945 | clear_bit(HCI_DISCOVERABLE, &hdev->dev_flags); | 1945 | hci_dev_clear_flag(hdev, HCI_DISCOVERABLE); |
1946 | } | 1946 | } |
1947 | update_adv_data(&req); | 1947 | update_adv_data(&req); |
1948 | } else if (cp->val != test_bit(HCI_PSCAN, &hdev->flags)) { | 1948 | } else if (cp->val != test_bit(HCI_PSCAN, &hdev->flags)) { |
@@ -2126,7 +2126,7 @@ static int set_ssp(struct sock *sk, struct hci_dev *hdev, void *data, u16 len) | |||
2126 | changed = test_and_clear_bit(HCI_HS_ENABLED, | 2126 | changed = test_and_clear_bit(HCI_HS_ENABLED, |
2127 | &hdev->dev_flags); | 2127 | &hdev->dev_flags); |
2128 | else | 2128 | else |
2129 | clear_bit(HCI_HS_ENABLED, &hdev->dev_flags); | 2129 | hci_dev_clear_flag(hdev, HCI_HS_ENABLED); |
2130 | } | 2130 | } |
2131 | 2131 | ||
2132 | err = send_settings_rsp(sk, MGMT_OP_SET_SSP, hdev); | 2132 | err = send_settings_rsp(sk, MGMT_OP_SET_SSP, hdev); |
@@ -2306,7 +2306,7 @@ static int set_le(struct sock *sk, struct hci_dev *hdev, void *data, u16 len) | |||
2306 | } | 2306 | } |
2307 | 2307 | ||
2308 | if (!val && hci_dev_test_flag(hdev, HCI_ADVERTISING)) { | 2308 | if (!val && hci_dev_test_flag(hdev, HCI_ADVERTISING)) { |
2309 | clear_bit(HCI_ADVERTISING, &hdev->dev_flags); | 2309 | hci_dev_clear_flag(hdev, HCI_ADVERTISING); |
2310 | changed = true; | 2310 | changed = true; |
2311 | } | 2311 | } |
2312 | 2312 | ||
@@ -4412,7 +4412,7 @@ static void set_advertising_complete(struct hci_dev *hdev, u8 status, | |||
4412 | if (hci_dev_test_flag(hdev, HCI_LE_ADV)) | 4412 | if (hci_dev_test_flag(hdev, HCI_LE_ADV)) |
4413 | hci_dev_set_flag(hdev, HCI_ADVERTISING); | 4413 | hci_dev_set_flag(hdev, HCI_ADVERTISING); |
4414 | else | 4414 | else |
4415 | clear_bit(HCI_ADVERTISING, &hdev->dev_flags); | 4415 | hci_dev_clear_flag(hdev, HCI_ADVERTISING); |
4416 | 4416 | ||
4417 | mgmt_pending_foreach(MGMT_OP_SET_ADVERTISING, hdev, settings_rsp, | 4417 | mgmt_pending_foreach(MGMT_OP_SET_ADVERTISING, hdev, settings_rsp, |
4418 | &match); | 4418 | &match); |
@@ -4469,13 +4469,11 @@ static int set_advertising(struct sock *sk, struct hci_dev *hdev, void *data, | |||
4469 | if (cp->val == 0x02) | 4469 | if (cp->val == 0x02) |
4470 | hci_dev_set_flag(hdev, HCI_ADVERTISING_CONNECTABLE); | 4470 | hci_dev_set_flag(hdev, HCI_ADVERTISING_CONNECTABLE); |
4471 | else | 4471 | else |
4472 | clear_bit(HCI_ADVERTISING_CONNECTABLE, | 4472 | hci_dev_clear_flag(hdev, HCI_ADVERTISING_CONNECTABLE); |
4473 | &hdev->dev_flags); | ||
4474 | } else { | 4473 | } else { |
4475 | changed = test_and_clear_bit(HCI_ADVERTISING, | 4474 | changed = test_and_clear_bit(HCI_ADVERTISING, |
4476 | &hdev->dev_flags); | 4475 | &hdev->dev_flags); |
4477 | clear_bit(HCI_ADVERTISING_CONNECTABLE, | 4476 | hci_dev_clear_flag(hdev, HCI_ADVERTISING_CONNECTABLE); |
4478 | &hdev->dev_flags); | ||
4479 | } | 4477 | } |
4480 | 4478 | ||
4481 | err = send_settings_rsp(sk, MGMT_OP_SET_ADVERTISING, hdev); | 4479 | err = send_settings_rsp(sk, MGMT_OP_SET_ADVERTISING, hdev); |
@@ -4506,7 +4504,7 @@ static int set_advertising(struct sock *sk, struct hci_dev *hdev, void *data, | |||
4506 | if (cp->val == 0x02) | 4504 | if (cp->val == 0x02) |
4507 | hci_dev_set_flag(hdev, HCI_ADVERTISING_CONNECTABLE); | 4505 | hci_dev_set_flag(hdev, HCI_ADVERTISING_CONNECTABLE); |
4508 | else | 4506 | else |
4509 | clear_bit(HCI_ADVERTISING_CONNECTABLE, &hdev->dev_flags); | 4507 | hci_dev_clear_flag(hdev, HCI_ADVERTISING_CONNECTABLE); |
4510 | 4508 | ||
4511 | if (val) | 4509 | if (val) |
4512 | enable_advertising(&req); | 4510 | enable_advertising(&req); |
@@ -4645,7 +4643,7 @@ static void fast_connectable_complete(struct hci_dev *hdev, u8 status, | |||
4645 | if (cp->val) | 4643 | if (cp->val) |
4646 | hci_dev_set_flag(hdev, HCI_FAST_CONNECTABLE); | 4644 | hci_dev_set_flag(hdev, HCI_FAST_CONNECTABLE); |
4647 | else | 4645 | else |
4648 | clear_bit(HCI_FAST_CONNECTABLE, &hdev->dev_flags); | 4646 | hci_dev_clear_flag(hdev, HCI_FAST_CONNECTABLE); |
4649 | 4647 | ||
4650 | send_settings_rsp(cmd->sk, MGMT_OP_SET_FAST_CONNECTABLE, hdev); | 4648 | send_settings_rsp(cmd->sk, MGMT_OP_SET_FAST_CONNECTABLE, hdev); |
4651 | new_settings(hdev, cmd->sk); | 4649 | new_settings(hdev, cmd->sk); |
@@ -4740,7 +4738,7 @@ static void set_bredr_complete(struct hci_dev *hdev, u8 status, u16 opcode) | |||
4740 | /* We need to restore the flag if related HCI commands | 4738 | /* We need to restore the flag if related HCI commands |
4741 | * failed. | 4739 | * failed. |
4742 | */ | 4740 | */ |
4743 | clear_bit(HCI_BREDR_ENABLED, &hdev->dev_flags); | 4741 | hci_dev_clear_flag(hdev, HCI_BREDR_ENABLED); |
4744 | 4742 | ||
4745 | mgmt_cmd_status(cmd->sk, cmd->index, cmd->opcode, mgmt_err); | 4743 | mgmt_cmd_status(cmd->sk, cmd->index, cmd->opcode, mgmt_err); |
4746 | } else { | 4744 | } else { |
@@ -4784,11 +4782,11 @@ static int set_bredr(struct sock *sk, struct hci_dev *hdev, void *data, u16 len) | |||
4784 | 4782 | ||
4785 | if (!hdev_is_powered(hdev)) { | 4783 | if (!hdev_is_powered(hdev)) { |
4786 | if (!cp->val) { | 4784 | if (!cp->val) { |
4787 | clear_bit(HCI_DISCOVERABLE, &hdev->dev_flags); | 4785 | hci_dev_clear_flag(hdev, HCI_DISCOVERABLE); |
4788 | clear_bit(HCI_SSP_ENABLED, &hdev->dev_flags); | 4786 | hci_dev_clear_flag(hdev, HCI_SSP_ENABLED); |
4789 | clear_bit(HCI_LINK_SECURITY, &hdev->dev_flags); | 4787 | hci_dev_clear_flag(hdev, HCI_LINK_SECURITY); |
4790 | clear_bit(HCI_FAST_CONNECTABLE, &hdev->dev_flags); | 4788 | hci_dev_clear_flag(hdev, HCI_FAST_CONNECTABLE); |
4791 | clear_bit(HCI_HS_ENABLED, &hdev->dev_flags); | 4789 | hci_dev_clear_flag(hdev, HCI_HS_ENABLED); |
4792 | } | 4790 | } |
4793 | 4791 | ||
4794 | change_bit(HCI_BREDR_ENABLED, &hdev->dev_flags); | 4792 | change_bit(HCI_BREDR_ENABLED, &hdev->dev_flags); |
@@ -4889,12 +4887,12 @@ static void sc_enable_complete(struct hci_dev *hdev, u8 status, u16 opcode) | |||
4889 | 4887 | ||
4890 | switch (cp->val) { | 4888 | switch (cp->val) { |
4891 | case 0x00: | 4889 | case 0x00: |
4892 | clear_bit(HCI_SC_ENABLED, &hdev->dev_flags); | 4890 | hci_dev_clear_flag(hdev, HCI_SC_ENABLED); |
4893 | clear_bit(HCI_SC_ONLY, &hdev->dev_flags); | 4891 | hci_dev_clear_flag(hdev, HCI_SC_ONLY); |
4894 | break; | 4892 | break; |
4895 | case 0x01: | 4893 | case 0x01: |
4896 | hci_dev_set_flag(hdev, HCI_SC_ENABLED); | 4894 | hci_dev_set_flag(hdev, HCI_SC_ENABLED); |
4897 | clear_bit(HCI_SC_ONLY, &hdev->dev_flags); | 4895 | hci_dev_clear_flag(hdev, HCI_SC_ONLY); |
4898 | break; | 4896 | break; |
4899 | case 0x02: | 4897 | case 0x02: |
4900 | hci_dev_set_flag(hdev, HCI_SC_ENABLED); | 4898 | hci_dev_set_flag(hdev, HCI_SC_ENABLED); |
@@ -4949,11 +4947,11 @@ static int set_secure_conn(struct sock *sk, struct hci_dev *hdev, | |||
4949 | if (cp->val == 0x02) | 4947 | if (cp->val == 0x02) |
4950 | hci_dev_set_flag(hdev, HCI_SC_ONLY); | 4948 | hci_dev_set_flag(hdev, HCI_SC_ONLY); |
4951 | else | 4949 | else |
4952 | clear_bit(HCI_SC_ONLY, &hdev->dev_flags); | 4950 | hci_dev_clear_flag(hdev, HCI_SC_ONLY); |
4953 | } else { | 4951 | } else { |
4954 | changed = test_and_clear_bit(HCI_SC_ENABLED, | 4952 | changed = test_and_clear_bit(HCI_SC_ENABLED, |
4955 | &hdev->dev_flags); | 4953 | &hdev->dev_flags); |
4956 | clear_bit(HCI_SC_ONLY, &hdev->dev_flags); | 4954 | hci_dev_clear_flag(hdev, HCI_SC_ONLY); |
4957 | } | 4955 | } |
4958 | 4956 | ||
4959 | err = send_settings_rsp(sk, MGMT_OP_SET_SECURE_CONN, hdev); | 4957 | err = send_settings_rsp(sk, MGMT_OP_SET_SECURE_CONN, hdev); |
@@ -5082,7 +5080,7 @@ static int set_privacy(struct sock *sk, struct hci_dev *hdev, void *cp_data, | |||
5082 | } else { | 5080 | } else { |
5083 | changed = test_and_clear_bit(HCI_PRIVACY, &hdev->dev_flags); | 5081 | changed = test_and_clear_bit(HCI_PRIVACY, &hdev->dev_flags); |
5084 | memset(hdev->irk, 0, sizeof(hdev->irk)); | 5082 | memset(hdev->irk, 0, sizeof(hdev->irk)); |
5085 | clear_bit(HCI_RPA_EXPIRED, &hdev->dev_flags); | 5083 | hci_dev_clear_flag(hdev, HCI_RPA_EXPIRED); |
5086 | } | 5084 | } |
5087 | 5085 | ||
5088 | err = send_settings_rsp(sk, MGMT_OP_SET_PRIVACY, hdev); | 5086 | err = send_settings_rsp(sk, MGMT_OP_SET_PRIVACY, hdev); |
@@ -6159,7 +6157,7 @@ static int set_public_address(struct sock *sk, struct hci_dev *hdev, | |||
6159 | if (is_configured(hdev)) { | 6157 | if (is_configured(hdev)) { |
6160 | mgmt_index_removed(hdev); | 6158 | mgmt_index_removed(hdev); |
6161 | 6159 | ||
6162 | clear_bit(HCI_UNCONFIGURED, &hdev->dev_flags); | 6160 | hci_dev_clear_flag(hdev, HCI_UNCONFIGURED); |
6163 | 6161 | ||
6164 | hci_dev_set_flag(hdev, HCI_CONFIG); | 6162 | hci_dev_set_flag(hdev, HCI_CONFIG); |
6165 | hci_dev_set_flag(hdev, HCI_AUTO_OFF); | 6163 | hci_dev_set_flag(hdev, HCI_AUTO_OFF); |
@@ -6587,8 +6585,8 @@ void mgmt_discoverable_timeout(struct hci_dev *hdev) | |||
6587 | * of a timeout triggered from general discoverable, it is | 6585 | * of a timeout triggered from general discoverable, it is |
6588 | * safe to unconditionally clear the flag. | 6586 | * safe to unconditionally clear the flag. |
6589 | */ | 6587 | */ |
6590 | clear_bit(HCI_LIMITED_DISCOVERABLE, &hdev->dev_flags); | 6588 | hci_dev_clear_flag(hdev, HCI_LIMITED_DISCOVERABLE); |
6591 | clear_bit(HCI_DISCOVERABLE, &hdev->dev_flags); | 6589 | hci_dev_clear_flag(hdev, HCI_DISCOVERABLE); |
6592 | 6590 | ||
6593 | hci_req_init(&req, hdev); | 6591 | hci_req_init(&req, hdev); |
6594 | if (hci_dev_test_flag(hdev, HCI_BREDR_ENABLED)) { | 6592 | if (hci_dev_test_flag(hdev, HCI_BREDR_ENABLED)) { |
@@ -7137,7 +7135,7 @@ void mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 enable, u8 status) | |||
7137 | 7135 | ||
7138 | if (enable && test_and_clear_bit(HCI_SSP_ENABLED, | 7136 | if (enable && test_and_clear_bit(HCI_SSP_ENABLED, |
7139 | &hdev->dev_flags)) { | 7137 | &hdev->dev_flags)) { |
7140 | clear_bit(HCI_HS_ENABLED, &hdev->dev_flags); | 7138 | hci_dev_clear_flag(hdev, HCI_HS_ENABLED); |
7141 | new_settings(hdev, NULL); | 7139 | new_settings(hdev, NULL); |
7142 | } | 7140 | } |
7143 | 7141 | ||
@@ -7154,7 +7152,7 @@ void mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 enable, u8 status) | |||
7154 | changed = test_and_clear_bit(HCI_HS_ENABLED, | 7152 | changed = test_and_clear_bit(HCI_HS_ENABLED, |
7155 | &hdev->dev_flags); | 7153 | &hdev->dev_flags); |
7156 | else | 7154 | else |
7157 | clear_bit(HCI_HS_ENABLED, &hdev->dev_flags); | 7155 | hci_dev_clear_flag(hdev, HCI_HS_ENABLED); |
7158 | } | 7156 | } |
7159 | 7157 | ||
7160 | mgmt_pending_foreach(MGMT_OP_SET_SSP, hdev, settings_rsp, &match); | 7158 | mgmt_pending_foreach(MGMT_OP_SET_SSP, hdev, settings_rsp, &match); |