ARM: Avoid evaluating page_address() multiple times

page_address() is a function call rather than a macro, and so:

	if (page_address(page))
		do_something(page_address(page));

results in two calls to this function.  This is unnecessary; remove
the duplication.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
Russell King 2009-10-25 11:25:50 +00:00
parent 2f0b192633
commit b7dc0b2cfc
1 changed files with 4 additions and 2 deletions

View File

@ -111,6 +111,8 @@ void flush_ptrace_access(struct vm_area_struct *vma, struct page *page,
void __flush_dcache_page(struct address_space *mapping, struct page *page) void __flush_dcache_page(struct address_space *mapping, struct page *page)
{ {
void *addr = page_address(page);
/* /*
* Writeback any data associated with the kernel mapping of this * Writeback any data associated with the kernel mapping of this
* page. This ensures that data in the physical page is mutually * page. This ensures that data in the physical page is mutually
@ -121,9 +123,9 @@ void __flush_dcache_page(struct address_space *mapping, struct page *page)
* kmap_atomic() doesn't set the page virtual address, and * kmap_atomic() doesn't set the page virtual address, and
* kunmap_atomic() takes care of cache flushing already. * kunmap_atomic() takes care of cache flushing already.
*/ */
if (page_address(page)) if (addr)
#endif #endif
__cpuc_flush_dcache_page(page_address(page)); __cpuc_flush_dcache_page(addr);
/* /*
* If this is a page cache page, and we have an aliasing VIPT cache, * If this is a page cache page, and we have an aliasing VIPT cache,