ARM: 7693/1: mm: clean-up in order to reduce to call kmap_high_get()
authorJoonsoo Kim <iamjoonsoo.kim@lge.com>
Fri, 5 Apr 2013 02:16:14 +0000 (03:16 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Wed, 17 Apr 2013 15:55:01 +0000 (16:55 +0100)
In kmap_atomic(), kmap_high_get() is invoked for checking already
mapped area. In __flush_dcache_page() and dma_cache_maint_page(),
we explicitly call kmap_high_get() before kmap_atomic()
when cache_is_vipt(), so kmap_high_get() can be invoked twice.
This is useless operation, so remove one.

v2: change cache_is_vipt() to cache_is_vipt_nonaliasing() in order to
be self-documented

Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mm/dma-mapping.c
arch/arm/mm/flush.c

index c7e3759f16d303c8c989af0a903f768f358c0e4f..b47dd48d8634b14b4c73b1f7e1f0e4fe611ebcf7 100644 (file)
@@ -822,16 +822,17 @@ static void dma_cache_maint_page(struct page *page, unsigned long offset,
                if (PageHighMem(page)) {
                        if (len + offset > PAGE_SIZE)
                                len = PAGE_SIZE - offset;
-                       vaddr = kmap_high_get(page);
-                       if (vaddr) {
-                               vaddr += offset;
-                               op(vaddr, len, dir);
-                               kunmap_high(page);
-                       } else if (cache_is_vipt()) {
-                               /* unmapped pages might still be cached */
+
+                       if (cache_is_vipt_nonaliasing()) {
                                vaddr = kmap_atomic(page);
                                op(vaddr + offset, len, dir);
                                kunmap_atomic(vaddr);
+                       } else {
+                               vaddr = kmap_high_get(page);
+                               if (vaddr) {
+                                       op(vaddr + offset, len, dir);
+                                       kunmap_high(page);
+                               }
                        }
                } else {
                        vaddr = page_address(page) + offset;
index 1c8f7f56417598303cac08ca3baa8353361366ff..0d473cce501c137e8c87c40f9ccb455d6ec275eb 100644 (file)
@@ -170,15 +170,18 @@ void __flush_dcache_page(struct address_space *mapping, struct page *page)
        if (!PageHighMem(page)) {
                __cpuc_flush_dcache_area(page_address(page), PAGE_SIZE);
        } else {
-               void *addr = kmap_high_get(page);
-               if (addr) {
-                       __cpuc_flush_dcache_area(addr, PAGE_SIZE);
-                       kunmap_high(page);
-               } else if (cache_is_vipt()) {
-                       /* unmapped pages might still be cached */
+               void *addr;
+
+               if (cache_is_vipt_nonaliasing()) {
                        addr = kmap_atomic(page);
                        __cpuc_flush_dcache_area(addr, PAGE_SIZE);
                        kunmap_atomic(addr);
+               } else {
+                       addr = kmap_high_get(page);
+                       if (addr) {
+                               __cpuc_flush_dcache_area(addr, PAGE_SIZE);
+                               kunmap_high(page);
+                       }
                }
        }
 
This page took 0.03076 seconds and 5 git commands to generate.