Re: [RFC PATCH 2/4] dmaengine: at_hdmac: In atc_prep_dma_memset, treat value as a single byte

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 2/15/2022 4:47 AM, Vinod Koul wrote:
On 28-01-22, 11:39, Ben Walker wrote:
The value passed in to .prep_dma_memset is to be treated as a single
byte repeating pattern.

Signed-off-by: Ben Walker <benjamin.walker@xxxxxxxxx>
Cc: Ludovic Desroches <ludovic.desroches@xxxxxxxxxxxxx>
Cc: Tudor Ambarus <tudor.ambarus@xxxxxxxxxxxxx>
---
  drivers/dma/at_hdmac.c | 10 +++++++++-
  1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index 30ae36124b1db..6defca514a614 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -942,6 +942,7 @@ atc_prep_dma_memset(struct dma_chan *chan, dma_addr_t dest, int value,
  	struct at_desc		*desc;
  	void __iomem		*vaddr;
  	dma_addr_t		paddr;
+	unsigned char		fill_pattern;
dev_vdbg(chan2dev(chan), "%s: d%pad v0x%x l0x%zx f0x%lx\n", __func__,
  		&dest, value, len, flags);
@@ -963,7 +964,14 @@ atc_prep_dma_memset(struct dma_chan *chan, dma_addr_t dest, int value,
  			__func__);
  		return NULL;
  	}
-	*(u32*)vaddr = value;
+
+	/* Only the first byte of value is to be used according to dmaengine */
+	fill_pattern = (unsigned char)value;

why cast as unsigned?
No good reason - I didn't think negatives would be used. I've updated this to be signed in the v2.


+
+	*(u32*)vaddr = (fill_pattern << 24) |
+		       (fill_pattern << 16) |
+		       (fill_pattern << 8) |
+		       fill_pattern;
desc = atc_create_memset_desc(chan, paddr, dest, len);
  	if (!desc) {
--
2.33.1




[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux PCI]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux