aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2014-08-08 17:24:16 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-08-08 18:57:28 -0400
commit9011a67b2fe9b89048bcba81745ef34394f6f7ab (patch)
tree9b50fb67c738f53423e4f9762f28a9c9d600c35e
parent7e835084fe1fff705be16e1db8a9e5e8f56b9b73 (diff)
infiniband: use pci_zalloc_consistent
Remove the now unnecessary memset too. Signed-off-by: Joe Perches <joe@perches.com> Cc: Tom Tucker <tom@opengridcomputing.com> Acked-by: Steve Wise <swise@opengridcomputing.com> Cc: Roland Dreier <roland@kernel.org> Cc: Sean Hefty <sean.hefty@intel.com> Cc: Hal Rosenstock <hal.rosenstock@gmail.com> Cc: Faisal Latif <faisal.latif@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/infiniband/hw/amso1100/c2.c6
-rw-r--r--drivers/infiniband/hw/nes/nes_hw.c12
-rw-r--r--drivers/infiniband/hw/nes/nes_verbs.c5
3 files changed, 10 insertions, 13 deletions
diff --git a/drivers/infiniband/hw/amso1100/c2.c b/drivers/infiniband/hw/amso1100/c2.c
index 00400c352c1a..766a71ccefed 100644
--- a/drivers/infiniband/hw/amso1100/c2.c
+++ b/drivers/infiniband/hw/amso1100/c2.c
@@ -604,16 +604,14 @@ static int c2_up(struct net_device *netdev)
604 tx_size = c2_port->tx_ring.count * sizeof(struct c2_tx_desc); 604 tx_size = c2_port->tx_ring.count * sizeof(struct c2_tx_desc);
605 605
606 c2_port->mem_size = tx_size + rx_size; 606 c2_port->mem_size = tx_size + rx_size;
607 c2_port->mem = pci_alloc_consistent(c2dev->pcidev, c2_port->mem_size, 607 c2_port->mem = pci_zalloc_consistent(c2dev->pcidev, c2_port->mem_size,
608 &c2_port->dma); 608 &c2_port->dma);
609 if (c2_port->mem == NULL) { 609 if (c2_port->mem == NULL) {
610 pr_debug("Unable to allocate memory for " 610 pr_debug("Unable to allocate memory for "
611 "host descriptor rings\n"); 611 "host descriptor rings\n");
612 return -ENOMEM; 612 return -ENOMEM;
613 } 613 }
614 614
615 memset(c2_port->mem, 0, c2_port->mem_size);
616
617 /* Create the Rx host descriptor ring */ 615 /* Create the Rx host descriptor ring */
618 if ((ret = 616 if ((ret =
619 c2_rx_ring_alloc(&c2_port->rx_ring, c2_port->mem, c2_port->dma, 617 c2_rx_ring_alloc(&c2_port->rx_ring, c2_port->mem, c2_port->dma,
diff --git a/drivers/infiniband/hw/nes/nes_hw.c b/drivers/infiniband/hw/nes/nes_hw.c
index 90200245c5eb..02120d340d50 100644
--- a/drivers/infiniband/hw/nes/nes_hw.c
+++ b/drivers/infiniband/hw/nes/nes_hw.c
@@ -1003,13 +1003,13 @@ int nes_init_cqp(struct nes_device *nesdev)
1003 (sizeof(struct nes_hw_aeqe) * nesadapter->max_qp) + 1003 (sizeof(struct nes_hw_aeqe) * nesadapter->max_qp) +
1004 sizeof(struct nes_hw_cqp_qp_context); 1004 sizeof(struct nes_hw_cqp_qp_context);
1005 1005
1006 nesdev->cqp_vbase = pci_alloc_consistent(nesdev->pcidev, nesdev->cqp_mem_size, 1006 nesdev->cqp_vbase = pci_zalloc_consistent(nesdev->pcidev,
1007 &nesdev->cqp_pbase); 1007 nesdev->cqp_mem_size,
1008 &nesdev->cqp_pbase);
1008 if (!nesdev->cqp_vbase) { 1009 if (!nesdev->cqp_vbase) {
1009 nes_debug(NES_DBG_INIT, "Unable to allocate memory for host descriptor rings\n"); 1010 nes_debug(NES_DBG_INIT, "Unable to allocate memory for host descriptor rings\n");
1010 return -ENOMEM; 1011 return -ENOMEM;
1011 } 1012 }
1012 memset(nesdev->cqp_vbase, 0, nesdev->cqp_mem_size);
1013 1013
1014 /* Allocate a twice the number of CQP requests as the SQ size */ 1014 /* Allocate a twice the number of CQP requests as the SQ size */
1015 nesdev->nes_cqp_requests = kzalloc(sizeof(struct nes_cqp_request) * 1015 nesdev->nes_cqp_requests = kzalloc(sizeof(struct nes_cqp_request) *
@@ -1691,13 +1691,13 @@ int nes_init_nic_qp(struct nes_device *nesdev, struct net_device *netdev)
1691 (NES_NIC_WQ_SIZE * 2 * sizeof(struct nes_hw_nic_cqe)) + 1691 (NES_NIC_WQ_SIZE * 2 * sizeof(struct nes_hw_nic_cqe)) +
1692 sizeof(struct nes_hw_nic_qp_context); 1692 sizeof(struct nes_hw_nic_qp_context);
1693 1693
1694 nesvnic->nic_vbase = pci_alloc_consistent(nesdev->pcidev, nesvnic->nic_mem_size, 1694 nesvnic->nic_vbase = pci_zalloc_consistent(nesdev->pcidev,
1695 &nesvnic->nic_pbase); 1695 nesvnic->nic_mem_size,
1696 &nesvnic->nic_pbase);
1696 if (!nesvnic->nic_vbase) { 1697 if (!nesvnic->nic_vbase) {
1697 nes_debug(NES_DBG_INIT, "Unable to allocate memory for NIC host descriptor rings\n"); 1698 nes_debug(NES_DBG_INIT, "Unable to allocate memory for NIC host descriptor rings\n");
1698 return -ENOMEM; 1699 return -ENOMEM;
1699 } 1700 }
1700 memset(nesvnic->nic_vbase, 0, nesvnic->nic_mem_size);
1701 nes_debug(NES_DBG_INIT, "Allocated NIC QP structures at %p (phys = %016lX), size = %u.\n", 1701 nes_debug(NES_DBG_INIT, "Allocated NIC QP structures at %p (phys = %016lX), size = %u.\n",
1702 nesvnic->nic_vbase, (unsigned long)nesvnic->nic_pbase, nesvnic->nic_mem_size); 1702 nesvnic->nic_vbase, (unsigned long)nesvnic->nic_pbase, nesvnic->nic_mem_size);
1703 1703
diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c
index 218dd3574285..fef067c959fc 100644
--- a/drivers/infiniband/hw/nes/nes_verbs.c
+++ b/drivers/infiniband/hw/nes/nes_verbs.c
@@ -1616,8 +1616,8 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries,
1616 entries, nescq->cq_mem_size, nescq->hw_cq.cq_number); 1616 entries, nescq->cq_mem_size, nescq->hw_cq.cq_number);
1617 1617
1618 /* allocate the physical buffer space */ 1618 /* allocate the physical buffer space */
1619 mem = pci_alloc_consistent(nesdev->pcidev, nescq->cq_mem_size, 1619 mem = pci_zalloc_consistent(nesdev->pcidev, nescq->cq_mem_size,
1620 &nescq->hw_cq.cq_pbase); 1620 &nescq->hw_cq.cq_pbase);
1621 if (!mem) { 1621 if (!mem) {
1622 printk(KERN_ERR PFX "Unable to allocate pci memory for cq\n"); 1622 printk(KERN_ERR PFX "Unable to allocate pci memory for cq\n");
1623 nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num); 1623 nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num);
@@ -1625,7 +1625,6 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries,
1625 return ERR_PTR(-ENOMEM); 1625 return ERR_PTR(-ENOMEM);
1626 } 1626 }
1627 1627
1628 memset(mem, 0, nescq->cq_mem_size);
1629 nescq->hw_cq.cq_vbase = mem; 1628 nescq->hw_cq.cq_vbase = mem;
1630 nescq->hw_cq.cq_head = 0; 1629 nescq->hw_cq.cq_head = 0;
1631 nes_debug(NES_DBG_CQ, "CQ%u virtual address @ %p, phys = 0x%08X\n", 1630 nes_debug(NES_DBG_CQ, "CQ%u virtual address @ %p, phys = 0x%08X\n",