summaryrefslogtreecommitdiffstats
path: root/arch/blackfin/kernel
diff options
context:
space:
mode:
authorMichael Hennerich <michael.hennerich@analog.com>2009-09-23 11:32:52 +0000
committerMike Frysinger <vapier@gentoo.org>2009-12-15 00:13:51 -0500
commitcb5ae60f7a0b21b936c022a2e7f9303c60665233 (patch)
tree6605a4dec5a881fa4436c36c18f985436b69bd0c /arch/blackfin/kernel
parentddcd7cb857cdf2a29c30125f71cb5d4d6744c99b (diff)
downloadblackbird-op-linux-cb5ae60f7a0b21b936c022a2e7f9303c60665233.tar.gz
blackbird-op-linux-cb5ae60f7a0b21b936c022a2e7f9303c60665233.zip
Blackfin: convert DMA code to a proper bitmap
Rather than using our own data structures that basically boil down to a bitmap, use the standard bitmap functions. Reported-by: Paul Mundt <lethal@linux-sh.org> Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch/blackfin/kernel')
-rw-r--r--arch/blackfin/kernel/dma-mapping.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/arch/blackfin/kernel/dma-mapping.c b/arch/blackfin/kernel/dma-mapping.c
index e74e74d7733f..be81572b89c2 100644
--- a/arch/blackfin/kernel/dma-mapping.c
+++ b/arch/blackfin/kernel/dma-mapping.c
@@ -19,7 +19,7 @@
#include <asm/bfin-global.h>
static spinlock_t dma_page_lock;
-static unsigned int *dma_page;
+static unsigned long *dma_page;
static unsigned int dma_pages;
static unsigned long dma_base;
static unsigned long dma_size;
@@ -30,7 +30,7 @@ void dma_alloc_init(unsigned long start, unsigned long end)
spin_lock_init(&dma_page_lock);
dma_initialized = 0;
- dma_page = (unsigned int *)__get_free_page(GFP_KERNEL);
+ dma_page = (unsigned long *)__get_free_page(GFP_KERNEL);
memset(dma_page, 0, PAGE_SIZE);
dma_base = PAGE_ALIGN(start);
dma_size = PAGE_ALIGN(end) - PAGE_ALIGN(start);
@@ -58,10 +58,11 @@ static unsigned long __alloc_dma_pages(unsigned int pages)
spin_lock_irqsave(&dma_page_lock, flags);
for (i = 0; i < dma_pages;) {
- if (dma_page[i++] == 0) {
+ if (test_bit(i++, dma_page) == 0) {
if (++count == pages) {
while (count--)
- dma_page[--i] = 1;
+ __set_bit(--i, dma_page);
+
ret = dma_base + (i << PAGE_SHIFT);
break;
}
@@ -84,9 +85,9 @@ static void __free_dma_pages(unsigned long addr, unsigned int pages)
}
spin_lock_irqsave(&dma_page_lock, flags);
- for (i = page; i < page + pages; i++) {
- dma_page[i] = 0;
- }
+ for (i = page; i < page + pages; i++)
+ __clear_bit(i, dma_page);
+
spin_unlock_irqrestore(&dma_page_lock, flags);
}
OpenPOWER on IntegriCloud