diff options
author | Magnus Damm <damm@igel.co.jp> | 2008-12-17 17:18:45 +0900 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2008-12-22 18:44:48 +0900 |
commit | da9fdc8b44c421f14a68988ae4d1fb414d5edbf0 (patch) | |
tree | 4136203d0e17012ba2aff4e6ee1568eaf77d72ba /arch/sh | |
parent | 78fb40263f34c65ade1693664db1af168d479588 (diff) | |
download | op-kernel-dev-da9fdc8b44c421f14a68988ae4d1fb414d5edbf0.zip op-kernel-dev-da9fdc8b44c421f14a68988ae4d1fb414d5edbf0.tar.gz |
sh: split coherent pages
Split pages returned by dma_alloc_coherent() and make sure
we free them one by one.
Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh')
-rw-r--r-- | arch/sh/mm/consistent.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c index 9f8ea3a..edcd5fb 100644 --- a/arch/sh/mm/consistent.c +++ b/arch/sh/mm/consistent.c @@ -42,6 +42,8 @@ void *dma_alloc_coherent(struct device *dev, size_t size, return NULL; } + split_page(pfn_to_page(virt_to_phys(ret) >> PAGE_SHIFT), order); + *dma_handle = virt_to_phys(ret); return ret_nocache; } @@ -51,10 +53,13 @@ void dma_free_coherent(struct device *dev, size_t size, void *vaddr, dma_addr_t dma_handle) { int order = get_order(size); + unsigned long pfn = dma_handle >> PAGE_SHIFT; + int k; if (!dma_release_from_coherent(dev, order, vaddr)) { WARN_ON(irqs_disabled()); /* for portability */ - free_pages((unsigned long)phys_to_virt(dma_handle), order); + for (k = 0; k < (1 << order); k++) + __free_pages(pfn_to_page(pfn + k), 0); iounmap(vaddr); } } |