rpmsg: glink: Set tail pointer to 0 at end of FIFO

When wrapping around the FIFO, the remote expects the tail pointer to
be reset to 0 on the edge case where the tail equals the FIFO length.

Change-Id: Ib0d2e7c3e9a3524a37792ec8cef3a2aac90e1bf6
Signed-off-by: Chris Lew <clew@codeaurora.org>
This commit is contained in:
Chris Lew 2018-05-07 18:44:55 -07:00
parent a0d79a3b58
commit 81a2f9e41c
2 changed files with 2 additions and 2 deletions

View File

@ -116,7 +116,7 @@ static void glink_smem_rx_advance(struct qcom_glink_pipe *np,
tail = le32_to_cpu(*pipe->tail);
tail += count;
if (tail > pipe->native.length)
if (tail >= pipe->native.length)
tail -= pipe->native.length;
*pipe->tail = cpu_to_le32(tail);

View File

@ -105,7 +105,7 @@ static void glink_spss_rx_advance(struct qcom_glink_pipe *np,
tail = le32_to_cpu(*pipe->tail);
tail += count;
if (tail > pipe->native.length)
if (tail >= pipe->native.length)
tail -= pipe->native.length;
*pipe->tail = cpu_to_le32(tail);