未验证 提交 fe036db7 编写于 作者: J Jisheng Zhang 提交者: Palmer Dabbelt

riscv: mm: init: try IS_ENABLED(CONFIG_XIP_KERNEL) instead of #ifdef

Try our best to replace the conditional compilation using
"#ifdef CONFIG_XIP_KERNEL" with "IS_ENABLED(CONFIG_XIP_KERNEL)", to
simplify the code and to increase compile coverage.
Signed-off-by: NJisheng Zhang <jszhang@kernel.org>
Reviewed-by: NAlexandre Ghiti <alex@ghiti.fr>
Signed-off-by: NPalmer Dabbelt <palmer@rivosinc.com>
上级 3274a6ef
...@@ -161,13 +161,13 @@ early_param("mem", early_mem); ...@@ -161,13 +161,13 @@ early_param("mem", early_mem);
static void __init setup_bootmem(void) static void __init setup_bootmem(void)
{ {
phys_addr_t vmlinux_end = __pa_symbol(&_end); phys_addr_t vmlinux_end = __pa_symbol(&_end);
phys_addr_t vmlinux_start = __pa_symbol(&_start);
phys_addr_t max_mapped_addr; phys_addr_t max_mapped_addr;
phys_addr_t phys_ram_end; phys_addr_t phys_ram_end, vmlinux_start;
#ifdef CONFIG_XIP_KERNEL if (IS_ENABLED(CONFIG_XIP_KERNEL))
vmlinux_start = __pa_symbol(&_sdata); vmlinux_start = __pa_symbol(&_sdata);
#endif else
vmlinux_start = __pa_symbol(&_start);
memblock_enforce_memory_limit(memory_limit); memblock_enforce_memory_limit(memory_limit);
...@@ -183,11 +183,9 @@ static void __init setup_bootmem(void) ...@@ -183,11 +183,9 @@ static void __init setup_bootmem(void)
*/ */
memblock_reserve(vmlinux_start, vmlinux_end - vmlinux_start); memblock_reserve(vmlinux_start, vmlinux_end - vmlinux_start);
phys_ram_end = memblock_end_of_DRAM(); phys_ram_end = memblock_end_of_DRAM();
#ifndef CONFIG_XIP_KERNEL if (!IS_ENABLED(CONFIG_XIP_KERNEL))
phys_ram_base = memblock_start_of_DRAM(); phys_ram_base = memblock_start_of_DRAM();
#endif
/* /*
* memblock allocator is not aware of the fact that last 4K bytes of * memblock allocator is not aware of the fact that last 4K bytes of
* the addressable memory can not be mapped because of IS_ERR_VALUE * the addressable memory can not be mapped because of IS_ERR_VALUE
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册