diff mbox series

[v1,3/9] powerpc/47x: Split ppc47x machine in two

Message ID ae59e5bec0293b09a1e31690570cd1347b2d6fa6.1676465585.git.christophe.leroy@csgroup.eu (mailing list archive)
State Superseded
Headers show
Series [v1,1/9] powerpc/machdep: Define 'compatible' property in ppc_md and use it | expand

Commit Message

Christophe Leroy Feb. 15, 2023, 12:53 p.m. UTC
This machine matches two compatibles and sets .pci_irq_fixup
on one of them.

Split it into two machines, then the probe function can be dropped.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 arch/powerpc/platforms/44x/ppc476.c | 31 +++++++++++++----------------
 1 file changed, 14 insertions(+), 17 deletions(-)

Comments

Michael Ellerman Feb. 15, 2023, 9:58 p.m. UTC | #1
Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> This machine matches two compatibles and sets .pci_irq_fixup
> on one of them.
>
> Split it into two machines, then the probe function can be dropped.

That will break the machine initcalls that look for ppc47x:

  arch/powerpc/platforms/44x/ppc476.c:machine_device_initcall(ppc47x, ppc47x_device_probe);
  arch/powerpc/platforms/44x/ppc476.c:machine_arch_initcall(ppc47x, ppc47x_get_board_rev);

It still compiles, because of the weak attribute in machine_is(), but
those initcalls will never match and so never run.

cheers
diff mbox series

Patch

diff --git a/arch/powerpc/platforms/44x/ppc476.c b/arch/powerpc/platforms/44x/ppc476.c
index 7c91ac5a5241..f0b411cc7bb7 100644
--- a/arch/powerpc/platforms/44x/ppc476.c
+++ b/arch/powerpc/platforms/44x/ppc476.c
@@ -268,27 +268,24 @@  static void ppc47x_pci_irq_fixup(struct pci_dev *dev)
 	}
 }
 
-/*
- * Called very early, MMU is off, device-tree isn't unflattened
- */
-static int __init ppc47x_probe(void)
-{
-	if (of_machine_is_compatible("ibm,akebono"))
-		return 1;
-
-	if (of_machine_is_compatible("ibm,currituck")) {
-		ppc_md.pci_irq_fixup = ppc47x_pci_irq_fixup;
-		return 1;
-	}
-
-	return 0;
-}
+define_machine(ppc47x_akebono) {
+	.name			= "PowerPC 47x (akebono)",
+	.compatible		= "ibm,akebono",
+	.probe			= ppc47x_probe,
+	.progress		= udbg_progress,
+	.init_IRQ		= ppc47x_init_irq,
+	.setup_arch		= ppc47x_setup_arch,
+	.restart		= ppc4xx_reset_system,
+	.calibrate_decr		= generic_calibrate_decr,
+};
 
-define_machine(ppc47x) {
-	.name			= "PowerPC 47x",
+define_machine(ppc47x_currituck) {
+	.name			= "PowerPC 47x (currituck)",
+	.compatible		= "ibm,currituck",
 	.probe			= ppc47x_probe,
 	.progress		= udbg_progress,
 	.init_IRQ		= ppc47x_init_irq,
+	.pci_irq_fixup		= ppc47x_pci_irq_fixup,
 	.setup_arch		= ppc47x_setup_arch,
 	.restart		= ppc4xx_reset_system,
 	.calibrate_decr		= generic_calibrate_decr,