aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-02 22:13:12 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-02 22:13:12 -0400
commitca41cc96b2813221b05af57d0355157924de5a07 (patch)
tree093d4ca55e6dc4f77c7c8486ec47e9e625e84f17 /drivers/base
parent3151367f8778a1789d6f6e6f6c642681b6cd6d64 (diff)
parent461b6f0d3d7d4e556035463b531136b034b7433e (diff)
Merge branch 'for-v3.7' of git://git.linaro.org/people/mszyprowski/linux-dma-mapping
Pull CMA and DMA-mapping updates from Marek Szyprowski: "This time the pull request is rather small, because the further redesign patches were not ready on time. This pull request consists of the patches which extend ARM DMA-mapping subsystem with support for CPU coherent (ACP) DMA busses. The first client of the new version is HighBank SATA driver. The second part of the pull request includes various cleanup for both CMA common code and ARM DMA-mapping subsystem." Fix up trivial add-add conflict due to the "dma-coherent" DT property being added next to the "calxeda,port-phys" property for the Calxeda AHCI controller. * 'for-v3.7' of git://git.linaro.org/people/mszyprowski/linux-dma-mapping: ARM: dma-mapping: Remove unsed var at arm_coherent_iommu_unmap_page ARM: highbank: add coherent DMA setup ARM: kill off arch_is_coherent ARM: add coherent iommu dma ops ARM: add coherent dma ops ARM: dma-mapping: Refrain noisy console message ARM: dma-mapping: Small logical clean up drivers: dma-contiguous: refactor dma_alloc_from_contiguous()
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/dma-contiguous.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/drivers/base/dma-contiguous.c b/drivers/base/dma-contiguous.c
index 34d94c762a1e..9a1469474f55 100644
--- a/drivers/base/dma-contiguous.c
+++ b/drivers/base/dma-contiguous.c
@@ -315,6 +315,7 @@ struct page *dma_alloc_from_contiguous(struct device *dev, int count,
315{ 315{
316 unsigned long mask, pfn, pageno, start = 0; 316 unsigned long mask, pfn, pageno, start = 0;
317 struct cma *cma = dev_get_cma_area(dev); 317 struct cma *cma = dev_get_cma_area(dev);
318 struct page *page = NULL;
318 int ret; 319 int ret;
319 320
320 if (!cma || !cma->count) 321 if (!cma || !cma->count)
@@ -336,18 +337,17 @@ struct page *dma_alloc_from_contiguous(struct device *dev, int count,
336 for (;;) { 337 for (;;) {
337 pageno = bitmap_find_next_zero_area(cma->bitmap, cma->count, 338 pageno = bitmap_find_next_zero_area(cma->bitmap, cma->count,
338 start, count, mask); 339 start, count, mask);
339 if (pageno >= cma->count) { 340 if (pageno >= cma->count)
340 ret = -ENOMEM; 341 break;
341 goto error;
342 }
343 342
344 pfn = cma->base_pfn + pageno; 343 pfn = cma->base_pfn + pageno;
345 ret = alloc_contig_range(pfn, pfn + count, MIGRATE_CMA); 344 ret = alloc_contig_range(pfn, pfn + count, MIGRATE_CMA);
346 if (ret == 0) { 345 if (ret == 0) {
347 bitmap_set(cma->bitmap, pageno, count); 346 bitmap_set(cma->bitmap, pageno, count);
347 page = pfn_to_page(pfn);
348 break; 348 break;
349 } else if (ret != -EBUSY) { 349 } else if (ret != -EBUSY) {
350 goto error; 350 break;
351 } 351 }
352 pr_debug("%s(): memory range at %p is busy, retrying\n", 352 pr_debug("%s(): memory range at %p is busy, retrying\n",
353 __func__, pfn_to_page(pfn)); 353 __func__, pfn_to_page(pfn));
@@ -356,12 +356,8 @@ struct page *dma_alloc_from_contiguous(struct device *dev, int count,
356 } 356 }
357 357
358 mutex_unlock(&cma_mutex); 358 mutex_unlock(&cma_mutex);
359 359 pr_debug("%s(): returned %p\n", __func__, page);
360 pr_debug("%s(): returned %p\n", __func__, pfn_to_page(pfn)); 360 return page;
361 return pfn_to_page(pfn);
362error:
363 mutex_unlock(&cma_mutex);
364 return NULL;
365} 361}
366 362
367/** 363/**