diff options
author | Aaro Koskinen <aaro.koskinen@iki.fi> | 2012-08-07 08:39:25 -0400 |
---|---|---|
committer | Marek Szyprowski <m.szyprowski@samsung.com> | 2012-08-09 01:46:07 -0400 |
commit | e4ea6918c93b9f59d34e8ca2124b2b64b1afe73b (patch) | |
tree | 11c9dcf2e73344dc118e71804182049333bb1f37 /arch/arm | |
parent | 39f78e70567a07a6fc0d7a4ca9e3331e44dd400d (diff) |
ARM: dma-mapping: fix atomic allocation alignment
The alignment mask is calculated incorrectly. Fixing the calculation
makes strange hangs/lockups disappear during the boot with Amstrad E3
and 3.6-rc1 kernel.
Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mm/dma-mapping.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 334dd79ad5e6..4bdeccd24d93 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c | |||
@@ -423,7 +423,7 @@ static void *__alloc_from_pool(size_t size, struct page **ret_page) | |||
423 | unsigned int pageno; | 423 | unsigned int pageno; |
424 | unsigned long flags; | 424 | unsigned long flags; |
425 | void *ptr = NULL; | 425 | void *ptr = NULL; |
426 | size_t align; | 426 | unsigned long align_mask; |
427 | 427 | ||
428 | if (!pool->vaddr) { | 428 | if (!pool->vaddr) { |
429 | WARN(1, "coherent pool not initialised!\n"); | 429 | WARN(1, "coherent pool not initialised!\n"); |
@@ -435,11 +435,11 @@ static void *__alloc_from_pool(size_t size, struct page **ret_page) | |||
435 | * small, so align them to their order in pages, minimum is a page | 435 | * small, so align them to their order in pages, minimum is a page |
436 | * size. This helps reduce fragmentation of the DMA space. | 436 | * size. This helps reduce fragmentation of the DMA space. |
437 | */ | 437 | */ |
438 | align = PAGE_SIZE << get_order(size); | 438 | align_mask = (1 << get_order(size)) - 1; |
439 | 439 | ||
440 | spin_lock_irqsave(&pool->lock, flags); | 440 | spin_lock_irqsave(&pool->lock, flags); |
441 | pageno = bitmap_find_next_zero_area(pool->bitmap, pool->nr_pages, | 441 | pageno = bitmap_find_next_zero_area(pool->bitmap, pool->nr_pages, |
442 | 0, count, (1 << align) - 1); | 442 | 0, count, align_mask); |
443 | if (pageno < pool->nr_pages) { | 443 | if (pageno < pool->nr_pages) { |
444 | bitmap_set(pool->bitmap, pageno, count); | 444 | bitmap_set(pool->bitmap, pageno, count); |
445 | ptr = pool->vaddr + PAGE_SIZE * pageno; | 445 | ptr = pool->vaddr + PAGE_SIZE * pageno; |