* [PATCH] Fix unregistering a2dp sep while it is locked
@ 2011-04-13 9:20 Luiz Augusto von Dentz
2011-04-14 17:13 ` Johan Hedberg
0 siblings, 1 reply; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2011-04-13 9:20 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>
If sep is locked it should not be unregistered until properly unlocked.
---
audio/a2dp.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/audio/a2dp.c b/audio/a2dp.c
index 719658b..fe627c1 100644
--- a/audio/a2dp.c
+++ b/audio/a2dp.c
@@ -1741,6 +1741,9 @@ void a2dp_remove_sep(struct a2dp_sep *sep)
}
}
+ if (sep->locked)
+ return;
+
a2dp_unregister_sep(sep);
}
@@ -2342,7 +2345,9 @@ gboolean a2dp_sep_lock(struct a2dp_sep *sep, struct avdtp *session)
gboolean a2dp_sep_unlock(struct a2dp_sep *sep, struct avdtp *session)
{
+ struct a2dp_server *server = sep->server;
avdtp_state_t state;
+ GSList *l;
state = avdtp_sep_get_state(sep->lsep);
@@ -2350,6 +2355,17 @@ gboolean a2dp_sep_unlock(struct a2dp_sep *sep, struct avdtp *session)
DBG("SEP %p unlocked", sep->lsep);
+ if (sep->type == AVDTP_SEP_TYPE_SOURCE)
+ l = server->sources;
+ else
+ l = server->sinks;
+
+ /* Unregister sep if it was removed */
+ if (g_slist_find(l, sep) == NULL) {
+ a2dp_unregister_sep(sep);
+ return TRUE;
+ }
+
if (!sep->stream || state == AVDTP_STATE_IDLE)
return TRUE;
--
1.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-04-14 17:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-13 9:20 [PATCH] Fix unregistering a2dp sep while it is locked Luiz Augusto von Dentz
2011-04-14 17:13 ` Johan Hedberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox