Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e266dbdc authored by Sujeev Dias's avatar Sujeev Dias Committed by Gerrit - the friendly Code Review server
Browse files

msm: mhi: Check bb ring and transfer ring when checking for space



When checking for available spaces, check available spaces on
both bounce buffer ring and transfer ring and return min.

Change-Id: I9208b46c32821de3f5d9e3d828087d7bc29b9546
CRs-Fixed: 1055681
Signed-off-by: default avatarSujeev Dias <sdias@codeaurora.org>
parent c1f45676
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -114,6 +114,7 @@ int mhi_get_free_desc(struct mhi_client_handle *client_handle)
{
	u32 chan;
	struct mhi_device_ctxt *ctxt;
	int bb_ring, ch_ring;

	if (!client_handle || MHI_HANDLE_MAGIC != client_handle->magic ||
	    !client_handle->mhi_dev_ctxt)
@@ -121,7 +122,10 @@ int mhi_get_free_desc(struct mhi_client_handle *client_handle)
	ctxt = client_handle->mhi_dev_ctxt;
	chan = client_handle->chan_info.chan_nr;

	return get_nr_avail_ring_elements(&ctxt->mhi_local_chan_ctxt[chan]);
	bb_ring = get_nr_avail_ring_elements(&ctxt->chan_bb_list[chan]);
	ch_ring = get_nr_avail_ring_elements(&ctxt->mhi_local_chan_ctxt[chan]);

	return min(bb_ring, ch_ring);
}
EXPORT_SYMBOL(mhi_get_free_desc);