Re: [PATCH] dmaengine: zx: fix build warning

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

 



On 2017年01月11日 08:57, Shawn Guo wrote:
On Tue, Jan 10, 2017 at 05:23:40PM +0800, Jun Nie wrote:
Fix build warning that related to PAGE_SIZE. The maximum DMA
length has nothing to do with PAGE_SIZE, just use a fix number
for the definition.

drivers/dma/zx_dma.c: In function 'zx_dma_prep_memcpy':
drivers/dma/zx_dma.c:523:8: warning: division by zero [-Wdiv-by-zero]
drivers/dma/zx_dma.c: In function 'zx_dma_prep_slave_sg':
drivers/dma/zx_dma.c:567:11: warning: division by zero [-Wdiv-by-zero]

Signed-off-by: Jun Nie <jun.nie@xxxxxxxxxx>

HDMI audio works fine with the change, so:

Tested-by: Shawn Guo <shawn.guo@xxxxxxxxxx>

But out of curiosity ...

---
 drivers/dma/zx_dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/zx_dma.c b/drivers/dma/zx_dma.c
index 42ff3e6..2bb6953 100644
--- a/drivers/dma/zx_dma.c
+++ b/drivers/dma/zx_dma.c
@@ -26,7 +26,7 @@

 #define DRIVER_NAME		"zx-dma"
 #define DMA_ALIGN		4
-#define DMA_MAX_SIZE		(0x10000 - PAGE_SIZE)
+#define DMA_MAX_SIZE		(0x10000 - 512)

Why do we need to minus some amount of bytes from 64KiB size for
DMA_MAX_SIZE at all?

For better alignment of DMA transfer size. Maximum size 0xFFFF minus 32 or 64 shall be OK, but I prefer to 512 for better performance and safe.


 #define LLI_BLOCK_SIZE		(4 * PAGE_SIZE)

Why do we need to have LLI_BLOCK_SIZE vary with PAGE_SIZE?

It is a trade off for dmam_pool size. 4 pages size does introduce pressure to memory management and allocation, and size is enough for most of DMA descriptor usage.


Shawn


 #define REG_ZX_SRC_ADDR			0x00
--
1.9.1


--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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