summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSreelakshmi Gownipalli <sgownipa@codeaurora.org>2017-03-24 14:31:36 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2017-05-16 16:53:41 -0700
commitc1137cd3a53aeacd5923bec228224f9b25c7fbdb (patch)
tree639765010bccac036441a83b8f74d6e4114df80a
parent211854c904f68128aa506ac2c3be2a7027ab78d3 (diff)
diag: Add support for mhi shutdown notification
Add support for mhi shutdown notification to clear the diag mhi states. Change-Id: I4760c0f23bfc81280f45b5a5173492341d003adf Signed-off-by: Sreelakshmi Gownipalli <sgownipa@codeaurora.org>
-rw-r--r--drivers/char/diag/diagfwd_mhi.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/drivers/char/diag/diagfwd_mhi.c b/drivers/char/diag/diagfwd_mhi.c
index 8b0e1f32bdc5..03133a5a89aa 100644
--- a/drivers/char/diag/diagfwd_mhi.c
+++ b/drivers/char/diag/diagfwd_mhi.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -553,6 +553,8 @@ static void mhi_notifier(struct mhi_cb_info *cb_info)
struct mhi_result *result = NULL;
struct diag_mhi_ch_t *ch = NULL;
void *buf = NULL;
+ struct diag_mhi_info *mhi_info = NULL;
+ unsigned long flags;
if (!cb_info)
return;
@@ -604,13 +606,6 @@ static void mhi_notifier(struct mhi_cb_info *cb_info)
queue_work(diag_mhi[index].mhi_wq,
&(diag_mhi[index].open_work));
break;
- case MHI_CB_MHI_DISABLED:
- DIAG_LOG(DIAG_DEBUG_BRIDGE,
- "received mhi disabled notifiation port: %d ch: %d\n",
- index, ch->type);
- atomic_set(&(ch->opened), 0);
- __mhi_close(&diag_mhi[index], CHANNELS_CLOSED);
- break;
case MHI_CB_XFER:
/*
* If the channel is a read channel, this is a read
@@ -637,6 +632,24 @@ static void mhi_notifier(struct mhi_cb_info *cb_info)
result->bytes_xferd,
diag_mhi[index].id);
break;
+ case MHI_CB_MHI_DISABLED:
+ case MHI_CB_SYS_ERROR:
+ case MHI_CB_MHI_SHUTDOWN:
+ DIAG_LOG(DIAG_DEBUG_BRIDGE,
+ "received mhi link down cb: %d port: %d ch: %d\n",
+ cb_info->cb_reason, index, ch->type);
+ mhi_info = &diag_mhi[index];
+ if (!mhi_info->enabled)
+ return;
+ spin_lock_irqsave(&mhi_info->lock, flags);
+ mhi_info->enabled = 0;
+ spin_unlock_irqrestore(&mhi_info->lock, flags);
+ atomic_set(&(mhi_info->read_ch.opened), 0);
+ atomic_set(&(mhi_info->write_ch.opened), 0);
+ flush_workqueue(mhi_info->mhi_wq);
+ mhi_buf_tbl_clear(mhi_info);
+ diag_remote_dev_close(mhi_info->dev_id);
+ break;
default:
pr_err("diag: In %s, invalid cb reason 0x%x\n", __func__,
cb_info->cb_reason);