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

Commit 1a79f258 authored by Jay Jayanna's avatar Jay Jayanna
Browse files

net: qrtr: Loop on mhi_dev_read_channel until it returns 0



qrtr_mhi_dev_event_cb will be called only once if there is
more than one packet at that time. Hence, call mhi_dev_read_channel
in a loop until it returns zero.

Change-Id: I2f171cb45e66c1c439fcc7d0027c22d0edb4fb19
Signed-off-by: default avatarJay Jayanna <jayanna@codeaurora.org>
parent 5c9c1650
Loading
Loading
Loading
Loading
+12 −8
Original line number Diff line number Diff line
@@ -93,6 +93,7 @@ static void qrtr_mhi_dev_read(struct qrtr_mhi_dev_ep *qep)
{
	struct mhi_req req = { 0 };
	int rc;
	int bytes_read;

	req.chan = QRTR_MHI_DEV_IN;
	req.client = qep->in;
@@ -100,15 +101,18 @@ static void qrtr_mhi_dev_read(struct qrtr_mhi_dev_ep *qep)
	req.buf = qep->buf_in;
	req.len = QRTR_MAX_PKT_SIZE;

	rc = mhi_dev_read_channel(&req);
	if (rc < 0) {
		dev_err(qep->dev, "failed to read channel %d\n", rc);
	do {
		bytes_read = mhi_dev_read_channel(&req);
		if (bytes_read < 0) {
			dev_err(qep->dev, "failed to read channel %d\n",
				bytes_read);
			return;
		}

		rc = qrtr_endpoint_post(&qep->ep, req.buf, req.transfer_len);
		if (rc == -EINVAL)
			dev_err(qep->dev, "invalid ipcrouter packet\n");
	} while (bytes_read > 0);
}

static void qrtr_mhi_dev_event_cb(struct mhi_dev_client_cb_reason *reason)