diff options
| author | Linux Build Service Account <lnxbuild@quicinc.com> | 2017-06-01 16:56:00 -0700 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-06-01 16:55:59 -0700 |
| commit | 2ce111aca6fe9bea5bff224155991edc80f4219f (patch) | |
| tree | e553bdcc3ee4259b64cb67f80df68188341fef89 | |
| parent | 840d1a232cfd67867a61a31ccc5d81c5c2192474 (diff) | |
| parent | c1137cd3a53aeacd5923bec228224f9b25c7fbdb (diff) | |
Merge "diag: Add support for mhi shutdown notification"
| -rw-r--r-- | drivers/char/diag/diagfwd_mhi.c | 29 |
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); |
