aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/marvell/pxa168_eth.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2013-03-15 03:23:58 -0400
committerDavid S. Miller <davem@davemloft.net>2013-03-17 12:50:24 -0400
commit1f9061d27d3d2028805549c4a306324a48209057 (patch)
tree7cfb1a92933f5a9bba6745b68b6a964d9e757ef9 /drivers/net/ethernet/marvell/pxa168_eth.c
parent7f9421c264f8a6e6137027a45ae576517f66fa56 (diff)
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>
Diffstat (limited to 'drivers/net/ethernet/marvell/pxa168_eth.c')
-rw-r--r--drivers/net/ethernet/marvell/pxa168_eth.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c
index 3ae4c7f0834d..339bb323cb0c 100644
--- a/drivers/net/ethernet/marvell/pxa168_eth.c
+++ b/drivers/net/ethernet/marvell/pxa168_eth.c
@@ -584,12 +584,14 @@ static int init_hash_table(struct pxa168_eth_private *pep)
584 */ 584 */
585 if (pep->htpr == NULL) { 585 if (pep->htpr == NULL) {
586 pep->htpr = dma_alloc_coherent(pep->dev->dev.parent, 586 pep->htpr = dma_alloc_coherent(pep->dev->dev.parent,
587 HASH_ADDR_TABLE_SIZE, 587 HASH_ADDR_TABLE_SIZE,
588 &pep->htpr_dma, GFP_KERNEL); 588 &pep->htpr_dma,
589 GFP_KERNEL | __GFP_ZERO);
589 if (pep->htpr == NULL) 590 if (pep->htpr == NULL)
590 return -ENOMEM; 591 return -ENOMEM;
592 } else {
593 memset(pep->htpr, 0, HASH_ADDR_TABLE_SIZE);
591 } 594 }
592 memset(pep->htpr, 0, HASH_ADDR_TABLE_SIZE);
593 wrl(pep, HTPR, pep->htpr_dma); 595 wrl(pep, HTPR, pep->htpr_dma);
594 return 0; 596 return 0;
595} 597}
@@ -1023,11 +1025,11 @@ static int rxq_init(struct net_device *dev)
1023 size = pep->rx_ring_size * sizeof(struct rx_desc); 1025 size = pep->rx_ring_size * sizeof(struct rx_desc);
1024 pep->rx_desc_area_size = size; 1026 pep->rx_desc_area_size = size;
1025 pep->p_rx_desc_area = dma_alloc_coherent(pep->dev->dev.parent, size, 1027 pep->p_rx_desc_area = dma_alloc_coherent(pep->dev->dev.parent, size,
1026 &pep->rx_desc_dma, GFP_KERNEL); 1028 &pep->rx_desc_dma,
1029 GFP_KERNEL | __GFP_ZERO);
1027 if (!pep->p_rx_desc_area) 1030 if (!pep->p_rx_desc_area)
1028 goto out; 1031 goto out;
1029 1032
1030 memset((void *)pep->p_rx_desc_area, 0, size);
1031 /* initialize the next_desc_ptr links in the Rx descriptors ring */ 1033 /* initialize the next_desc_ptr links in the Rx descriptors ring */
1032 p_rx_desc = pep->p_rx_desc_area; 1034 p_rx_desc = pep->p_rx_desc_area;
1033 for (i = 0; i < rx_desc_num; i++) { 1035 for (i = 0; i < rx_desc_num; i++) {
@@ -1084,10 +1086,10 @@ static int txq_init(struct net_device *dev)
1084 size = pep->tx_ring_size * sizeof(struct tx_desc); 1086 size = pep->tx_ring_size * sizeof(struct tx_desc);
1085 pep->tx_desc_area_size = size; 1087 pep->tx_desc_area_size = size;
1086 pep->p_tx_desc_area = dma_alloc_coherent(pep->dev->dev.parent, size, 1088 pep->p_tx_desc_area = dma_alloc_coherent(pep->dev->dev.parent, size,
1087 &pep->tx_desc_dma, GFP_KERNEL); 1089 &pep->tx_desc_dma,
1090 GFP_KERNEL | __GFP_ZERO);
1088 if (!pep->p_tx_desc_area) 1091 if (!pep->p_tx_desc_area)
1089 goto out; 1092 goto out;
1090 memset((void *)pep->p_tx_desc_area, 0, pep->tx_desc_area_size);
1091 /* Initialize the next_desc_ptr links in the Tx descriptors ring */ 1093 /* Initialize the next_desc_ptr links in the Tx descriptors ring */
1092 p_tx_desc = pep->p_tx_desc_area; 1094 p_tx_desc = pep->p_tx_desc_area;
1093 for (i = 0; i < tx_desc_num; i++) { 1095 for (i = 0; i < tx_desc_num; i++) {