Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 126417
b: refs/heads/master
c: 0bef3c2
h: refs/heads/master
i:
  126415: 1e1056c
v: v3
  • Loading branch information
Andrew Morton authored and Linus Torvalds committed Jan 6, 2009
1 parent 894f305 commit 83c2279
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8375d4909aee4c18798f373ecf24a79f040f75fc
refs/heads/master: 0bef3c2dc7d0c8238330785c8f4504761b0e370b
16 changes: 15 additions & 1 deletion trunk/kernel/dma-coherent.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,25 @@ int dma_alloc_from_coherent(struct device *dev, ssize_t size,
int page = bitmap_find_free_region(mem->bitmap, mem->size,
order);
if (page >= 0) {
/*
* Memory was found in the per-device arena.
*/
*dma_handle = mem->device_base + (page << PAGE_SHIFT);
*ret = mem->virt_base + (page << PAGE_SHIFT);
memset(*ret, 0, size);
} else if (mem->flags & DMA_MEMORY_EXCLUSIVE)
} else if (mem->flags & DMA_MEMORY_EXCLUSIVE) {
/*
* The per-device arena is exhausted and we are not
* permitted to fall back to generic memory.
*/
*ret = NULL;
} else {
/*
* The per-device arena is exhausted and we are
* permitted to fall back to generic memory.
*/
return 0;
}
}
return (mem != NULL);
}
Expand Down

0 comments on commit 83c2279

Please sign in to comment.