Fix section mismatch warnings From: Satyam Sharma * mce.c: mce_create_device() is marked __cpuinit and hence goes into .init.text when HOTPLUG_CPU=n. However, the hotplug notifier callback function mce_cpu_callback() is not marked __cpuinit therefore goes into .text section unconditionally. This causes reference to .init.text from .text which would cause modpost to warn (bogusly, because a CPU hotplug event can never happen anyway if HOTPLUG_CPU=n). Anyway, let's fix this by marking callback as __cpuinit and the notifier_block as __cpuinitdata. Having done that, mce_remove_device() is only ever called from __cpuinit marked functions so can be marked __cpuinit itself. * mce_amd.c: Has an exactly similar section mismatch as that discussed in previous case. Solve it similarly by marking notifier callback as __cpuinit and notifier_block as __cpuinitdata. This causes a viral effect and allows us to mark a bunch of other functions as __cpuinit also. Signed-off-by: Satyam Sharma Signed-off-by: Andi Kleen --- [ I don't have x86_64 toolchain, but it's still obvious enough to me that the existing code would cause said section mismatch warnings. ] arch/x86_64/kernel/mce.c | 6 +++--- arch/x86_64/kernel/mce_amd.c | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) Index: linux/arch/x86_64/kernel/mce.c =================================================================== --- linux.orig/arch/x86_64/kernel/mce.c +++ linux/arch/x86_64/kernel/mce.c @@ -820,7 +820,7 @@ static __cpuinit int mce_create_device(u return err; } -static void mce_remove_device(unsigned int cpu) +static void __cpuinit mce_remove_device(unsigned int cpu) { int i; @@ -832,7 +832,7 @@ static void mce_remove_device(unsigned i } /* Get notified when a cpu comes on/off. Be hotplug friendly. */ -static int +static int __cpuinit mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) { unsigned int cpu = (unsigned long)hcpu; @@ -850,7 +850,7 @@ mce_cpu_callback(struct notifier_block * return NOTIFY_OK; } -static struct notifier_block mce_cpu_notifier = { +static struct notifier_block mce_cpu_notifier __cpuinitdata = { .notifier_call = mce_cpu_callback, }; Index: linux/arch/x86_64/kernel/mce_amd.c =================================================================== --- linux.orig/arch/x86_64/kernel/mce_amd.c +++ linux/arch/x86_64/kernel/mce_amd.c @@ -570,7 +570,7 @@ out: * of shared sysfs dir/files, and rest of the cores will be symlinked to it. */ -static void deallocate_threshold_block(unsigned int cpu, +static void __cpuinit deallocate_threshold_block(unsigned int cpu, unsigned int bank) { struct threshold_block *pos = NULL; @@ -590,7 +590,7 @@ static void deallocate_threshold_block(u per_cpu(threshold_banks, cpu)[bank]->blocks = NULL; } -static void threshold_remove_bank(unsigned int cpu, int bank) +static void __cpuinit threshold_remove_bank(unsigned int cpu, int bank) { int i = 0; struct threshold_bank *b; @@ -632,7 +632,7 @@ free_out: per_cpu(threshold_banks, cpu)[bank] = NULL; } -static void threshold_remove_device(unsigned int cpu) +static void __cpuinit threshold_remove_device(unsigned int cpu) { unsigned int bank; @@ -644,7 +644,7 @@ static void threshold_remove_device(unsi } /* get notified when a cpu comes on/off */ -static int threshold_cpu_callback(struct notifier_block *nfb, +static int __cpuinit threshold_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) { /* cpu was unsigned int to begin with */ @@ -669,7 +669,7 @@ static int threshold_cpu_callback(struct return NOTIFY_OK; } -static struct notifier_block threshold_cpu_notifier = { +static struct notifier_block threshold_cpu_notifier __cpuinitdata = { .notifier_call = threshold_cpu_callback, };