All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: mediatek: use dma_zalloc_coherent instead of allocator/memset
@ 2018-07-19 14:09 ` YueHaibing
  0 siblings, 0 replies; 27+ messages in thread
From: YueHaibing @ 2018-07-19 14:09 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>
---
 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..fbdb3e3 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 | __GFP_ZERO);
 	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] 27+ messages in thread

end of thread, other threads:[~2018-07-20 14:16 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-19 14:09 [PATCH] net: mediatek: use dma_zalloc_coherent instead of allocator/memset YueHaibing
2018-07-19 14:09 ` YueHaibing
2018-07-19 14:09 ` YueHaibing
2018-07-19 14:17 ` Russell King - ARM Linux
2018-07-19 14:17   ` Russell King - ARM Linux
2018-07-19 17:02   ` [SPAM]Re: " Sean Wang
2018-07-19 17:02     ` Sean Wang
2018-07-20  6:30     ` YueHaibing
2018-07-20  6:30       ` YueHaibing
2018-07-20  6:54       ` Sean Wang
2018-07-20  6:54         ` Sean Wang
2018-07-20  9:25         ` Russell King - ARM Linux
2018-07-20  9:25           ` Russell King - ARM Linux
     [not found]           ` <20180720092555.GA28941-l+eeeJia6m9URfEZ8mYm6t73F7V6hmMc@public.gmane.org>
2018-07-20 12:13             ` YueHaibing
2018-07-20 12:13               ` YueHaibing
     [not found]       ` <9a4cdfc6-7487-5908-b584-f3bf6158c4d4-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2018-07-20  8:13         ` Russell King - ARM Linux
2018-07-20  8:13           ` Russell King - ARM Linux
     [not found]           ` <20180720081334.GO17271-l+eeeJia6m9URfEZ8mYm6t73F7V6hmMc@public.gmane.org>
2018-07-20 13:33             ` YueHaibing
2018-07-20 13:33               ` YueHaibing
2018-07-20 13:57               ` Sean Wang
2018-07-20 13:57                 ` Sean Wang
2018-07-20 14:16                 ` YueHaibing
2018-07-20 14:16                   ` YueHaibing
2018-07-20 13:48           ` Sean Wang
2018-07-20 13:48             ` Sean Wang
2018-07-20 13:59             ` YueHaibing
2018-07-20 13:59               ` YueHaibing

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.