arm64: memory: Rewrite default page_to_virt()/virt_to_page()
authorWill Deacon <will@kernel.org>
Tue, 13 Aug 2019 15:46:11 +0000 (16:46 +0100)
committerWill Deacon <will@kernel.org>
Wed, 14 Aug 2019 12:05:35 +0000 (13:05 +0100)
commit96628f0fb18080a4166fc9eab8f7fd062d860667
treedaa0bed086bd029c26e7e1b0827f11293b74119d
parent577c2b35283fbadcc9ce4b56304ccea3ec8a5ca1
arm64: memory: Rewrite default page_to_virt()/virt_to_page()

The default implementations of page_to_virt() and virt_to_page() are
fairly confusing to read and the former evaluates its 'page' parameter
twice in the macro

Rewrite them so that the computation is expressed as 'base + index' in
both cases and the parameter is always evaluated exactly once.

Tested-by: Steve Capper <steve.capper@arm.com>
Reviewed-by: Steve Capper <steve.capper@arm.com>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/include/asm/memory.h