linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ 0/6] bap: Remove interface
@ 2025-03-07 15:44 Iulia Tanasescu
  2025-03-07 15:44 ` [PATCH BlueZ 1/6] shared/bap: Make bap_get_session public Iulia Tanasescu
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Iulia Tanasescu @ 2025-03-07 15:44 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: claudia.rosu, mihai-octavian.urzica, andrei.istodorescu,
	luiz.dentz, Iulia Tanasescu

This patch removes the BAP plugin interface and moves the required
APIs and data structures inside shared/bap, to avoid making calls
between plugins.

Iulia Tanasescu (6):
  shared/bap: Make bap_get_session public
  bap: Remove bap_get_session
  bap: Move default qos to shared/bap
  shared/bap: Add APIs to convert iso_qos to bap_qos
  bap: Remove interface
  bass: Free stream path

 Makefile.plugins      |   2 +-
 profiles/audio/bap.c  | 107 +-----------------------------------------
 profiles/audio/bap.h  |  17 -------
 profiles/audio/bass.c |  16 +++----
 src/shared/bap.c      |  99 ++++++++++++++++++++++++++++++++++++--
 src/shared/bap.h      |   9 ++++
 6 files changed, 115 insertions(+), 135 deletions(-)
 delete mode 100644 profiles/audio/bap.h

-- 
2.43.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH BlueZ 1/6] shared/bap: Make bap_get_session public
  2025-03-07 15:44 [PATCH BlueZ 0/6] bap: Remove interface Iulia Tanasescu
@ 2025-03-07 15:44 ` Iulia Tanasescu
  2025-03-07 17:13   ` bap: Remove interface bluez.test.bot
  2025-03-07 15:44 ` [PATCH BlueZ 2/6] bap: Remove bap_get_session Iulia Tanasescu
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 9+ messages in thread
From: Iulia Tanasescu @ 2025-03-07 15:44 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: claudia.rosu, mihai-octavian.urzica, andrei.istodorescu,
	luiz.dentz, Iulia Tanasescu

This makes bap_get_session public, so that a reference to the bap session
can be obtained and processed from the BASS plugin, for the Broadcast
Assistant implementation.

In case a session is not found, this commit also adds a NULL check for
the new bap that is created, in case the provided db reference is NULL
and therefore a session fails to be added, to avoid any invalid memory
access.
---
 src/shared/bap.c | 9 ++++++---
 src/shared/bap.h | 2 ++
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/shared/bap.c b/src/shared/bap.c
index 4dce32efc..63c4c05c7 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -662,7 +662,7 @@ static void bap_disconnected(int err, void *user_data)
 	bt_bap_detach(bap);
 }
 
-static struct bt_bap *bap_get_session(struct bt_att *att, struct gatt_db *db)
+struct bt_bap *bt_bap_get_session(struct bt_att *att, struct gatt_db *db)
 {
 	const struct queue_entry *entry;
 	struct bt_bap *bap;
@@ -675,6 +675,9 @@ static struct bt_bap *bap_get_session(struct bt_att *att, struct gatt_db *db)
 	}
 
 	bap = bt_bap_new(db, NULL);
+	if (!bap)
+		return NULL;
+
 	bap->att = att;
 
 	bt_bap_attach(bap, NULL);
