* [PATCH 0/1 v2] Add release all sessions when adapter is switched off
@ 2011-03-22 11:46 Dmitriy Paliy
2011-03-22 11:46 ` [PATCH] " Dmitriy Paliy
0 siblings, 1 reply; 4+ messages in thread
From: Dmitriy Paliy @ 2011-03-22 11:46 UTC (permalink / raw)
To: linux-bluetooth, johan.hedberg
Hi,
This is updated version to previous submission where more detailed comments
are added explaining why g_slist_free is not called after g_slist_foreach,
and second space is removed.
BR,
Dmitriy
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] Add release all sessions when adapter is switched off
2011-03-22 11:46 [PATCH 0/1 v2] Add release all sessions when adapter is switched off Dmitriy Paliy
@ 2011-03-22 11:46 ` Dmitriy Paliy
0 siblings, 0 replies; 4+ messages in thread
From: Dmitriy Paliy @ 2011-03-22 11:46 UTC (permalink / raw)
To: linux-bluetooth, johan.hedberg; +Cc: Dmitriy Paliy
All sessions should be released when adapter is switched off. Then a new
RequestSession method call always results in change from power off to power
on such ensuring operational mode. Otherwise, it is possible to end up in
adapter state being powered off after RequestSession succeded.
g_slist_free is not called after g_slist_foreach because the list is updated
using g_slist_remove inside of session_free, which is called for each element
by g_slist_foreach.
---
src/adapter.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/adapter.c b/src/adapter.c
index cc4f43e..b0d1773 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2507,6 +2507,10 @@ static void set_mode_complete(struct btd_adapter *adapter)
DBG("");
+ if (adapter->mode == MODE_OFF)
+ g_slist_foreach(adapter->mode_sessions, (GFunc) session_free,
+ NULL);
+
if (adapter->pending_mode == NULL)
return;
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] Add release all sessions when adapter is switched off
@ 2011-03-21 15:39 Dmitriy Paliy
2011-03-22 10:43 ` Johan Hedberg
0 siblings, 1 reply; 4+ messages in thread
From: Dmitriy Paliy @ 2011-03-21 15:39 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Dmitriy Paliy
All sessions should be released when adapter is switched off. Then a new
RequestSession method call always results in change from power off to power
on such ensuring operational mode. Otherwise, it is possible to end up in
adapter state being powered off after RequestSession succeded.
---
src/adapter.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/adapter.c b/src/adapter.c
index cc4f43e..f1c0e2a 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2507,6 +2507,10 @@ static void set_mode_complete(struct btd_adapter *adapter)
DBG("");
+ if (adapter->mode == MODE_OFF)
+ g_slist_foreach(adapter->mode_sessions, (GFunc) session_free,
+ NULL);
+
if (adapter->pending_mode == NULL)
return;
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] Add release all sessions when adapter is switched off
2011-03-21 15:39 Dmitriy Paliy
@ 2011-03-22 10:43 ` Johan Hedberg
0 siblings, 0 replies; 4+ messages in thread
From: Johan Hedberg @ 2011-03-22 10:43 UTC (permalink / raw)
To: Dmitriy Paliy; +Cc: linux-bluetooth
Hi Dmitriy,
On Mon, Mar 21, 2011, Dmitriy Paliy wrote:
> All sessions should be released when adapter is switched off. Then a new
> RequestSession method call always results in change from power off to power
> on such ensuring operational mode. Otherwise, it is possible to end up in
> adapter state being powered off after RequestSession succeded.
> ---
> src/adapter.c | 4 ++++
> 1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/src/adapter.c b/src/adapter.c
> index cc4f43e..f1c0e2a 100644
> --- a/src/adapter.c
> +++ b/src/adapter.c
> @@ -2507,6 +2507,10 @@ static void set_mode_complete(struct btd_adapter *adapter)
>
> DBG("");
>
> + if (adapter->mode == MODE_OFF)
> + g_slist_foreach(adapter->mode_sessions, (GFunc) session_free,
> + NULL);
> +
Don't you have to do g_slist_free() and adapter->mode_sessions = NULL
too? Oh, and you've got two spaces between (GFunc) and session_free :)
Johan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-03-22 11:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-22 11:46 [PATCH 0/1 v2] Add release all sessions when adapter is switched off Dmitriy Paliy
2011-03-22 11:46 ` [PATCH] " Dmitriy Paliy
-- strict thread matches above, loose matches on Subject: below --
2011-03-21 15:39 Dmitriy Paliy
2011-03-22 10:43 ` Johan Hedberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox