All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ v2] shared/uhid: Fix unregistering UHID_START on bt_uhid_unregister_all
@ 2024-08-28 20:29 Luiz Augusto von Dentz
  2024-08-28 22:03 ` [BlueZ,v2] " bluez.test.bot
  2024-08-29 15:50 ` [PATCH BlueZ v2] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2024-08-28 20:29 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

uhid->start_id shall not be unregistered in case of
bt_uhid_unregister_all as that is considerer a internal notification
not under controller of the users.
---
 src/shared/uhid.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/shared/uhid.c b/src/shared/uhid.c
index 98d6198c7d0a..ed21e1399ba7 100644
--- a/src/shared/uhid.c
+++ b/src/shared/uhid.c
@@ -284,12 +284,22 @@ bool bt_uhid_unregister(struct bt_uhid *uhid, unsigned int id)
 	return true;
 }
 
+static bool match_not_id(const void *a, const void *b)
+{
+	const struct uhid_notify *notify = a;
+	unsigned int id = PTR_TO_UINT(b);
+
+	return notify->id != id;
+}
+
 bool bt_uhid_unregister_all(struct bt_uhid *uhid)
 {
 	if (!uhid)
 		return false;
 
-	queue_remove_all(uhid->notify_list, NULL, NULL, free);
+	queue_remove_all(uhid->notify_list, match_not_id,
+				UINT_TO_PTR(uhid->start_id), free);
+
 	return true;
 }
 
-- 
2.46.0


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

end of thread, other threads:[~2024-08-29 15:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-28 20:29 [PATCH BlueZ v2] shared/uhid: Fix unregistering UHID_START on bt_uhid_unregister_all Luiz Augusto von Dentz
2024-08-28 22:03 ` [BlueZ,v2] " bluez.test.bot
2024-08-29 15:50 ` [PATCH BlueZ v2] " patchwork-bot+bluetooth

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.