History

Bluetooth: hci_sync: Convert adv_expire

mgmt-test paths: Set Advertising on - Appearance 1 Set Advertising on - Local name 1 Set Advertising on - Name + Appear 1 Set Local Name - Success 2 Set Local Name - Success 3 Add Advertising - Success (Empty ScRsp) Add Advertising - Success (ScRsp appear) Add Advertising - Invalid Params (ScRsp appear long) Add Advertising - Success (Complete name) Add Advertising - Success (Shortened name) Add Advertising - Success (Short name) Add Advertising - Success (Name + data) Add Advertising - Invalid Params (Name + data) Add Advertising - Success (Name+data+appear) Set appearance - BR/EDR LE Set appearance - LE only Add Ext Advertising - Success (Empty ScRsp) Add Ext Advertising - Success (ScRsp appear) Add Ext Advertising - Invalid Params (ScRsp appear long) Add Ext Advertising - Success (Complete name) Add Ext Advertising - Success (Shortened name) Add Ext Advertising - Success (Short name) Add Ext Advertising - Success (Name + data) Add Ext Advertising - Invalid Params (Name + data) Add Ext Advertising - Success (Name+data+appear)

Brian Gix committed 5 years ago

Commit 5e233ed1 parent 26ac4c51 file · +19 −14Browse files

Unified · Split

net/bluetooth/mgmt.c+19−14
@@ -3217,33 +3217,32 @@ static int user_passkey_neg_reply(struct sock *sk, struct hci_dev *hdev, · 3216 unmodified lines
32173217 HCI_OP_USER_PASSKEY_NEG_REPLY, 0);
32183218 }
32193219
3220−static void adv_expire(struct hci_dev *hdev, u32 flags)
3220+static int adv_expire_sync(struct hci_dev *hdev, u32 flags)
32213221 {
32223222 struct adv_info *adv_instance;
3223− struct hci_request req;
3224− int err;
32253223
32263224 adv_instance = hci_find_adv_instance(hdev, hdev->cur_adv_instance);
32273225 if (!adv_instance)
3228− return;
3226+ return 0;
32293227
32303228 /* stop if current instance doesn't need to be changed */
32313229 if (!(adv_instance->flags & flags))
3232− return;
3230+ return 0;
32333231
32343232 cancel_adv_timeout(hdev);
32353233
32363234 adv_instance = hci_get_next_instance(hdev, adv_instance->instance);
32373235 if (!adv_instance)
3238− return;
3236+ return 0;
32393237
3240− hci_req_init(&req, hdev);
3241− err = __hci_req_schedule_adv_instance(&req, adv_instance->instance,
3242− true);
3243− if (err)
3244− return;
3238+ hci_schedule_adv_instance_sync(hdev, adv_instance->instance, true);
32453239
3246− hci_req_run(&req, NULL);
3240+ return 0;
3241+}
3242+
3243+static int name_changed_sync(struct hci_dev *hdev, void *data)
3244+{
3245+ return adv_expire_sync(hdev, MGMT_ADV_FLAG_LOCAL_NAME);
32473246 }
32483247
32493248 static void set_name_complete(struct hci_dev *hdev, void *data, int err)
@@ -3262,7 +3261,7 @@ static void set_name_complete(struct hci_dev *hdev, void *data, int err) · 12 unmodified lines
32623261 cp, sizeof(*cp));
32633262
32643263 if (hci_dev_test_flag(hdev, HCI_LE_ADV))
3265− adv_expire(hdev, MGMT_ADV_FLAG_LOCAL_NAME);
3264+ hci_cmd_sync_queue(hdev, name_changed_sync, NULL, NULL);
32663265 }
32673266
32683267 mgmt_pending_remove(cmd);
@@ -3347,6 +3346,11 @@ failed: · 78 unmodified lines
33473346 return err;
33483347 }
33493348
3349+static int appearance_changed_sync(struct hci_dev *hdev, void *data)
3350+{
3351+ return adv_expire_sync(hdev, MGMT_ADV_FLAG_APPEARANCE);
3352+}
3353+
33503354 static int set_appearance(struct sock *sk, struct hci_dev *hdev, void *data,
33513355 u16 len)
33523356 {
@@ -3368,7 +3372,8 @@ static int set_appearance(struct sock *sk, struct hci_dev *hdev, void *data, · 15 unmodified lines
33683372 hdev->appearance = appearance;
33693373
33703374 if (hci_dev_test_flag(hdev, HCI_LE_ADV))
3371− adv_expire(hdev, MGMT_ADV_FLAG_APPEARANCE);
3375+ hci_cmd_sync_queue(hdev, appearance_changed_sync, NULL,
3376+ NULL);
33723377
33733378 ext_info_changed(hdev, sk);
33743379 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t