linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rpmsg: glink: smem: Support rx peak for size less than 4 bytes
@ 2018-10-03 11:38 Arun Kumar Neelakantam
  2018-10-04  0:03 ` Bjorn Andersson
  0 siblings, 1 reply; 2+ messages in thread
From: Arun Kumar Neelakantam @ 2018-10-03 11:38 UTC (permalink / raw)
  To: ohad, bjorn.andersson, clew, sricharan
  Cc: linux-remoteproc, linux-kernel, Arun Kumar Neelakantam

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.

Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
---
 drivers/rpmsg/qcom_glink_smem.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/rpmsg/qcom_glink_smem.c b/drivers/rpmsg/qcom_glink_smem.c
index 2b5cf27..7b65443 100644
--- a/drivers/rpmsg/qcom_glink_smem.c
+++ b/drivers/rpmsg/qcom_glink_smem.c
@@ -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,
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] rpmsg: glink: smem: Support rx peak for size less than 4 bytes
  2018-10-03 11:38 [PATCH] rpmsg: glink: smem: Support rx peak for size less than 4 bytes Arun Kumar Neelakantam
@ 2018-10-04  0:03 ` Bjorn Andersson
  0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Andersson @ 2018-10-04  0:03 UTC (permalink / raw)
  To: Arun Kumar Neelakantam
  Cc: ohad, clew, sricharan, linux-remoteproc, linux-kernel

On Wed 03 Oct 04:38 PDT 2018, Arun Kumar Neelakantam wrote:

> 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.
> 
> Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>

Applied, with a fixes tag and Cc stable.

Thanks,
Bjorn

> ---
>  drivers/rpmsg/qcom_glink_smem.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/rpmsg/qcom_glink_smem.c b/drivers/rpmsg/qcom_glink_smem.c
> index 2b5cf27..7b65443 100644
> --- a/drivers/rpmsg/qcom_glink_smem.c
> +++ b/drivers/rpmsg/qcom_glink_smem.c
> @@ -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,
> -- 
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-10-04  0:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-03 11:38 [PATCH] rpmsg: glink: smem: Support rx peak for size less than 4 bytes Arun Kumar Neelakantam
2018-10-04  0:03 ` Bjorn Andersson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).