[PATCH v1 2/2] kexec: Remove "weak" from arch_kexec_walk_mem() declaration

Bjorn Helgaas helgaas at kernel.org
Thu Apr 12 11:23:43 PDT 2018


From: Bjorn Helgaas <bhelgaas at google.com>

Weak header file declarations are error-prone because they make every
definition weak, and the linker chooses one based on link order (see
10629d711ed7 ("PCI: Remove __weak annotation from pcibios_get_phb_of_node
decl")).

kernel/kexec_file.c contains a weak definition of arch_kexec_walk_mem() and
arch/powerpc/kernel/machine_kexec_file_64.c contains a definition intended
to be non-weak.  But the annotation in the header file makes *both*
definitions weak, so it's unclear which one will be used.

Remove the "weak" attribute from the declaration so we always prefer a
non-weak definition over the weak one.

Fixes: 60fe3910bb02 ("kexec_file: Allow arch-specific memory walking for kexec_add_buffer")
Signed-off-by: Bjorn Helgaas <bhelgaas at google.com>
CC: stable at vger.kernel.org      # v4.10+
---
 include/linux/kexec.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index 8bf0ff90885c..e7db550c5fb6 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -159,8 +159,8 @@ struct kexec_buf {
 	bool top_down;
 };
 
-int __weak arch_kexec_walk_mem(struct kexec_buf *kbuf,
-			       int (*func)(struct resource *, void *));
+int arch_kexec_walk_mem(struct kexec_buf *kbuf,
+			int (*func)(struct resource *, void *));
 extern int kexec_add_buffer(struct kexec_buf *kbuf);
 int kexec_locate_mem_hole(struct kexec_buf *kbuf);
 #endif /* CONFIG_KEXEC_FILE */




More information about the kexec mailing list