By moving the bap_data initialization for a scanned device to
bap_adapter_probe() the adapter field of bap_data will already be set when
short_lived_pa_sync is called. When adapter will be changed for
bap_adapter, this will help eliminate an additional queue search (in
short_lived_pa_sync).
---
profiles/audio/bap.c | 62 ++++++++++++++++++++++----------------------
1 file changed, 31 insertions(+), 31 deletions(-)
diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index ff6d6d881..9e93906ca 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
@@ -2768,43 +2768,13 @@ static void bap_detached(struct bt_bap *bap, void *user_data)
static int short_lived_pa_sync(struct bap_bcast_pa_req *req)
{
struct btd_service *service = req->data.service;
- struct btd_device *device = btd_service_get_device(service);
- struct btd_adapter *adapter = device_get_adapter(device);
- struct btd_gatt_database *database = btd_adapter_get_database(adapter);
struct bap_data *data = btd_service_get_user_data(service);
GError *err = NULL;
- if (data) {
+ if (data->listen_io) {
DBG("Already probed");
return -1;
}
- data = bap_data_new(device);
- data->service = service;
- data->adapter = adapter;
- data->device = device;
- data->bap = bt_bap_new(btd_gatt_database_get_db(database),
- btd_gatt_database_get_db(database));
- if (!data->bap) {
- error("Unable to create BAP instance");
- free(data);
- return -EINVAL;
- }
-
- if (!bt_bap_attach(data->bap, NULL)) {
- error("BAP unable to attach");
- return -EINVAL;
- }
-
- bap_data_add(data);
-
- data->ready_id = bt_bap_ready_register(data->bap, bap_ready, service,
- NULL);
- data->state_id = bt_bap_state_register(data->bap, bap_state_bcast,
- bap_connecting_bcast, data, NULL);
- data->pac_id = bt_bap_pac_register(data->bap, pac_added_broadcast,
- pac_removed_broadcast, data, NULL);
-
- bt_bap_set_user_data(data->bap, service);
DBG("Create PA sync with this source");
req->in_progress = TRUE;
@@ -2925,14 +2895,44 @@ static int bap_bcast_probe(struct btd_service *service)
{
struct btd_device *device = btd_service_get_device(service);
struct btd_adapter *adapter = device_get_adapter(device);
+ struct btd_gatt_database *database = btd_adapter_get_database(adapter);
struct bap_bcast_pa_req *pa_req =
new0(struct bap_bcast_pa_req, 1);
+ struct bap_data *data;
if (!btd_adapter_has_exp_feature(adapter, EXP_FEAT_ISO_SOCKET)) {
error("BAP requires ISO Socket which is not enabled");
return -ENOTSUP;
}
+ data = bap_data_new(device);
+ data->service = service;
+ data->adapter = adapter;
+ data->device = device;
+ data->bap = bt_bap_new(btd_gatt_database_get_db(database),
+ btd_gatt_database_get_db(database));
+ if (!data->bap) {
+ error("Unable to create BAP instance");
+ free(data);
+ return -EINVAL;
+ }
+
+ if (!bt_bap_attach(data->bap, NULL)) {
+ error("BAP unable to attach");
+ return -EINVAL;
+ }
+
+ bap_data_add(data);
+
+ data->ready_id = bt_bap_ready_register(data->bap, bap_ready, service,
+ NULL);
+ data->state_id = bt_bap_state_register(data->bap, bap_state_bcast,
+ bap_connecting_bcast, data, NULL);
+ data->pac_id = bt_bap_pac_register(data->bap, pac_added_broadcast,
+ pac_removed_broadcast, data, NULL);
+
+ bt_bap_set_user_data(data->bap, service);
+
/* First time initialize the queue and start the idle timer */
if (bcast_pa_requests == NULL) {
bcast_pa_requests = queue_new();
--
2.40.1
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=847482
---Test result---
Test Summary:
CheckPatch PASS 5.65 seconds
GitLint PASS 1.27 seconds
BuildEll PASS 24.27 seconds
BluezMake PASS 1678.41 seconds
MakeCheck PASS 13.02 seconds
MakeDistcheck PASS 176.27 seconds
CheckValgrind PASS 244.95 seconds
CheckSmatch PASS 348.74 seconds
bluezmakeextell PASS 119.73 seconds
IncrementalBuild PASS 6256.02 seconds
ScanBuild PASS 985.83 seconds
---
Regards,
Linux Bluetooth