From 9763e34fbcc85ea0e98ab838d89dffdbbc40fe80 Mon Sep 17 00:00:00 2001 From: Dhoat Harpal Date: Mon, 18 Apr 2016 21:01:02 +0530 Subject: soc: qcom: glink: Fix channel migration on fully open channel If process_open_event is delayed and glink has migrated to new transport, process open event will be treated as a new open event and migration will happen on fully open channel. If channel is fully, open migration will not be allowed as client might already be using the channel for communication. Change-Id: I6c1760bc19f52e7d0c1c9834a72e2304f0ae28c8 Signed-off-by: Dhoat Harpal --- drivers/soc/qcom/glink.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/soc/qcom/glink.c b/drivers/soc/qcom/glink.c index 8c3940b631f3..904953877443 100644 --- a/drivers/soc/qcom/glink.c +++ b/drivers/soc/qcom/glink.c @@ -4305,6 +4305,10 @@ static bool will_migrate(struct channel_ctx *l_ctx, struct channel_ctx *r_ctx) if (l_ctx->local_xprt_req > r_ctx->transport_ptr->id) l_ctx->local_xprt_req = r_ctx->transport_ptr->id; + if (ch_is_fully_opened(l_ctx) && + (l_ctx->transport_ptr->id == l_ctx->local_xprt_req)) + goto exit; + new_xprt = max(l_ctx->local_xprt_req, r_ctx->remote_xprt_req); if (new_xprt == l_ctx->transport_ptr->id) @@ -4355,6 +4359,12 @@ static bool ch_migrate(struct channel_ctx *l_ctx, struct channel_ctx *r_ctx) rwref_put(&r_ctx->ch_state_lhb2); return migrated; } + if (ch_is_fully_opened(l_ctx) && + (l_ctx->transport_ptr->id == l_ctx->local_xprt_req)) { + rwref_put(&l_ctx->ch_state_lhb2); + rwref_put(&r_ctx->ch_state_lhb2); + return migrated; + } if (l_ctx->local_xprt_req == r_ctx->remote_xprt_req && l_ctx->local_xprt_req == l_ctx->transport_ptr->id) -- cgit v1.2.3