summaryrefslogtreecommitdiff
path: root/drivers/char
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2016-08-26 14:48:45 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2016-08-26 14:48:44 -0700
commitf196175bdbafb50e309f26bc3cc1732999fcc588 (patch)
treebea06284b2830c9bf445404697c1991201bba45e /drivers/char
parent01e1d840d78d2b4a431bd967315240c28a3a809b (diff)
parentcac6ba2e77828b1bcf4569d5bd71cd53136c75b2 (diff)
Merge " msm: ADSPRPC: Update channel state during subsystem restart"
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/adsprpc.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/drivers/char/adsprpc.c b/drivers/char/adsprpc.c
index d29192bfb9d0..13116f010e89 100644
--- a/drivers/char/adsprpc.c
+++ b/drivers/char/adsprpc.c
@@ -1250,9 +1250,10 @@ static int fastrpc_invoke_send(struct smq_invoke_ctx *ctx,
{
struct smq_msg *msg = &ctx->msg;
struct fastrpc_file *fl = ctx->fl;
+ struct fastrpc_channel_ctx *channel_ctx = &fl->apps->channel[fl->cid];
int err = 0, len;
- VERIFY(err, 0 != fl->apps->channel[fl->cid].chan);
+ VERIFY(err, 0 != channel_ctx->chan);
if (err)
goto bail;
msg->pid = current->tgid;
@@ -1266,13 +1267,21 @@ static int fastrpc_invoke_send(struct smq_invoke_ctx *ctx,
msg->invoke.page.size = buf_page_size(ctx->used);
if (fl->apps->glink) {
- err = glink_tx(fl->apps->channel[fl->cid].chan,
+ if (fl->ssrcount != channel_ctx->ssrcount) {
+ err = -ECONNRESET;
+ goto bail;
+ }
+ VERIFY(err, channel_ctx->link.port_state ==
+ FASTRPC_LINK_CONNECTED);
+ if (err)
+ goto bail;
+ err = glink_tx(channel_ctx->chan,
(void *)&fl->apps->channel[fl->cid], msg, sizeof(*msg),
GLINK_TX_REQ_INTENT);
} else {
spin_lock(&fl->apps->hlock);
len = smd_write((smd_channel_t *)
- fl->apps->channel[fl->cid].chan,
+ channel_ctx->chan,
msg, sizeof(*msg));
spin_unlock(&fl->apps->hlock);
VERIFY(err, len == sizeof(*msg));
@@ -1823,12 +1832,14 @@ void fastrpc_glink_notify_state(void *handle, const void *priv, unsigned event)
break;
case GLINK_LOCAL_DISCONNECTED:
link->port_state = FASTRPC_LINK_DISCONNECTED;
- fastrpc_notify_drivers(me, cid);
- if (link->link_state == FASTRPC_LINK_STATE_UP)
- fastrpc_glink_open(cid);
break;
case GLINK_REMOTE_DISCONNECTED:
- fastrpc_glink_close(me->channel[cid].chan, cid);
+ if (me->channel[cid].chan &&
+ link->link_state == FASTRPC_LINK_STATE_UP) {
+ fastrpc_glink_close(me->channel[cid].chan, cid);
+ me->channel[cid].chan = 0;
+ link->port_state = FASTRPC_LINK_DISCONNECTED;
+ }
break;
default:
break;
@@ -1962,7 +1973,9 @@ static void fastrpc_glink_close(void *chan, int cid)
if (err)
return;
link = &gfa.channel[cid].link;
- if (link->port_state == FASTRPC_LINK_CONNECTED) {
+
+ if (link->port_state == FASTRPC_LINK_CONNECTED ||
+ link->port_state == FASTRPC_LINK_CONNECTING) {
link->port_state = FASTRPC_LINK_DISCONNECTING;
glink_close(chan);
}
@@ -1993,6 +2006,7 @@ static int fastrpc_glink_open(int cid)
link->port_state = FASTRPC_LINK_CONNECTING;
cfg->priv = (void *)(uintptr_t)cid;
cfg->edge = gcinfo[cid].link.link_info.edge;
+ cfg->transport = gcinfo[cid].link.link_info.transport;
cfg->name = FASTRPC_GLINK_GUID;
cfg->notify_rx = fastrpc_glink_notify_rx;
cfg->notify_tx_done = fastrpc_glink_notify_tx_done;