summaryrefslogtreecommitdiffstats
path: root/common/block.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-06-21 10:25:29 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2012-06-30 12:46:25 +0200
commit9895357a71205ea7d92d7608bd5ea40cef38e4c1 (patch)
tree13f3c793f57316c3fb2152e2f4ac7dbc8938eda4 /common/block.c
parent9ca0e573af89a5d2ce0bc682633560891275bf71 (diff)
downloadbarebox-9895357a71205ea7d92d7608bd5ea40cef38e4c1.tar.gz
barebox-9895357a71205ea7d92d7608bd5ea40cef38e4c1.tar.xz
block: use dma_alloc to allocate buffers
Drivers may use dma to transfer blocks, so put them into dma save memory. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/block.c')
-rw-r--r--common/block.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/common/block.c b/common/block.c
index 71ecfd5ab7..f3bcdc8181 100644
--- a/common/block.c
+++ b/common/block.c
@@ -24,6 +24,7 @@
#include <malloc.h>
#include <linux/err.h>
#include <linux/list.h>
+#include <dma.h>
#define BLOCKSIZE(blk) (1 << blk->blockbits)
@@ -357,7 +358,7 @@ int blockdevice_register(struct block_device *blk)
for (i = 0; i < 8; i++) {
struct chunk *chunk = xzalloc(sizeof(*chunk));
- chunk->data = xmalloc(BUFSIZE);
+ chunk->data = dma_alloc(BUFSIZE);
chunk->num = i;
list_add_tail(&chunk->list, &blk->idle_blocks);
}
@@ -376,12 +377,12 @@ int blockdevice_unregister(struct block_device *blk)
writebuffer_flush(blk);
list_for_each_entry_safe(chunk, tmp, &blk->buffered_blocks, list) {
- free(chunk->data);
+ dma_free(chunk->data);
free(chunk);
}
list_for_each_entry_safe(chunk, tmp, &blk->idle_blocks, list) {
- free(chunk->data);
+ dma_free(chunk->data);
free(chunk);
}