mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-04 16:15:11 +00:00
net: mediatek: use dma_zalloc_coherent instead of allocator/memset
Use dma_zalloc_coherent instead of dma_alloc_coherent followed by memset 0. Signed-off-by: YueHaibing <yuehaibing@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
07300f774f
commit
0a78c3803d
1 changed files with 2 additions and 5 deletions
|
@ -1221,14 +1221,11 @@ static int mtk_tx_alloc(struct mtk_eth *eth)
|
||||||
if (!ring->buf)
|
if (!ring->buf)
|
||||||
goto no_tx_mem;
|
goto no_tx_mem;
|
||||||
|
|
||||||
ring->dma = dma_alloc_coherent(eth->dev,
|
ring->dma = dma_zalloc_coherent(eth->dev, MTK_DMA_SIZE * sz,
|
||||||
MTK_DMA_SIZE * sz,
|
&ring->phys, GFP_ATOMIC);
|
||||||
&ring->phys,
|
|
||||||
GFP_ATOMIC | __GFP_ZERO);
|
|
||||||
if (!ring->dma)
|
if (!ring->dma)
|
||||||
goto no_tx_mem;
|
goto no_tx_mem;
|
||||||
|
|
||||||
memset(ring->dma, 0, MTK_DMA_SIZE * sz);
|
|
||||||
for (i = 0; i < MTK_DMA_SIZE; i++) {
|
for (i = 0; i < MTK_DMA_SIZE; i++) {
|
||||||
int next = (i + 1) % MTK_DMA_SIZE;
|
int next = (i + 1) % MTK_DMA_SIZE;
|
||||||
u32 next_ptr = ring->phys + next * sz;
|
u32 next_ptr = ring->phys + next * sz;
|
||||||
|
|
Loading…
Reference in a new issue