Skip to content

Commit 1a470ce

Browse files
Yupeng Lichenhuacai
authored andcommitted
LoongArch: Fix arch_remove_memory() undefined build error
The kernel build error when unslected CONFIG_MEMORY_HOTREMOVE because arch_remove_memory() is needed by mm/memory_hotplug.c but undefined. Some build error messages like: LD vmlinux.o MODPOST vmlinux.symvers MODINFO modules.builtin.modinfo GEN modules.builtin LD .tmp_vmlinux.kallsyms1 loongarch64-linux-gnu-ld: mm/memory_hotplug.o: in function `.L242': memory_hotplug.c:(.ref.text+0x930): undefined reference to `arch_remove_memory' make: *** [Makefile:1169:vmlinux] 错误 1 Removed CONFIG_MEMORY_HOTREMOVE requirement and rearrange the file refer to the definitions of other platform architectures. Signed-off-by: Yupeng Li <liyupeng@zbhlos.com> Signed-off-by: Caicai <caizp2008@163.com> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
1 parent e0fba87 commit 1a470ce

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

arch/loongarch/mm/init.c

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -131,18 +131,6 @@ int arch_add_memory(int nid, u64 start, u64 size, struct mhp_params *params)
131131
return ret;
132132
}
133133

134-
#ifdef CONFIG_NUMA
135-
int memory_add_physaddr_to_nid(u64 start)
136-
{
137-
int nid;
138-
139-
nid = pa_to_nid(start);
140-
return nid;
141-
}
142-
EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid);
143-
#endif
144-
145-
#ifdef CONFIG_MEMORY_HOTREMOVE
146134
void arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)
147135
{
148136
unsigned long start_pfn = start >> PAGE_SHIFT;
@@ -154,6 +142,16 @@ void arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)
154142
page += vmem_altmap_offset(altmap);
155143
__remove_pages(start_pfn, nr_pages, altmap);
156144
}
145+
146+
#ifdef CONFIG_NUMA
147+
int memory_add_physaddr_to_nid(u64 start)
148+
{
149+
int nid;
150+
151+
nid = pa_to_nid(start);
152+
return nid;
153+
}
154+
EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid);
157155
#endif
158156
#endif
159157

0 commit comments

Comments
 (0)