Skip to content

Commit fe036db

Browse files
xhackerustcpalmer-dabbelt
authored andcommitted
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: Jisheng Zhang <[email protected]> Reviewed-by: Alexandre Ghiti <[email protected]> Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 3274a6e commit fe036db

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

arch/riscv/mm/init.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,13 @@ early_param("mem", early_mem);
161161
static void __init setup_bootmem(void)
162162
{
163163
phys_addr_t vmlinux_end = __pa_symbol(&_end);
164-
phys_addr_t vmlinux_start = __pa_symbol(&_start);
165164
phys_addr_t max_mapped_addr;
166-
phys_addr_t phys_ram_end;
165+
phys_addr_t phys_ram_end, vmlinux_start;
167166

168-
#ifdef CONFIG_XIP_KERNEL
169-
vmlinux_start = __pa_symbol(&_sdata);
170-
#endif
167+
if (IS_ENABLED(CONFIG_XIP_KERNEL))
168+
vmlinux_start = __pa_symbol(&_sdata);
169+
else
170+
vmlinux_start = __pa_symbol(&_start);
171171

172172
memblock_enforce_memory_limit(memory_limit);
173173

@@ -183,11 +183,9 @@ static void __init setup_bootmem(void)
183183
*/
184184
memblock_reserve(vmlinux_start, vmlinux_end - vmlinux_start);
185185

186-
187186
phys_ram_end = memblock_end_of_DRAM();
188-
#ifndef CONFIG_XIP_KERNEL
189-
phys_ram_base = memblock_start_of_DRAM();
190-
#endif
187+
if (!IS_ENABLED(CONFIG_XIP_KERNEL))
188+
phys_ram_base = memblock_start_of_DRAM();
191189
/*
192190
* memblock allocator is not aware of the fact that last 4K bytes of
193191
* the addressable memory can not be mapped because of IS_ERR_VALUE

0 commit comments

Comments
 (0)