Skip to content

Commit

Permalink
Bluetooth: Introduce hci_dev_test_and_change_flag helper macro
Browse files Browse the repository at this point in the history
Instead of manually coding test_and_change_bit on hdev->dev_flags all the
time, use hci_dev_test_and_change_flag helper macro.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
  • Loading branch information
Marcel Holtmann authored and Johan Hedberg committed Mar 13, 2015
1 parent ce05d60 commit 516018a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions include/net/bluetooth/hci_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,8 @@ 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_change_flag(hdev, nr) test_and_change_bit((nr), &(hdev)->dev_flags)

/* ----- HCI interface to upper protocols ----- */
int l2cap_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr);
int l2cap_disconn_ind(struct hci_conn *hcon);
Expand Down
2 changes: 1 addition & 1 deletion net/bluetooth/mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -6102,7 +6102,7 @@ static int set_external_config(struct sock *sk, struct hci_dev *hdev,
if (hci_dev_test_flag(hdev, HCI_UNCONFIGURED) == is_configured(hdev)) {
mgmt_index_removed(hdev);

if (test_and_change_bit(HCI_UNCONFIGURED, &hdev->dev_flags)) {
if (hci_dev_test_and_change_flag(hdev, HCI_UNCONFIGURED)) {
hci_dev_set_flag(hdev, HCI_CONFIG);
hci_dev_set_flag(hdev, HCI_AUTO_OFF);

Expand Down

0 comments on commit 516018a

Please sign in to comment.