@@ -845,7 +848,7 @@ static void ascs_ase_read(struct gatt_db_attribute *attrib,
 	struct bt_ascs_ase_status rsp;
 
 	if (ase)
-		bap = bap_get_session(att, ase->ascs->bdb->db);
+		bap = bt_bap_get_session(att, ase->ascs->bdb->db);
 
 	if (bap)
 		ep = bap_get_endpoint(bap->local_eps, bap->ldb, attrib);
@@ -3437,7 +3440,7 @@ static void ascs_ase_cp_write(struct gatt_db_attribute *attrib,
 				void *user_data)
 {
 	struct bt_ascs *ascs = user_data;
-	struct bt_bap *bap = bap_get_session(att, ascs->bdb->db);
+	struct bt_bap *bap = bt_bap_get_session(att, ascs->bdb->db);
 	struct iovec iov = {
 		.iov_base = (void *) value,
 		.iov_len = len,
diff --git a/src/shared/bap.h b/src/shared/bap.h
index 359147b69..198ae50c5 100644
--- a/src/shared/bap.h
+++ b/src/shared/bap.h
@@ -296,3 +296,5 @@ unsigned int bt_bap_bcode_cb_register(struct bt_bap *bap,
 				bt_bap_destroy_func_t destroy);
 
 bool bt_bap_bcode_cb_unregister(struct bt_bap *bap, unsigned int id);
+
+struct bt_bap *bt_bap_get_session(struct bt_att *att, struct gatt_db *db);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH BlueZ 2/6] bap: Remove bap_get_session
  2025-03-07 15:44 [PATCH BlueZ 0/6] bap: Remove interface Iulia Tanasescu
  2025-03-07 15:44 ` [PATCH BlueZ 1/6] shared/bap: Make bap_get_session public Iulia Tanasescu
@ 2025-03-07 15:44 ` Iulia Tanasescu
  2025-03-07 15:44 ` [PATCH BlueZ 3/6] bap: Move default qos to shared/bap Iulia Tanasescu
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Iulia Tanasescu @ 2025-03-07 15:44 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: claudia.rosu, mihai-octavian.urzica, andrei.istodorescu,
	luiz.dentz, Iulia Tanasescu

This removes the bap_get_session API from the BAP plugin interface and
replaces the call inside BASS with the shared/bap API.
---
 profiles/audio/bap.c  | 11 -----------
 profiles/audio/bap.h  |  2 --
 profiles/audio/bass.c |  2 +-
 3 files changed, 1 insertion(+), 14 deletions(-)

diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index 0489f6655..0dc5b4004 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
@@ -2708,17 +2708,6 @@ static bool match_device(const void *data, const void *match_data)
 	return bdata->device == device;
 }
 
-struct bt_bap *bap_get_session(struct btd_device *device)
-{
-	struct bap_data *data;
-
-	data = queue_find(sessions, match_device, device);
-	if (!data)
-		return NULL;
-
-	return data->bap;
-}
-
 static struct bap_data *bap_data_new(struct btd_device *device)
 {
 	struct bap_data *data;
diff --git a/profiles/audio/bap.h b/profiles/audio/bap.h
index 522072340..554670d4a 100644
--- a/profiles/audio/bap.h
+++ b/profiles/audio/bap.h
@@ -9,8 +9,6 @@
 
 extern struct bt_iso_qos bap_sink_pa_qos;
 
-struct bt_bap *bap_get_session(struct btd_device *device);
-
 void bap_iso_qos_to_bap_qos(struct bt_iso_qos *iso_qos,
 				struct bt_bap_qos *bap_qos);
 void bap_qos_to_iso_qos(struct bt_bap_qos *bap_qos,
diff --git a/profiles/audio/bass.c b/profiles/audio/bass.c
index 44320a78a..6f68b80f3 100644
--- a/profiles/audio/bass.c
+++ b/profiles/audio/bass.c
@@ -1113,7 +1113,7 @@ static void bis_probe(uint8_t bis, uint8_t sgrp, struct iovec *caps,
 			/* Only client sessions must be handled */
 			continue;
 
-		bap = bap_get_session(data->device);
+		bap = bt_bap_get_session(bt_bass_get_att(data->bass), NULL);
 		if (!bap)
 			continue;
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH BlueZ 3/6] bap: Move default qos to shared/bap
  2025-03-07 15:44 [PATCH BlueZ 0/6] bap: Remove interface Iulia Tanasescu
  2025-03-07 15:44 ` [PATCH BlueZ 1/6] shared/bap: Make bap_get_session public Iulia Tanasescu
  2025-03-07 15:44 ` [PATCH BlueZ 2/6] bap: Remove bap_get_session Iulia Tanasescu
@ 2025-03-07 15:44 ` Iulia Tanasescu
  2025-03-07 15:44 ` [PATCH BlueZ 4/6] shared/bap: Add APIs to convert iso_qos to bap_qos Iulia Tanasescu
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Iulia Tanasescu @ 2025-03-07 15:44 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: claudia.rosu, mihai-octavian.urzica, andrei.istodorescu,
	luiz.dentz, Iulia Tanasescu

This moves the default BAP QoS structure to shared/bap, to be accessible
from other plugins without involving the BAP plugin.
---
 profiles/audio/bap.c | 39 ---------------------------------------
 profiles/audio/bap.h |  2 --
 src/shared/bap.c     | 39 +++++++++++++++++++++++++++++++++++++++
 src/shared/bap.h     |  2 ++
 4 files changed, 41 insertions(+), 41 deletions(-)

diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index 0dc5b4004..1889e1a1e 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
@@ -115,45 +115,6 @@ struct bap_data {
 
 static struct queue *sessions;
 
-/* Structure holding the parameters for Periodic Advertisement create sync.
- * The full QOS is populated at the time the user selects and endpoint and
- * configures it using SetConfiguration.
- */
-struct bt_iso_qos bap_sink_pa_qos = {
-	.bcast = {
-		.options		= 0x00,
-		.skip			= 0x0000,
-		.sync_timeout		= BT_ISO_SYNC_TIMEOUT,
-		.sync_cte_type	= 0x00,
-		/* TODO: The following parameters are not needed for PA Sync.
-		 * They will be removed when the kernel checks will be removed.
-		 */
-		.big			= BT_ISO_QOS_BIG_UNSET,
-		.bis			= BT_ISO_QOS_BIS_UNSET,
-		.encryption		= 0x00,
-		.bcode			= {0x00},
-		.mse			= 0x00,
-		.timeout		= BT_ISO_SYNC_TIMEOUT,
-		.sync_factor		= 0x07,
-		.packing		= 0x00,
-		.framing		= 0x00,
-		.in = {
-			.interval	= 10000,
-			.latency	= 10,
-			.sdu		= 40,
-			.phy		= 0x02,
-			.rtn		= 2,
-		},
-		.out = {
-			.interval	= 10000,
-			.latency	= 10,
-			.sdu		= 40,
-			.phy		= 0x02,
-			.rtn		= 2,
-		}
-	}
-};
-
 static bool bap_data_set_user_data(struct bap_data *data, void *user_data)
 {
 	if (!data)
diff --git a/profiles/audio/bap.h b/profiles/audio/bap.h
index 554670d4a..2bf93dd93 100644
--- a/profiles/audio/bap.h
+++ b/profiles/audio/bap.h
@@ -7,8 +7,6 @@
  *
  */
 
-extern struct bt_iso_qos bap_sink_pa_qos;
-
 void bap_iso_qos_to_bap_qos(struct bt_iso_qos *iso_qos,
 				struct bt_bap_qos *bap_qos);
 void bap_qos_to_iso_qos(struct bt_bap_qos *bap_qos,
diff --git a/src/shared/bap.c b/src/shared/bap.c
index 63c4c05c7..ce579e171 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -349,6 +349,45 @@ static struct queue *bap_db;
 static struct queue *bap_cbs;
 static struct queue *sessions;
 
+/* Structure holding the parameters for Periodic Advertisement create sync.
+ * The full QOS is populated at the time the user selects and endpoint and
+ * configures it using SetConfiguration.
+ */
+struct bt_iso_qos bap_sink_pa_qos = {
+	.bcast = {
+		.options		= 0x00,
+		.skip			= 0x0000,
+		.sync_timeout		= BT_ISO_SYNC_TIMEOUT,
+		.sync_cte_type	= 0x00,
+		/* TODO: The following parameters are not needed for PA Sync.
+		 * They will be removed when the kernel checks will be removed.
+		 */
+		.big			= BT_ISO_QOS_BIG_UNSET,
+		.bis			= BT_ISO_QOS_BIS_UNSET,
+		.encryption		= 0x00,
+		.bcode			= {0x00},
+		.mse			= 0x00,
+		.timeout		= BT_ISO_SYNC_TIMEOUT,
+		.sync_factor		= 0x07,
+		.packing		= 0x00,
+		.framing		= 0x00,
+		.in = {
+			.interval	= 10000,
+			.latency	= 10,
+			.sdu		= 40,
+			.phy		= 0x02,
+			.rtn		= 2,
+		},
+		.out = {
+			.interval	= 10000,
+			.latency	= 10,
+			.sdu		= 40,
+			.phy		= 0x02,
+			.rtn		= 2,
+		}
+	}
+};
+
 static void bap_stream_set_io(void *data, void *user_data);
 static void stream_find_io(void *data, void *user_data);
 static void bap_stream_get_dir(void *data, void *user_data);
diff --git a/src/shared/bap.h b/src/shared/bap.h
index 198ae50c5..248871b12 100644
--- a/src/shared/bap.h
+++ b/src/shared/bap.h
@@ -50,6 +50,8 @@ typedef void (*bt_bap_bcode_func_t)(struct bt_bap_stream *stream,
 				bt_bap_bcode_reply_t reply, void *reply_data,
 				void *user_data);
 
+extern struct bt_iso_qos bap_sink_pa_qos;
+
 /* Local PAC related functions */
 struct bt_bap_pac_qos {
 	uint8_t  framing;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH BlueZ 4/6] shared/bap: Add APIs to convert iso_qos to bap_qos
  2025-03-07 15:44 [PATCH BlueZ 0/6] bap: Remove interface Iulia Tanasescu
                   ` (2 preceding siblings ...)
  2025-03-07 15:44 ` [PATCH BlueZ 3/6] bap: Move default qos to shared/bap Iulia Tanasescu
@ 2025-03-07 15:44 ` Iulia Tanasescu
  2025-03-07 15:44 ` [PATCH BlueZ 5/6] bap: Remove interface Iulia Tanasescu
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Iulia Tanasescu @ 2025-03-07 15:44 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: claudia.rosu, mihai-octavian.urzica, andrei.istodorescu,
	luiz.dentz, Iulia Tanasescu

This adds APIs to convert iso_qos to bap_qos and reversed.
---
 src/shared/bap.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++
 src/shared/bap.h |  5 +++++
 2 files changed, 56 insertions(+)

diff --git a/src/shared/bap.c b/src/shared/bap.c
index ce579e171..1cf0fcfb9 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -7505,3 +7505,54 @@ bool bt_bap_bcode_cb_unregister(struct bt_bap *bap, unsigned int id)
 
 	return false;
 }
+
+void bt_bap_iso_qos_to_bap_qos(struct bt_iso_qos *iso_qos,
+				struct bt_bap_qos *bap_qos)
+{
+	bap_qos->bcast.big = iso_qos->bcast.big;
+	bap_qos->bcast.bis = iso_qos->bcast.bis;
+	bap_qos->bcast.sync_factor = iso_qos->bcast.sync_factor;
+	bap_qos->bcast.packing = iso_qos->bcast.packing;
+	bap_qos->bcast.framing = iso_qos->bcast.framing;
+	bap_qos->bcast.encryption = iso_qos->bcast.encryption;
+	if (bap_qos->bcast.encryption)
+		bap_qos->bcast.bcode = util_iov_new(iso_qos->bcast.bcode,
+						sizeof(iso_qos->bcast.bcode));
+	bap_qos->bcast.options = iso_qos->bcast.options;
+	bap_qos->bcast.skip = iso_qos->bcast.skip;
+	bap_qos->bcast.sync_timeout = iso_qos->bcast.sync_timeout;
+	bap_qos->bcast.sync_cte_type =
+			iso_qos->bcast.sync_cte_type;
+	bap_qos->bcast.mse = iso_qos->bcast.mse;
+	bap_qos->bcast.timeout = iso_qos->bcast.timeout;
+	bap_qos->bcast.io_qos.interval =
+			iso_qos->bcast.in.interval;
+	bap_qos->bcast.io_qos.latency = iso_qos->bcast.in.latency;
+	bap_qos->bcast.io_qos.phy = iso_qos->bcast.in.phy;
+	bap_qos->bcast.io_qos.rtn = iso_qos->bcast.in.rtn;
+	bap_qos->bcast.io_qos.sdu = iso_qos->bcast.in.sdu;
+}
+
+void bt_bap_qos_to_iso_qos(struct bt_bap_qos *bap_qos,
+				struct bt_iso_qos *iso_qos)
+{
+	memset(iso_qos, 0, sizeof(*iso_qos));
+
+	iso_qos->bcast.big = bap_qos->bcast.big;
+	iso_qos->bcast.bis = bap_qos->bcast.bis;
+	iso_qos->bcast.sync_factor = bap_qos->bcast.sync_factor;
+	iso_qos->bcast.packing = bap_qos->bcast.packing;
+	iso_qos->bcast.framing = bap_qos->bcast.framing;
+	iso_qos->bcast.encryption = bap_qos->bcast.encryption;
+	if (bap_qos->bcast.bcode && bap_qos->bcast.bcode->iov_base)
+		memcpy(iso_qos->bcast.bcode, bap_qos->bcast.bcode->iov_base,
+				bap_qos->bcast.bcode->iov_len);
+	iso_qos->bcast.options = bap_qos->bcast.options;
+	iso_qos->bcast.skip = bap_qos->bcast.skip;
+	iso_qos->bcast.sync_timeout = bap_qos->bcast.sync_timeout;
+	iso_qos->bcast.sync_cte_type = bap_qos->bcast.sync_cte_type;
+	iso_qos->bcast.mse = bap_qos->bcast.mse;
+	iso_qos->bcast.timeout = bap_qos->bcast.timeout;
+	memcpy(&iso_qos->bcast.out, &bap_qos->bcast.io_qos,
+			sizeof(struct bt_iso_io_qos));
+}
diff --git a/src/shared/bap.h b/src/shared/bap.h
index 248871b12..dfd169980 100644
--- a/src/shared/bap.h
+++ b/src/shared/bap.h
@@ -300,3 +300,8 @@ unsigned int bt_bap_bcode_cb_register(struct bt_bap *bap,
 bool bt_bap_bcode_cb_unregister(struct bt_bap *bap, unsigned int id);
 
 struct bt_bap *bt_bap_get_session(struct bt_att *att, struct gatt_db *db);
+
+void bt_bap_iso_qos_to_bap_qos(struct bt_iso_qos *iso_qos,
+				struct bt_bap_qos *bap_qos);
+void bt_bap_qos_to_iso_qos(struct bt_bap_qos *bap_qos,
+				struct bt_iso_qos *iso_qos);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH BlueZ 5/6] bap: Remove interface
  2025-03-07 15:44 [PATCH BlueZ 0/6] bap: Remove interface Iulia Tanasescu
                   ` (3 preceding siblings ...)
  2025-03-07 15:44 ` [PATCH BlueZ 4/6] shared/bap: Add APIs to convert iso_qos to bap_qos Iulia Tanasescu
@ 2025-03-07 15:44 ` Iulia Tanasescu
  2025-03-07 15:44 ` [PATCH BlueZ 6/6] bass: Free stream path Iulia Tanasescu
  2025-03-11 15:50 ` [PATCH BlueZ 0/6] bap: Remove interface patchwork-bot+bluetooth
  6 siblings, 0 replies; 9+ messages in thread
From: Iulia Tanasescu @ 2025-03-07 15:44 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: claudia.rosu, mihai-octavian.urzica, andrei.istodorescu,
	luiz.dentz, Iulia Tanasescu

This removes the BAP plugin interface and updates the BAP and
BASS plugins to use shared/bap APIs.
---
 Makefile.plugins      |  2 +-
 profiles/audio/bap.c  | 57 ++-----------------------------------------
 profiles/audio/bap.h  | 13 ----------
 profiles/audio/bass.c |  6 ++---
 4 files changed, 5 insertions(+), 73 deletions(-)
 delete mode 100644 profiles/audio/bap.h

diff --git a/Makefile.plugins b/Makefile.plugins
index 43e665432..bae4363d0 100644
--- a/Makefile.plugins
+++ b/Makefile.plugins
@@ -113,7 +113,7 @@ endif
 
 if BAP
 builtin_modules += bap
-builtin_sources += profiles/audio/bap.h profiles/audio/bap.c
+builtin_sources += profiles/audio/bap.c
 endif
 
 if BASS
diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index 1889e1a1e..a37e62f76 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
@@ -56,8 +56,6 @@
 #include "src/log.h"
 #include "src/error.h"
 
-#include "bap.h"
-
 #define ISO_SOCKET_UUID "6fbaf188-05e0-496a-9885-d6ddfdb4e03e"
 #define PACS_UUID_STR "00001850-0000-1000-8000-00805f9b34fb"
 #define BCAAS_UUID_STR "00001852-0000-1000-8000-00805f9b34fb"
@@ -1053,57 +1051,6 @@ static void iso_bcast_confirm_cb(GIOChannel *io, GError *err, void *user_data)
 	}
 }
 
