riscv: mm: init: try best to remove #ifdef CONFIG_XIP_KERNEL usage
authorJisheng Zhang <jszhang@kernel.org>
Mon, 6 Dec 2021 15:03:53 +0000 (23:03 +0800)
committerPalmer Dabbelt <palmer@rivosinc.com>
Wed, 19 Jan 2022 17:56:35 +0000 (09:56 -0800)
commit805a3ebed59f81155ded218648db58bdc886a881
tree81f7e1b3778646615a46819c6b0736b9b6e5bc3f
parentfe036db7d8a93cfbfd254f76e0ecf81aecbbf6b4
riscv: mm: init: try best to remove #ifdef CONFIG_XIP_KERNEL usage

Currently, the #ifdef CONFIG_XIP_KERNEL usage can be divided into the
following three types:

The first one is for functions/declarations only used in XIP case.

The second one is for XIP_FIXUP case. Something as below:
|foo_type foo;
|#ifdef CONFIG_XIP_KERNEL
|#define foo    (*(foo_type *)XIP_FIXUP(&foo))
|#endif

Usually, it's better to let the foo macro sit with the foo var
together. But if various foos are defined adjacently, we can
save some #ifdef CONFIG_XIP_KERNEL usage by grouping them together.

The third one is for different implementations for XIP, usually, this
is a #ifdef...#else...#endif case.

This patch moves the pt_ops macro to adjacent #ifdef CONFIG_XIP_KERNEL
and group first type usage cases into one.

Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
Reviewed-by: Alexandre Ghiti <alex@ghiti.fr>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/mm/init.c