mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
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: Jay Jayanna <jayanna@codeaurora.org>
This commit is contained in:
parent
5c9c165066
commit
1a79f2584e
@ -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);
|
||||
return;
|
||||
}
|
||||
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");
|
||||
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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user