linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: endpoint: functions: use memcpy_fromio()/memcpy_toio()
@ 2019-02-11  9:04 Wen Yang
  2019-02-11 11:35 ` Kishon Vijay Abraham I
  2019-02-11 16:19 ` Lorenzo Pieralisi
  0 siblings, 2 replies; 3+ messages in thread
From: Wen Yang @ 2019-02-11  9:04 UTC (permalink / raw)
  To: kishon
  Cc: lorenzo.pieralisi, bhelgaas, gustavo.pimentel, niklas.cassel,
	baijiaju1990, linux-pci, linux-kernel, xue.zhihong, wang.yi59,
	Wen Yang, Greg Kroah-Hartman, Cyrille Pitchen

Use the IO memcpy() functions when copying from/to IO memory.
These locations were found via sparse.

Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
Suggested-by: Kishon Vijay Abraham I <kishon@ti.com>
CC: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
CC: Bjorn Helgaas <bhelgaas@google.com>
CC: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
CC: Niklas Cassel <niklas.cassel@axis.com>
CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
CC: Cyrille Pitchen <cyrille.pitchen@free-electrons.com>
CC: linux-pci@vger.kernel.org
CC: linux-kernel@vger.kernel.org
---
 drivers/pci/endpoint/functions/pci-epf-test.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c
index 3e86fa3..4bbd26e 100644
--- a/drivers/pci/endpoint/functions/pci-epf-test.c
+++ b/drivers/pci/endpoint/functions/pci-epf-test.c
@@ -175,7 +175,7 @@ static int pci_epf_test_read(struct pci_epf_test *epf_test)
 		goto err_map_addr;
 	}
 
-	memcpy(buf, src_addr, reg->size);
+	memcpy_fromio(buf, src_addr, reg->size);
 
 	crc32 = crc32_le(~0, buf, reg->size);
 	if (crc32 != reg->checksum)
@@ -230,7 +230,7 @@ static int pci_epf_test_write(struct pci_epf_test *epf_test)
 	get_random_bytes(buf, reg->size);
 	reg->checksum = crc32_le(~0, buf, reg->size);
 
