rpmsg: glink: smem: Support rx peak for size less than 4 bytes
authorArun Kumar Neelakantam <aneela@codeaurora.org>
Wed, 3 Oct 2018 11:38:20 +0000 (17:08 +0530)
committerBjorn Andersson <bjorn.andersson@linaro.org>
Thu, 4 Oct 2018 00:04:32 +0000 (17:04 -0700)
The current rx peak function fails to read the data if size is
less than 4bytes.

Use memcpy_fromio to support data reads of size less than 4 bytes.

Cc: stable@vger.kernel.org
Fixes: f0beb4ba9b18 ("rpmsg: glink: Remove chunk size word align warning")
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
drivers/rpmsg/qcom_glink_smem.c

index ab23da3d7131220306804155d23c2c51911acc91..64a5ce324c7f7e52b740db8a86d62ed84c3111e7 100644 (file)
@@ -89,15 +89,11 @@ static void glink_smem_rx_peak(struct qcom_glink_pipe *np,
                tail -= pipe->native.length;
 
        len = min_t(size_t, count, pipe->native.length - tail);
-       if (len) {
-               __ioread32_copy(data, pipe->fifo + tail,
-                               len / sizeof(u32));
-       }
+       if (len)
+               memcpy_fromio(data, pipe->fifo + tail, len);
 
-       if (len != count) {
-               __ioread32_copy(data + len, pipe->fifo,
-                               (count - len) / sizeof(u32));
-       }
+       if (len != count)
+               memcpy_fromio(data + len, pipe->fifo, (count - len));
 }
 
 static void glink_smem_rx_advance(struct qcom_glink_pipe *np,