drivers:net: dma_alloc_coherent: use __GFP_ZERO instead of memset(, 0)

Reduce the number of calls required to alloc
a zeroed block of memory.

Trivially reduces overall object size.

Other changes around these removals
o Neaten call argument alignment
o Remove an unnecessary OOM message after dma_alloc_coherent failure
o Remove unnecessary gfp_t stack variable

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Joe Perches
2013-03-15 07:23:58 +00:00
committed by David S. Miller
부모 7f9421c264
커밋 1f9061d27d
38개의 변경된 파일104개의 추가작업 그리고 168개의 파일을 삭제

파일 보기

@@ -780,12 +780,11 @@ static int ftgmac100_alloc_buffers(struct ftgmac100 *priv)
priv->descs = dma_alloc_coherent(priv->dev,
sizeof(struct ftgmac100_descs),
&priv->descs_dma_addr, GFP_KERNEL);
&priv->descs_dma_addr,
GFP_KERNEL | __GFP_ZERO);
if (!priv->descs)
return -ENOMEM;
memset(priv->descs, 0, sizeof(struct ftgmac100_descs));
/* initialize RX ring */
ftgmac100_rxdes_set_end_of_ring(&priv->descs->rxdes[RX_QUEUE_ENTRIES - 1]);

파일 보기

@@ -732,13 +732,13 @@ static int ftmac100_alloc_buffers(struct ftmac100 *priv)
{
int i;
priv->descs = dma_alloc_coherent(priv->dev, sizeof(struct ftmac100_descs),
&priv->descs_dma_addr, GFP_KERNEL);
priv->descs = dma_alloc_coherent(priv->dev,
sizeof(struct ftmac100_descs),
&priv->descs_dma_addr,
GFP_KERNEL | __GFP_ZERO);
if (!priv->descs)
return -ENOMEM;
memset(priv->descs, 0, sizeof(struct ftmac100_descs));
/* initialize RX ring */
ftmac100_rxdes_set_end_of_ring(&priv->descs->rxdes[RX_QUEUE_ENTRIES - 1]);