diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-11-24 09:41:01 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-02-15 10:22:16 -0500 |
commit | 93f1d629e22b08642eb713ad96ac2cb9ade0641c (patch) | |
tree | ae7738fd783efd7c71e5669cc84f80d1ff521796 /arch/arm/mm/dma-mapping.c | |
parent | 65af191a0414d0e1145f67c153e1b63d122dfbb4 (diff) |
ARM: dma-mapping: simplify dma_cache_maint_page
dma_cache_maint_contiguous is now simple enough to live inside
dma_cache_maint_page, so move it there.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Tested-By: Santosh Shilimkar <santosh.shilimkar@ti.com>
Diffstat (limited to 'arch/arm/mm/dma-mapping.c')
-rw-r--r-- | arch/arm/mm/dma-mapping.c | 42 |
1 files changed, 18 insertions, 24 deletions
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 77dc483e64c1..0d68d2c83cda 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c | |||
@@ -446,24 +446,6 @@ void ___dma_single_dev_to_cpu(const void *kaddr, size_t size, | |||
446 | } | 446 | } |
447 | EXPORT_SYMBOL(___dma_single_dev_to_cpu); | 447 | EXPORT_SYMBOL(___dma_single_dev_to_cpu); |
448 | 448 | ||
449 | static void dma_cache_maint_contiguous(struct page *page, unsigned long offset, | ||
450 | size_t size, void (*op)(const void *, const void *)) | ||
451 | { | ||
452 | void *vaddr; | ||
453 | |||
454 | if (!PageHighMem(page)) { | ||
455 | vaddr = page_address(page) + offset; | ||
456 | op(vaddr, vaddr + size); | ||
457 | } else { | ||
458 | vaddr = kmap_high_get(page); | ||
459 | if (vaddr) { | ||
460 | vaddr += offset; | ||
461 | op(vaddr, vaddr + size); | ||
462 | kunmap_high(page); | ||
463 | } | ||
464 | } | ||
465 | } | ||
466 | |||
467 | static void dma_cache_maint_page(struct page *page, unsigned long offset, | 449 | static void dma_cache_maint_page(struct page *page, unsigned long offset, |
468 | size_t size, void (*op)(const void *, const void *)) | 450 | size_t size, void (*op)(const void *, const void *)) |
469 | { | 451 | { |
@@ -476,14 +458,26 @@ static void dma_cache_maint_page(struct page *page, unsigned long offset, | |||
476 | size_t left = size; | 458 | size_t left = size; |
477 | do { | 459 | do { |
478 | size_t len = left; | 460 | size_t len = left; |
479 | if (PageHighMem(page) && len + offset > PAGE_SIZE) { | 461 | void *vaddr; |
480 | if (offset >= PAGE_SIZE) { | 462 | |
481 | page += offset / PAGE_SIZE; | 463 | if (PageHighMem(page)) { |
482 | offset %= PAGE_SIZE; | 464 | if (len + offset > PAGE_SIZE) { |
465 | if (offset >= PAGE_SIZE) { | ||
466 | page += offset / PAGE_SIZE; | ||
467 | offset %= PAGE_SIZE; | ||
468 | } | ||
469 | len = PAGE_SIZE - offset; | ||
470 | } | ||
471 | vaddr = kmap_high_get(page); | ||
472 | if (vaddr) { | ||
473 | vaddr += offset; | ||
474 | op(vaddr, vaddr + len); | ||
475 | kunmap_high(page); | ||
483 | } | 476 | } |
484 | len = PAGE_SIZE - offset; | 477 | } else { |
478 | vaddr = page_address(page) + offset; | ||
479 | op(vaddr, vaddr + len); | ||
485 | } | 480 | } |
486 | dma_cache_maint_contiguous(page, offset, len, op); | ||
487 | offset = 0; | 481 | offset = 0; |
488 | page++; | 482 | page++; |
489 | left -= len; | 483 | left -= len; |