| From bb2863c33210cf69976a6ac5ac32f14e1af775d5 Mon Sep 17 00:00:00 2001 |
| From: Nathan Chancellor <natechancellor@gmail.com> |
| Date: Mon, 23 Mar 2020 15:27:29 -0700 |
| Subject: [PATCH] powerpc/maple: Fix declaration made after definition |
| |
| commit af6cf95c4d003fccd6c2ecc99a598fb854b537e7 upstream. |
| |
| When building ppc64 defconfig, Clang errors (trimmed for brevity): |
| |
| arch/powerpc/platforms/maple/setup.c:365:1: error: attribute declaration |
| must precede definition [-Werror,-Wignored-attributes] |
| machine_device_initcall(maple, maple_cpc925_edac_setup); |
| ^ |
| |
| machine_device_initcall expands to __define_machine_initcall, which in |
| turn has the macro machine_is used in it, which declares mach_##name |
| with an __attribute__((weak)). define_machine actually defines |
| mach_##name, which in this file happens before the declaration, hence |
| the warning. |
| |
| To fix this, move define_machine after machine_device_initcall so that |
| the declaration occurs before the definition, which matches how |
| machine_device_initcall and define_machine work throughout |
| arch/powerpc. |
| |
| While we're here, remove some spaces before tabs. |
| |
| Fixes: 8f101a051ef0 ("edac: cpc925 MC platform device setup") |
| Reported-by: Nick Desaulniers <ndesaulniers@google.com> |
| Suggested-by: Ilie Halip <ilie.halip@gmail.com> |
| Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> |
| Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> |
| Link: https://lore.kernel.org/r/20200323222729.15365-1-natechancellor@gmail.com |
| Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> |
| |
| diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c |
| index 9cd6f3e1000b..09a0594350b6 100644 |
| --- a/arch/powerpc/platforms/maple/setup.c |
| +++ b/arch/powerpc/platforms/maple/setup.c |
| @@ -294,23 +294,6 @@ static int __init maple_probe(void) |
| return 1; |
| } |
| |
| -define_machine(maple) { |
| - .name = "Maple", |
| - .probe = maple_probe, |
| - .setup_arch = maple_setup_arch, |
| - .init_IRQ = maple_init_IRQ, |
| - .pci_irq_fixup = maple_pci_irq_fixup, |
| - .pci_get_legacy_ide_irq = maple_pci_get_legacy_ide_irq, |
| - .restart = maple_restart, |
| - .halt = maple_halt, |
| - .get_boot_time = maple_get_boot_time, |
| - .set_rtc_time = maple_set_rtc_time, |
| - .get_rtc_time = maple_get_rtc_time, |
| - .calibrate_decr = generic_calibrate_decr, |
| - .progress = maple_progress, |
| - .power_save = power4_idle, |
| -}; |
| - |
| #ifdef CONFIG_EDAC |
| /* |
| * Register a platform device for CPC925 memory controller on |
| @@ -367,3 +350,20 @@ static int __init maple_cpc925_edac_setup(void) |
| } |
| machine_device_initcall(maple, maple_cpc925_edac_setup); |
| #endif |
| + |
| +define_machine(maple) { |
| + .name = "Maple", |
| + .probe = maple_probe, |
| + .setup_arch = maple_setup_arch, |
| + .init_IRQ = maple_init_IRQ, |
| + .pci_irq_fixup = maple_pci_irq_fixup, |
| + .pci_get_legacy_ide_irq = maple_pci_get_legacy_ide_irq, |
| + .restart = maple_restart, |
| + .halt = maple_halt, |
| + .get_boot_time = maple_get_boot_time, |
| + .set_rtc_time = maple_set_rtc_time, |
| + .get_rtc_time = maple_get_rtc_time, |
| + .calibrate_decr = generic_calibrate_decr, |
| + .progress = maple_progress, |
| + .power_save = power4_idle, |
| +}; |
| -- |
| 2.7.4 |
| |