Skip to content

Commit 6f59f99

Browse files
Vudentzholtmann
authored andcommitted
Bluetooth: MGMT: Use hci_dev_test_and_{set,clear}_flag
This make use of hci_dev_test_and_{set,clear}_flag instead of doing 2 operations in a row. Fixes: cbbdfa6 ("Bluetooth: Enable controller RPA resolution using Experimental feature") Signed-off-by: Luiz Augusto von Dentz <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
1 parent 801b4c0 commit 6f59f99

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

net/bluetooth/mgmt.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4041,10 +4041,10 @@ static int set_zero_key_func(struct sock *sk, struct hci_dev *hdev,
40414041
#endif
40424042

40434043
if (hdev && use_ll_privacy(hdev) && !hdev_is_powered(hdev)) {
4044-
bool changed = hci_dev_test_flag(hdev, HCI_ENABLE_LL_PRIVACY);
4045-
4046-
hci_dev_clear_flag(hdev, HCI_ENABLE_LL_PRIVACY);
4044+
bool changed;
40474045

4046+
changed = hci_dev_test_and_clear_flag(hdev,
4047+
HCI_ENABLE_LL_PRIVACY);
40484048
if (changed)
40494049
exp_ll_privacy_feature_changed(false, hdev, sk);
40504050
}
@@ -4139,15 +4139,15 @@ static int set_rpa_resolution_func(struct sock *sk, struct hci_dev *hdev,
41394139
val = !!cp->param[0];
41404140

41414141
if (val) {
4142-
changed = !hci_dev_test_flag(hdev, HCI_ENABLE_LL_PRIVACY);
4143-
hci_dev_set_flag(hdev, HCI_ENABLE_LL_PRIVACY);
4142+
changed = !hci_dev_test_and_set_flag(hdev,
4143+
HCI_ENABLE_LL_PRIVACY);
41444144
hci_dev_clear_flag(hdev, HCI_ADVERTISING);
41454145

41464146
/* Enable LL privacy + supported settings changed */
41474147
flags = BIT(0) | BIT(1);
41484148
} else {
4149-
changed = hci_dev_test_flag(hdev, HCI_ENABLE_LL_PRIVACY);
4150-
hci_dev_clear_flag(hdev, HCI_ENABLE_LL_PRIVACY);
4149+
changed = hci_dev_test_and_clear_flag(hdev,
4150+
HCI_ENABLE_LL_PRIVACY);
41514151

41524152
/* Disable LL privacy + supported settings changed */
41534153
flags = BIT(1);

0 commit comments

Comments
 (0)