All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ v2 1/2] shared/bap: add bt_bap_cancel_select to cancel ongoing pac select
@ 2024-03-23  9:40 Pauli Virtanen
  2024-03-23  9:40 ` [PATCH BlueZ v2 2/2] bap: cancel ongoing SelectProperties() before freeing the ep Pauli Virtanen
  2024-03-23 12:04 ` [BlueZ,v2,1/2] shared/bap: add bt_bap_cancel_select to cancel ongoing pac select bluez.test.bot
  0 siblings, 2 replies; 4+ messages in thread
From: Pauli Virtanen @ 2024-03-23  9:40 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Pauli Virtanen

Add function and PAC ops for canceling a previously initiated
SelectProperties() call.
---

Notes:
    v2: cancel the DBus request and callback, instead of ignoring stale cbs

 src/shared/bap.c | 12 ++++++++++++
 src/shared/bap.h |  5 +++++
 2 files changed, 17 insertions(+)

diff --git a/src/shared/bap.c b/src/shared/bap.c
index a1749153b..f553096df 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -5180,6 +5180,18 @@ int bt_bap_select(struct bt_bap_pac *lpac, struct bt_bap_pac *rpac,
 	return 0;
 }
 
+void bt_bap_cancel_select(struct bt_bap_pac *lpac, bt_bap_pac_select_t func,
+								void *user_data)
+{
+	if (!lpac || !func)
+		return;
+
+	if (!lpac->ops || !lpac->ops->cancel_select)
+		return;
+
+	lpac->ops->cancel_select(lpac, func, user_data, lpac->user_data);
+}
+
 static struct bt_bap_stream *bap_bcast_stream_new(struct bt_bap *bap,
 					struct bt_bap_pac *lpac,
 					struct bt_bap_pac *rpac,
diff --git a/src/shared/bap.h b/src/shared/bap.h
index 9839e3249..62e210485 100644
--- a/src/shared/bap.h
+++ b/src/shared/bap.h
@@ -72,6 +72,8 @@ struct bt_bap_pac_ops {
 	int (*select)(struct bt_bap_pac *lpac, struct bt_bap_pac *rpac,
 			uint32_t chan_alloc, struct bt_bap_pac_qos *qos,
 			bt_bap_pac_select_t cb, void *cb_data, void *user_data);
+	void (*cancel_select)(struct bt_bap_pac *lpac,
+			bt_bap_pac_select_t cb, void *cb_data, void *user_data);
 	int (*config)(struct bt_bap_stream *stream, struct iovec *cfg,
 			struct bt_bap_qos *qos, bt_bap_pac_config_t cb,
 			void *user_data);
@@ -160,6 +162,9 @@ int bt_bap_select(struct bt_bap_pac *lpac, struct bt_bap_pac *rpac,
 			int *count, bt_bap_pac_select_t func,
 			void *user_data);
 
+void bt_bap_cancel_select(struct bt_bap_pac *lpac, bt_bap_pac_select_t func,
+			void *user_data);
+
 struct bt_bap_stream *bt_bap_stream_new(struct bt_bap *bap,
 					struct bt_bap_pac *lpac,
 					struct bt_bap_pac *rpac,
-- 
2.44.0


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

end of thread, other threads:[~2024-03-25 17:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-23  9:40 [PATCH BlueZ v2 1/2] shared/bap: add bt_bap_cancel_select to cancel ongoing pac select Pauli Virtanen
2024-03-23  9:40 ` [PATCH BlueZ v2 2/2] bap: cancel ongoing SelectProperties() before freeing the ep Pauli Virtanen
2024-03-25 17:29   ` Luiz Augusto von Dentz
2024-03-23 12:04 ` [BlueZ,v2,1/2] shared/bap: add bt_bap_cancel_select to cancel ongoing pac select bluez.test.bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.