diff options
author | Joe Perches <joe@perches.com> | 2013-03-15 03:23:58 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-03-17 12:50:24 -0400 |
commit | 1f9061d27d3d2028805549c4a306324a48209057 (patch) | |
tree | 7cfb1a92933f5a9bba6745b68b6a964d9e757ef9 /drivers/net/ethernet/emulex | |
parent | 7f9421c264f8a6e6137027a45ae576517f66fa56 (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/emulex')
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be_main.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 2dfa205c5b99..536afa2fb94c 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
@@ -146,10 +146,9 @@ static int be_queue_alloc(struct be_adapter *adapter, struct be_queue_info *q, | |||
146 | q->entry_size = entry_size; | 146 | q->entry_size = entry_size; |
147 | mem->size = len * entry_size; | 147 | mem->size = len * entry_size; |
148 | mem->va = dma_alloc_coherent(&adapter->pdev->dev, mem->size, &mem->dma, | 148 | mem->va = dma_alloc_coherent(&adapter->pdev->dev, mem->size, &mem->dma, |
149 | GFP_KERNEL); | 149 | GFP_KERNEL | __GFP_ZERO); |
150 | if (!mem->va) | 150 | if (!mem->va) |
151 | return -ENOMEM; | 151 | return -ENOMEM; |
152 | memset(mem->va, 0, mem->size); | ||
153 | return 0; | 152 | return 0; |
154 | } | 153 | } |
155 | 154 | ||
@@ -2569,10 +2568,9 @@ static int be_setup_wol(struct be_adapter *adapter, bool enable) | |||
2569 | 2568 | ||
2570 | cmd.size = sizeof(struct be_cmd_req_acpi_wol_magic_config); | 2569 | cmd.size = sizeof(struct be_cmd_req_acpi_wol_magic_config); |
2571 | cmd.va = dma_alloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma, | 2570 | cmd.va = dma_alloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma, |
2572 | GFP_KERNEL); | 2571 | GFP_KERNEL | __GFP_ZERO); |
2573 | if (cmd.va == NULL) | 2572 | if (cmd.va == NULL) |
2574 | return -1; | 2573 | return -1; |
2575 | memset(cmd.va, 0, cmd.size); | ||
2576 | 2574 | ||
2577 | if (enable) { | 2575 | if (enable) { |
2578 | status = pci_write_config_dword(adapter->pdev, | 2576 | status = pci_write_config_dword(adapter->pdev, |
@@ -3794,12 +3792,13 @@ static int be_ctrl_init(struct be_adapter *adapter) | |||
3794 | 3792 | ||
3795 | rx_filter->size = sizeof(struct be_cmd_req_rx_filter); | 3793 | rx_filter->size = sizeof(struct be_cmd_req_rx_filter); |
3796 | rx_filter->va = dma_alloc_coherent(&adapter->pdev->dev, rx_filter->size, | 3794 | rx_filter->va = dma_alloc_coherent(&adapter->pdev->dev, rx_filter->size, |
3797 | &rx_filter->dma, GFP_KERNEL); | 3795 | &rx_filter->dma, |
3796 | GFP_KERNEL | __GFP_ZERO); | ||
3798 | if (rx_filter->va == NULL) { | 3797 | if (rx_filter->va == NULL) { |
3799 | status = -ENOMEM; | 3798 | status = -ENOMEM; |
3800 | goto free_mbox; | 3799 | goto free_mbox; |
3801 | } | 3800 | } |
3802 | memset(rx_filter->va, 0, rx_filter->size); | 3801 | |
3803 | mutex_init(&adapter->mbox_lock); | 3802 | mutex_init(&adapter->mbox_lock); |
3804 | spin_lock_init(&adapter->mcc_lock); | 3803 | spin_lock_init(&adapter->mcc_lock); |
3805 | spin_lock_init(&adapter->mcc_cq_lock); | 3804 | spin_lock_init(&adapter->mcc_cq_lock); |
@@ -3841,10 +3840,9 @@ static int be_stats_init(struct be_adapter *adapter) | |||
3841 | cmd->size = sizeof(struct be_cmd_req_get_stats_v1); | 3840 | cmd->size = sizeof(struct be_cmd_req_get_stats_v1); |
3842 | 3841 | ||
3843 | cmd->va = dma_alloc_coherent(&adapter->pdev->dev, cmd->size, &cmd->dma, | 3842 | cmd->va = dma_alloc_coherent(&adapter->pdev->dev, cmd->size, &cmd->dma, |
3844 | GFP_KERNEL); | 3843 | GFP_KERNEL | __GFP_ZERO); |
3845 | if (cmd->va == NULL) | 3844 | if (cmd->va == NULL) |
3846 | return -1; | 3845 | return -1; |
3847 | memset(cmd->va, 0, cmd->size); | ||
3848 | return 0; | 3846 | return 0; |
3849 | } | 3847 | } |
3850 | 3848 | ||