mhi: core: Assert on incorrect device events

Assert when an event is received for a channel which is empty.
This is a fatal transport error.

Change-Id: I0249f97480ebc3ca8d3e98c10e35a0eb040215a4
Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
This commit is contained in:
Andrei Danaila 2015-02-18 18:29:23 -08:00 committed by David Keitel
parent 30fc2b0436
commit 99ba40a4dc
2 changed files with 5 additions and 18 deletions

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2015, 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
@ -361,7 +361,6 @@ struct mhi_control_seg {
};
struct mhi_chan_counters {
u32 empty_ring_removal;
u32 pkts_xferd;
u32 ev_processed;
};

View file

@ -731,14 +731,8 @@ static enum MHI_STATUS parse_outbound(struct mhi_device_ctxt *mhi_dev_ctxt,
client_handle = mhi_dev_ctxt->client_handle_list[chan];
/* If ring is empty */
if (mhi_dev_ctxt->mhi_local_chan_ctxt[chan].rp ==
mhi_dev_ctxt->mhi_local_chan_ctxt[chan].wp) {
mhi_dev_ctxt->mhi_chan_cntr[chan].empty_ring_removal++;
mhi_wait_for_mdm(mhi_dev_ctxt);
return mhi_send_cmd(mhi_dev_ctxt,
MHI_COMMAND_RESET_CHAN,
chan);
}
MHI_ASSERT(!unlikely(mhi_dev_ctxt->mhi_local_chan_ctxt[chan].rp ==
mhi_dev_ctxt->mhi_local_chan_ctxt[chan].wp), "Empty Event Ring\n");
if (NULL != client_handle) {
result = &mhi_dev_ctxt->client_handle_list[chan]->result;
@ -771,14 +765,8 @@ static enum MHI_STATUS parse_inbound(struct mhi_device_ctxt *mhi_dev_ctxt,
client_handle = mhi_dev_ctxt->client_handle_list[chan];
local_chan_ctxt = &mhi_dev_ctxt->mhi_local_chan_ctxt[chan];
if (unlikely(mhi_dev_ctxt->mhi_local_chan_ctxt[chan].rp ==
mhi_dev_ctxt->mhi_local_chan_ctxt[chan].wp)) {
mhi_dev_ctxt->mhi_chan_cntr[chan].empty_ring_removal++;
mhi_wait_for_mdm(mhi_dev_ctxt);
return mhi_send_cmd(mhi_dev_ctxt,
MHI_COMMAND_RESET_CHAN,
chan);
}
MHI_ASSERT(!unlikely(mhi_dev_ctxt->mhi_local_chan_ctxt[chan].rp ==
mhi_dev_ctxt->mhi_local_chan_ctxt[chan].wp), "Empty Event Ring\n");
if (NULL != mhi_dev_ctxt->client_handle_list[chan])
result = &mhi_dev_ctxt->client_handle_list[chan]->result;