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) { | ||