-void bap_qos_to_iso_qos(struct bt_bap_qos *bap_qos,
-				struct bt_iso_qos *iso_qos)
-{
-	memset(iso_qos, 0, sizeof(*iso_qos));
-
-	iso_qos->bcast.big = bap_qos->bcast.big;
-	iso_qos->bcast.bis = bap_qos->bcast.bis;
-	iso_qos->bcast.sync_factor = bap_qos->bcast.sync_factor;
-	iso_qos->bcast.packing = bap_qos->bcast.packing;
-	iso_qos->bcast.framing = bap_qos->bcast.framing;
-	iso_qos->bcast.encryption = bap_qos->bcast.encryption;
-	if (bap_qos->bcast.bcode && bap_qos->bcast.bcode->iov_base)
-		memcpy(iso_qos->bcast.bcode, bap_qos->bcast.bcode->iov_base,
-				bap_qos->bcast.bcode->iov_len);
-	iso_qos->bcast.options = bap_qos->bcast.options;
-	iso_qos->bcast.skip = bap_qos->bcast.skip;
-	iso_qos->bcast.sync_timeout = bap_qos->bcast.sync_timeout;
-	iso_qos->bcast.sync_cte_type = bap_qos->bcast.sync_cte_type;
-	iso_qos->bcast.mse = bap_qos->bcast.mse;
-	iso_qos->bcast.timeout = bap_qos->bcast.timeout;
-	memcpy(&iso_qos->bcast.out, &bap_qos->bcast.io_qos,
-			sizeof(struct bt_iso_io_qos));
-}
-
-void bap_iso_qos_to_bap_qos(struct bt_iso_qos *iso_qos,
-				struct bt_bap_qos *bap_qos)
-{
-	bap_qos->bcast.big = iso_qos->bcast.big;
-	bap_qos->bcast.bis = iso_qos->bcast.bis;
-	bap_qos->bcast.sync_factor = iso_qos->bcast.sync_factor;
-	bap_qos->bcast.packing = iso_qos->bcast.packing;
-	bap_qos->bcast.framing = iso_qos->bcast.framing;
-	bap_qos->bcast.encryption = iso_qos->bcast.encryption;
-	if (bap_qos->bcast.encryption)
-		bap_qos->bcast.bcode = util_iov_new(iso_qos->bcast.bcode,
-						sizeof(iso_qos->bcast.bcode));
-	bap_qos->bcast.options = iso_qos->bcast.options;
-	bap_qos->bcast.skip = iso_qos->bcast.skip;
-	bap_qos->bcast.sync_timeout = iso_qos->bcast.sync_timeout;
-	bap_qos->bcast.sync_cte_type =
-			iso_qos->bcast.sync_cte_type;
-	bap_qos->bcast.mse = iso_qos->bcast.mse;
-	bap_qos->bcast.timeout = iso_qos->bcast.timeout;
-	bap_qos->bcast.io_qos.interval =
-			iso_qos->bcast.in.interval;
-	bap_qos->bcast.io_qos.latency = iso_qos->bcast.in.latency;
-	bap_qos->bcast.io_qos.phy = iso_qos->bcast.in.phy;
-	bap_qos->bcast.io_qos.rtn = iso_qos->bcast.in.rtn;
-	bap_qos->bcast.io_qos.sdu = iso_qos->bcast.in.sdu;
-}
-
 static void create_stream_for_bis(struct bap_data *bap_data,
 		struct bt_bap_pac *lpac, struct bt_bap_qos *qos,
 		struct iovec *caps, struct iovec *meta, char *path)
