Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/machdep: Define 'compatible' property in ppc_md and use it

Most probe functions do nothing else than checking whether
the machine is compatible to a given string.

Define that string in ppc_md structure and check it directly from
probe_machine() instead of using ppc_md.probe() for that.

Keep checking in ppc_md.probe() only for more complex probing.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/6cb9865d916231c38401ba34ad1a98c249fae135.1676711562.git.christophe.leroy@csgroup.eu

authored by

Christophe Leroy and committed by
Michael Ellerman
2fc39acf 35e175bd

+8 -6
+1
arch/powerpc/include/asm/machdep.h
··· 21 21 22 22 struct machdep_calls { 23 23 const char *name; 24 + const char *compatible; 24 25 #ifdef CONFIG_PPC64 25 26 #ifdef CONFIG_PM 26 27 void (*iommu_restore)(void);
+7 -6
arch/powerpc/kernel/setup-common.c
··· 630 630 for (machine_id = &__machine_desc_start; 631 631 machine_id < &__machine_desc_end; 632 632 machine_id++) { 633 - DBG(" %s ...", machine_id->name); 633 + DBG(" %s ...\n", machine_id->name); 634 + if (machine_id->compatible && !of_machine_is_compatible(machine_id->compatible)) 635 + continue; 634 636 memcpy(&ppc_md, machine_id, sizeof(struct machdep_calls)); 635 - if (ppc_md.probe()) { 636 - DBG(" match !\n"); 637 - break; 638 - } 639 - DBG("\n"); 637 + if (ppc_md.probe && !ppc_md.probe()) 638 + continue; 639 + DBG(" %s match !\n", machine_id->name); 640 + break; 640 641 } 641 642 /* What can we do if we didn't find ? */ 642 643 if (machine_id >= &__machine_desc_end) {