IB/amso1100: Use dma_alloc_coherent() instead of kmalloc/dma_map_single
The Ammasso driver needs to use dma_alloc_coherent() for allocating memory that will be used by the HW for dma. Signed-off-by: Steve Wise <swise@opengridcomputing.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
This commit is contained in:
committed by
Roland Dreier
parent
04d03bc576
commit
8de94ce19d
@@ -42,13 +42,14 @@ static int c2_alloc_mqsp_chunk(struct c2_dev *c2dev, gfp_t gfp_mask,
|
||||
{
|
||||
int i;
|
||||
struct sp_chunk *new_head;
|
||||
dma_addr_t dma_addr;
|
||||
|
||||
new_head = (struct sp_chunk *) __get_free_page(gfp_mask);
|
||||
new_head = dma_alloc_coherent(&c2dev->pcidev->dev, PAGE_SIZE,
|
||||
&dma_addr, gfp_mask);
|
||||
if (new_head == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
new_head->dma_addr = dma_map_single(c2dev->ibdev.dma_device, new_head,
|
||||
PAGE_SIZE, DMA_FROM_DEVICE);
|
||||
new_head->dma_addr = dma_addr;
|
||||
pci_unmap_addr_set(new_head, mapping, new_head->dma_addr);
|
||||
|
||||
new_head->next = NULL;
|
||||
@@ -80,10 +81,8 @@ void c2_free_mqsp_pool(struct c2_dev *c2dev, struct sp_chunk *root)
|
||||
|
||||
while (root) {
|
||||
next = root->next;
|
||||
dma_unmap_single(c2dev->ibdev.dma_device,
|
||||
pci_unmap_addr(root, mapping), PAGE_SIZE,
|
||||
DMA_FROM_DEVICE);
|
||||
__free_page((struct page *) root);
|
||||
dma_free_coherent(&c2dev->pcidev->dev, PAGE_SIZE, root,
|
||||
pci_unmap_addr(root, mapping));
|
||||
root = next;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user