@@ -1197,7 +1144,7 @@ static gboolean big_info_report_cb(GIOChannel *io, GIOCondition cond,
 	iov.iov_len = base.base_len;
 
 	/* Create BAP QoS structure */
-	bap_iso_qos_to_bap_qos(&qos, &bap_qos);
+	bt_bap_iso_qos_to_bap_qos(&qos, &bap_qos);
 
 	bt_bap_parse_base(&iov, &bap_qos, bap_debug, bis_handler, data);
 
@@ -2962,7 +2909,7 @@ static void iso_do_big_sync(GIOChannel *io, void *user_data)
 	queue_foreach(links, setup_refresh_qos, data);
 
 	/* Set the user requested QOS */
-	bap_qos_to_iso_qos(&setup->qos, &qos);
+	bt_bap_qos_to_iso_qos(&setup->qos, &qos);
 
 	if (!bt_io_set(io, &err,
 			BT_IO_OPT_QOS, &qos,
diff --git a/profiles/audio/bap.h b/profiles/audio/bap.h
deleted file mode 100644
index 2bf93dd93..000000000
--- a/profiles/audio/bap.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- *
- *  BlueZ - Bluetooth protocol stack for Linux
- *
- *  Copyright 2024 NXP
- *
- */
-
-void bap_iso_qos_to_bap_qos(struct bt_iso_qos *iso_qos,
-				struct bt_bap_qos *bap_qos);
-void bap_qos_to_iso_qos(struct bt_bap_qos *bap_qos,
-				struct bt_iso_qos *iso_qos);
diff --git a/profiles/audio/bass.c b/profiles/audio/bass.c
index 6f68b80f3..d987987ff 100644
--- a/profiles/audio/bass.c
+++ b/profiles/audio/bass.c
@@ -52,8 +52,6 @@
 #include "src/log.h"
 #include "src/error.h"
 
-#include "bap.h"
-
 #define BASS_UUID_STR "0000184f-0000-1000-8000-00805f9b34fb"
 #define BCAAS_UUID_STR "00001852-0000-1000-8000-00805f9b34fb"
 
@@ -370,7 +368,7 @@ static void bap_state_changed(struct bt_bap_stream *stream, uint8_t old_state,
 
 		queue_foreach(links, append_stream, &iso_bc_addr);
 
-		bap_qos_to_iso_qos(bap_qos, &qos);
+		bt_bap_qos_to_iso_qos(bap_qos, &qos);
 
 		if (!bt_io_set(dg->io, &gerr,
 				BT_IO_OPT_QOS, &qos,
@@ -532,7 +530,7 @@ static gboolean big_info_cb(GIOChannel *io, GIOCondition cond,
 	iov.iov_len = base.base_len;
 
 	/* Create BAP QoS structure */
-	bap_iso_qos_to_bap_qos(&qos, &bap_qos);
+	bt_bap_iso_qos_to_bap_qos(&qos, &bap_qos);
 
 	bt_bap_parse_base(&iov, &bap_qos, bass_debug, bis_handler, dg);
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH BlueZ 6/6] bass: Free stream path
  2025-03-07 15:44 [PATCH BlueZ 0/6] bap: Remove interface Iulia Tanasescu
                   ` (4 preceding siblings ...)
  2025-03-07 15:44 ` [PATCH BlueZ 5/6] bap: Remove interface Iulia Tanasescu
@ 2025-03-07 15:44 ` Iulia Tanasescu
  2025-03-11 15:50 ` [PATCH BlueZ 0/6] bap: Remove interface patchwork-bot+bluetooth
  6 siblings, 0 replies; 9+ messages in thread
From: Iulia Tanasescu @ 2025-03-07 15:44 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: claudia.rosu, mihai-octavian.urzica, andrei.istodorescu,
	luiz.dentz, Iulia Tanasescu

This frees BASS setup paths, to avoid memory leaks like below:

==5877==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 43 byte(s) in 1 object(s) allocated from:
    0x7ab1adefd9c7 in malloc ../../../../src/libsanitizer/asan/
                                        asan_malloc_linux.cpp:69
    0x7ab1ad08f937 in __vasprintf_internal libio/vasprintf.c:116
    0x7ab1ad135d62 in ___asprintf_chk debug/asprintf_chk.c:34
    0x5c2197401338 in asprintf /usr/include/x86_64-linux-gnu/bits/
                                                      stdio2.h:137
    0x5c2197401338 in setup_configure_stream profiles/audio/bass.c:420
---
 profiles/audio/bass.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/profiles/audio/bass.c b/profiles/audio/bass.c
index d987987ff..d299791c8 100644
--- a/profiles/audio/bass.c
+++ b/profiles/audio/bass.c
@@ -116,6 +116,7 @@ struct bass_delegator {
 
 struct bass_setup {
 	struct bass_delegator *dg;
+	char *path;
 	struct bt_bap_stream *stream;
 	uint8_t bis;
 	struct bt_bap_qos qos;
@@ -411,19 +412,17 @@ static void bap_state_changed(struct bt_bap_stream *stream, uint8_t old_state,
 
 static void setup_configure_stream(struct bass_setup *setup)
 {
-	char *path;
-
 	setup->stream = bt_bap_stream_new(setup->dg->bap, setup->lpac, NULL,
 					&setup->qos, setup->config);
 	if (!setup->stream)
 		return;
 
-	if (asprintf(&path, "%s/bis%d",
+	if (asprintf(&setup->path, "%s/bis%d",
 			device_get_path(setup->dg->device),
 			setup->bis) < 0)
 		return;
 
-	bt_bap_stream_set_user_data(setup->stream, path);
+	bt_bap_stream_set_user_data(setup->stream, setup->path);
 
 	bt_bap_stream_config(setup->stream, &setup->qos,
 			setup->config, NULL, NULL);
@@ -649,6 +648,7 @@ static void setup_free(void *data)
 	util_iov_free(setup->qos.bcast.bcode, 1);
 	util_iov_free(setup->meta, 1);
 	util_iov_free(setup->config, 1);
+	free(setup->path);
 
 	/* Clear bis index from the bis sync bitmask, if it
 	 * has been previously set.
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* RE: bap: Remove interface
  2025-03-07 15:44 ` [PATCH BlueZ 1/6] shared/bap: Make bap_get_session public Iulia Tanasescu
@ 2025-03-07 17:13   ` bluez.test.bot
  0 siblings, 0 replies; 9+ messages in thread
From: bluez.test.bot @ 2025-03-07 17:13 UTC (permalink / raw)
  To: linux-bluetooth, iulia.tanasescu

[-- Attachment #1: Type: text/plain, Size: 2865 bytes --]

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=941567

---Test result---

Test Summary:
CheckPatch                    PENDING   0.20 seconds
GitLint                       PENDING   0.19 seconds
BuildEll                      PASS      20.40 seconds
BluezMake                     PASS      1495.76 seconds
MakeCheck                     PASS      13.39 seconds
MakeDistcheck                 PASS      158.10 seconds
CheckValgrind                 PASS      214.09 seconds
CheckSmatch                   WARNING   284.59 seconds
bluezmakeextell               PASS      98.07 seconds
IncrementalBuild              PENDING   0.28 seconds
ScanBuild                     PASS      864.70 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
src/shared/bap.c:313:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:313:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:313:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:313:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:313:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:313:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:313:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:313:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:313:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structures
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH BlueZ 0/6] bap: Remove interface
  2025-03-07 15:44 [PATCH BlueZ 0/6] bap: Remove interface Iulia Tanasescu
                   ` (5 preceding siblings ...)
  2025-03-07 15:44 ` [PATCH BlueZ 6/6] bass: Free stream path Iulia Tanasescu
@ 2025-03-11 15:50 ` patchwork-bot+bluetooth
  6 siblings, 0 replies; 9+ messages in thread
From: patchwork-bot+bluetooth @ 2025-03-11 15:50 UTC (permalink / raw)
  To: Iulia Tanasescu
  Cc: linux-bluetooth, claudia.rosu, mihai-octavian.urzica,
	andrei.istodorescu, luiz.dentz

Hello:

This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Fri,  7 Mar 2025 17:44:51 +0200 you wrote:
> This patch removes the BAP plugin interface and moves the required
> APIs and data structures inside shared/bap, to avoid making calls
> between plugins.
> 
> Iulia Tanasescu (6):
>   shared/bap: Make bap_get_session public
>   bap: Remove bap_get_session
>   bap: Move default qos to shared/bap
>   shared/bap: Add APIs to convert iso_qos to bap_qos
>   bap: Remove interface
>   bass: Free stream path
> 
> [...]

Here is the summary with links:
  - [BlueZ,1/6] shared/bap: Make bap_get_session public
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=8f280aadbbae
  - [BlueZ,2/6] bap: Remove bap_get_session
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=fd622a5bb2e3
  - [BlueZ,3/6] bap: Move default qos to shared/bap
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=5204f17cb9d3
  - [BlueZ,4/6] shared/bap: Add APIs to convert iso_qos to bap_qos
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=6a03579d170e
  - [BlueZ,5/6] bap: Remove interface
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=8850bad1e027
  - [BlueZ,6/6] bass: Free stream path
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=debc77530f24

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-03-11 15:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-07 15:44 [PATCH BlueZ 0/6] bap: Remove interface Iulia Tanasescu
2025-03-07 15:44 ` [PATCH BlueZ 1/6] shared/bap: Make bap_get_session public Iulia Tanasescu
2025-03-07 17:13   ` bap: Remove interface bluez.test.bot
2025-03-07 15:44 ` [PATCH BlueZ 2/6] bap: Remove bap_get_session Iulia Tanasescu
2025-03-07 15:44 ` [PATCH BlueZ 3/6] bap: Move default qos to shared/bap Iulia Tanasescu
2025-03-07 15:44 ` [PATCH BlueZ 4/6] shared/bap: Add APIs to convert iso_qos to bap_qos Iulia Tanasescu
2025-03-07 15:44 ` [PATCH BlueZ 5/6] bap: Remove interface Iulia Tanasescu
2025-03-07 15:44 ` [PATCH BlueZ 6/6] bass: Free stream path Iulia Tanasescu
2025-03-11 15:50 ` [PATCH BlueZ 0/6] bap: Remove interface patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).