Hi Ravi, On Friday 22 of August 2014 12:10:06 Ravi kumar Veeramally wrote: > Shutdown_mdl shutdown io channels and unrefs it. After that related > callbacks will shutdown or close and free its data. Due to timing > issue process_md_delete_mdl_req send delete confirmation response to > peer before properly shutting down all opened data channels. > --- > android/health.c | 25 ++++--------------------- > android/mcap-lib.c | 6 ++---- > 2 files changed, 6 insertions(+), 25 deletions(-) > > diff --git a/android/health.c b/android/health.c > index ee6c11b..f49110a 100644 > --- a/android/health.c > +++ b/android/health.c > @@ -1254,34 +1254,17 @@ static void mcap_mdl_closed_cb(struct mcap_mdl *mdl, void *data) > channel->mdl_conn = false; > } > > -static void notify_channel(void *data, void *user_data) > -{ > - struct health_channel *channel = data; > - > - send_channel_state_notify(channel, HAL_HEALTH_CHANNEL_DESTROYED, -1); > -} > - > static void mcap_mdl_deleted_cb(struct mcap_mdl *mdl, void *data) > { > - struct health_channel *channel = data; > - struct health_device *dev; > - > - if (!channel) > - return; > - > - dev = channel->dev; > + struct health_channel *channel; > > - DBG("device %p channel %p mdl %p", dev, channel, mdl); > info("health: MDL deleted"); > > - /* mdl == NULL means, delete all mdls */ > - if (!mdl) { > - queue_foreach(dev->channels, notify_channel, NULL); > - queue_remove_all(dev->channels, NULL, NULL, > - free_health_channel); > + channel = search_channel_by_mdl(mdl); > + if (!channel) > return; > - } > > + DBG("channel %p mdl %p", channel, mdl); > destroy_channel(channel); > } > > diff --git a/android/mcap-lib.c b/android/mcap-lib.c > index f208fac..1706d9f 100644 > --- a/android/mcap-lib.c > +++ b/android/mcap-lib.c > @@ -1007,10 +1007,10 @@ static void mcap_del_mdl(gpointer elem, gpointer user_data) > struct mcap_mdl *mdl = elem; > gboolean notify = *(gboolean *) user_data; > > - shutdown_mdl(mdl); > if (notify) > mdl->mcl->cb->mdl_deleted(mdl, mdl->mcl->cb->user_data); > > + shutdown_mdl(mdl); > mcap_mdl_unref(mdl); > } > > @@ -1231,13 +1231,11 @@ static void process_md_delete_mdl_req(struct mcap_mcl *mcl, void *cmd, > req = cmd; > mdlid = ntohs(req->mdl); > if (mdlid == MCAP_ALL_MDLIDS) { > - notify = FALSE; > + notify = TRUE; > g_slist_foreach(mcl->mdls, mcap_del_mdl, ¬ify); > g_slist_free(mcl->mdls); > mcl->mdls = NULL; > mcl->state = MCL_CONNECTED; > - /* NULL mdl means ALL_MDLS */ > - mcl->cb->mdl_deleted(NULL, mcl->cb->user_data); > goto resp; > } > > Applied. Thanks. -- Best regards, Szymon Janc -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html