Bluetooth: Introduce hci_dev_test_and_set_flag helper macro
Subsystems (2)
Marcel Holtmann
maintainerPATCH 7/7 Bluetooth: Introduce hci_dev_test_and_set_flag helper macro
Instead of manually coding test_and_set_bit on hdev->dev_flags all the time, use hci_dev_test_and_set_flag helper macro.
Signed-off-by Marcel Holtmann <[email protected]>
--- include/net/bluetooth/hci_core.h | 1 + net/bluetooth/hci_core.c | 8 +++---- net/bluetooth/hci_sock.c | 2 +- net/bluetooth/mgmt.c | 46 +++++++++++++++++----------------------- 4 files changed, 26 insertions(+), 31 deletions(-)
include/net/bluetooth/hci_core.h +1 -0
@@ -507,6 +507,7 @@ extern struct mutex hci_cb_list_lock;#define hci_dev_change_flag (hdev, nr) change_bit((nr), &(hdev)->dev_flags)#define hci_dev_test_flag (hdev, nr) test_bit((nr), &(hdev)->dev_flags) +#define hci_dev_test_and_set_flag (hdev, nr) test_and_set_bit((nr), &(hdev)->dev_flags)#define hci_dev_test_and_clear_flag (hdev, nr) test_and_clear_bit((nr), &(hdev)->dev_flags)#define hci_dev_test_and_change_flag (hdev, nr) test_and_change_bit((nr), &(hdev)->dev_flags)
net/bluetooth/hci_core.c +4 -4
@@ -1836,15 +1836,15 @@ static void hci_update_scan_state(struct hci_dev *hdev, u8 scan)BT_DBG ("%s scan 0x%02x" , hdev->name, scan);if ((scan &SCAN_PAGE )) - conn_changed = !test_and_set_bit (HCI_CONNECTABLE , - &hdev->dev_flags); + conn_changed = !hci_dev_test_and_set_flag (hdev, +HCI_CONNECTABLE );else conn_changed =hci_dev_test_and_clear_flag (hdev,HCI_CONNECTABLE );if ((scan &SCAN_INQUIRY )) { - discov_changed = !test_and_set_bit (HCI_DISCOVERABLE , - &hdev->dev_flags); + discov_changed = !hci_dev_test_and_set_flag (hdev, +HCI_DISCOVERABLE ); }else {hci_dev_clear_flag (hdev,HCI_LIMITED_DISCOVERABLE ); discov_changed = hci_dev_test_and_clear_flag(hdev,
net/bluetooth/hci_sock.c +1 -1
@@ -720,7 +720,7 @@ static int hci_sock_bind(struct socket *sock, struct sockaddr *addr, goto done; } -if (test_and_set_bit (HCI_USER_CHANNEL , &hdev->dev_flags)) { +if (hci_dev_test_and_set_flag (hdev,HCI_USER_CHANNEL )) { err = -EUSERS ;hci_dev_put (hdev); goto done;
net/bluetooth/mgmt.c +20 -26
141 lines not on this page · raw message
Signature · 1 line
2.1.0