netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 net-next] net: mediatek: use dma_zalloc_coherent instead of allocator/memset
@ 2018-07-23  3:16 YueHaibing
  2018-07-23  3:52 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: YueHaibing @ 2018-07-23  3:16 UTC (permalink / raw)
  To: davem, nbd, john, sean.wang, nelson.chang
  Cc: linux-kernel, netdev, matthias.bgg, linux-arm-kernel,
	linux-mediatek, YueHaibing

Use dma_zalloc_coherent instead of dma_alloc_coherent
followed by memset 0.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
v2: remove redundant __GFP_ZERO
---
 drivers/net/ethernet/mediatek/mtk_eth_soc.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index d8ebf0a..c30aea2 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -1221,14 +1221,11 @@ static int mtk_tx_alloc(struct mtk_eth *eth)
 	if (!ring->buf)
 		goto no_tx_mem;
 
-	ring->dma = dma_alloc_coherent(eth->dev,
-					  MTK_DMA_SIZE * sz,
-					  &ring->phys,
-					  GFP_ATOMIC | __GFP_ZERO);
+	ring->dma = dma_zalloc_coherent(eth->dev, MTK_DMA_SIZE * sz,
+					&ring->phys, GFP_ATOMIC);
 	if (!ring->dma)
 		goto no_tx_mem;
 
-	memset(ring->dma, 0, MTK_DMA_SIZE * sz);
 	for (i = 0; i < MTK_DMA_SIZE; i++) {
 		int next = (i + 1) % MTK_DMA_SIZE;
 		u32 next_ptr = ring->phys + next * sz;
-- 
2.7.0

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

* Re: [PATCH v2 net-next] net: mediatek: use dma_zalloc_coherent instead of allocator/memset
  2018-07-23  3:16 [PATCH v2 net-next] net: mediatek: use dma_zalloc_coherent instead of allocator/memset YueHaibing
@ 2018-07-23  3:52 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-07-23  3:52 UTC (permalink / raw)
  To: yuehaibing
  Cc: nbd, john, sean.wang, nelson.chang, linux-kernel, netdev,
	matthias.bgg, linux-arm-kernel, linux-mediatek

From: YueHaibing <yuehaibing@huawei.com>
Date: Mon, 23 Jul 2018 11:16:47 +0800

> Use dma_zalloc_coherent instead of dma_alloc_coherent
> followed by memset 0.
> 
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
> v2: remove redundant __GFP_ZERO

Applied, thank you.

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

end of thread, other threads:[~2018-07-23  3:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-23  3:16 [PATCH v2 net-next] net: mediatek: use dma_zalloc_coherent instead of allocator/memset YueHaibing
2018-07-23  3:52 ` David Miller

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