-	memcpy(dst_addr, buf, reg->size);
+	memcpy_toio(dst_addr, buf, reg->size);
 
 	/*
 	 * wait 1ms inorder for the write to complete. Without this delay L3
-- 
2.9.5


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

* Re: [PATCH] PCI: endpoint: functions: use memcpy_fromio()/memcpy_toio()
  2019-02-11  9:04 [PATCH] PCI: endpoint: functions: use memcpy_fromio()/memcpy_toio() Wen Yang
@ 2019-02-11 11:35 ` Kishon Vijay Abraham I
  2019-02-11 16:19 ` Lorenzo Pieralisi
  1 sibling, 0 replies; 3+ messages in thread
From: Kishon Vijay Abraham I @ 2019-02-11 11:35 UTC (permalink / raw)
  To: Wen Yang
  Cc: lorenzo.pieralisi, bhelgaas, gustavo.pimentel, niklas.cassel,
	baijiaju1990, linux-pci, linux-kernel, xue.zhihong, wang.yi59,
	Greg Kroah-Hartman, Cyrille Pitchen



On 11/02/19 2:34 PM, Wen Yang wrote:
> Use the IO memcpy() functions when copying from/to IO memory.
> These locations were found via sparse.
> 
> Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
> Suggested-by: Kishon Vijay Abraham I <kishon@ti.com>
> CC: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> CC: Bjorn Helgaas <bhelgaas@google.com>
> CC: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
> CC: Niklas Cassel <niklas.cassel@axis.com>
> CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> CC: Cyrille Pitchen <cyrille.pitchen@free-electrons.com>
> CC: linux-pci@vger.kernel.org
> CC: linux-kernel@vger.kernel.org

Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
>  drivers/pci/endpoint/functions/pci-epf-test.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c
> index 3e86fa3..4bbd26e 100644
> --- a/drivers/pci/endpoint/functions/pci-epf-test.c
> +++ b/drivers/pci/endpoint/functions/pci-epf-test.c
> @@ -175,7 +175,7 @@ static int pci_epf_test_read(struct pci_epf_test *epf_test)
>  		goto err_map_addr;
>  	}
>  
> -	memcpy(buf, src_addr, reg->size);
> +	memcpy_fromio(buf, src_addr, reg->size);
>  
>  	crc32 = crc32_le(~0, buf, reg->size);
>  	if (crc32 != reg->checksum)
> @@ -230,7 +230,7 @@ static int pci_epf_test_write(struct pci_epf_test *epf_test)
>  	get_random_bytes(buf, reg->size);
>  	reg->checksum = crc32_le(~0, buf, reg->size);
>  
> -	memcpy(dst_addr, buf, reg->size);
> +	memcpy_toio(dst_addr, buf, reg->size);
>  
>  	/*
>  	 * wait 1ms inorder for the write to complete. Without this delay L3
> 

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

* Re: [PATCH] PCI: endpoint: functions: use memcpy_fromio()/memcpy_toio()
  2019-02-11  9:04 [PATCH] PCI: endpoint: functions: use memcpy_fromio()/memcpy_toio() Wen Yang
  2019-02-11 11:35 ` Kishon Vijay Abraham I
@ 2019-02-11 16:19 ` Lorenzo Pieralisi
  1 sibling, 0 replies; 3+ messages in thread
From: Lorenzo Pieralisi @ 2019-02-11 16:19 UTC (permalink / raw)
  To: Wen Yang
  Cc: kishon, bhelgaas, gustavo.pimentel, niklas.cassel, baijiaju1990,
	linux-pci, linux-kernel, xue.zhihong, wang.yi59,
	Greg Kroah-Hartman, Cyrille Pitchen

On Mon, Feb 11, 2019 at 05:04:00PM +0800, Wen Yang wrote:
> Use the IO memcpy() functions when copying from/to IO memory.
> These locations were found via sparse.
> 
> Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
> Suggested-by: Kishon Vijay Abraham I <kishon@ti.com>
> CC: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> CC: Bjorn Helgaas <bhelgaas@google.com>
> CC: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
> CC: Niklas Cassel <niklas.cassel@axis.com>
> CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> CC: Cyrille Pitchen <cyrille.pitchen@free-electrons.com>
> CC: linux-pci@vger.kernel.org
> CC: linux-kernel@vger.kernel.org
> ---
>  drivers/pci/endpoint/functions/pci-epf-test.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Applied, with updated tags to pci/endpoint for v5.1, thanks.

Lorenzo

> diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c
> index 3e86fa3..4bbd26e 100644
> --- a/drivers/pci/endpoint/functions/pci-epf-test.c
> +++ b/drivers/pci/endpoint/functions/pci-epf-test.c
> @@ -175,7 +175,7 @@ static int pci_epf_test_read(struct pci_epf_test *epf_test)
>  		goto err_map_addr;
>  	}
>  
> -	memcpy(buf, src_addr, reg->size);
> +	memcpy_fromio(buf, src_addr, reg->size);
>  
>  	crc32 = crc32_le(~0, buf, reg->size);
>  	if (crc32 != reg->checksum)
> @@ -230,7 +230,7 @@ static int pci_epf_test_write(struct pci_epf_test *epf_test)
>  	get_random_bytes(buf, reg->size);
>  	reg->checksum = crc32_le(~0, buf, reg->size);
>  
> -	memcpy(dst_addr, buf, reg->size);
> +	memcpy_toio(dst_addr, buf, reg->size);
>  
>  	/*
>  	 * wait 1ms inorder for the write to complete. Without this delay L3
> -- 
> 2.9.5
> 

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

end of thread, other threads:[~2019-02-11 16:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-11  9:04 [PATCH] PCI: endpoint: functions: use memcpy_fromio()/memcpy_toio() Wen Yang
2019-02-11 11:35 ` Kishon Vijay Abraham I
2019-02-11 16:19 ` Lorenzo Pieralisi

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).