linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/9] powerpc/machdep: Define 'compatible' property in ppc_md and use it
@ 2023-02-15 12:53 Christophe Leroy
  2023-02-15 12:53 ` [PATCH v1 2/9] powerpc/platforms: Use 'compatible' property for simple cases Christophe Leroy
                   ` (8 more replies)
  0 siblings, 9 replies; 11+ messages in thread
From: Christophe Leroy @ 2023-02-15 12:53 UTC (permalink / raw)
  To: Michael Ellerman, Nicholas Piggin; +Cc: linuxppc-dev, linux-kernel

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>
---
v3: New
---
 arch/powerpc/include/asm/machdep.h |  1 +
 arch/powerpc/kernel/setup-common.c | 13 +++++++------
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index 378b8d5836a7..c5dfe5ff923c 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -20,6 +20,7 @@ struct pci_host_bridge;
 
 struct machdep_calls {
 	char		*name;
+	char		*compatible;
 #ifdef CONFIG_PPC64
 #ifdef CONFIG_PM
 	void		(*iommu_restore)(void);
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 9b10e57040c6..d1e205fe72ba 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -626,13 +626,14 @@ static __init void probe_machine(void)
 	for (machine_id = &__machine_desc_start;
 	     machine_id < &__machine_desc_end;
 	     machine_id++) {
-		DBG("  %s ...", machine_id->name);
+		DBG("  %s ...\n", machine_id->name);
+		if (machine_id->compatible && !of_machine_is_compatible(machine_id->compatible))
+			continue;
 		memcpy(&ppc_md, machine_id, sizeof(struct machdep_calls));
-		if (ppc_md.probe()) {
-			DBG(" match !\n");
-			break;
-		}
-		DBG("\n");
+		if (ppc_md.probe && !ppc_md.probe())
+			continue;
+		DBG("   %s match !\n", machine_id->name);
+		break;
 	}
 	/* What can we do if we didn't find ? */
 	if (machine_id >= &__machine_desc_end) {
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-02-15 21:59 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-15 12:53 [PATCH v1 1/9] powerpc/machdep: Define 'compatible' property in ppc_md and use it Christophe Leroy
2023-02-15 12:53 ` [PATCH v1 2/9] powerpc/platforms: Use 'compatible' property for simple cases Christophe Leroy
2023-02-15 12:53 ` [PATCH v1 3/9] powerpc/47x: Split ppc47x machine in two Christophe Leroy
2023-02-15 21:58   ` Michael Ellerman
2023-02-15 12:53 ` [PATCH v1 4/9] powerpc/gamecube|wii : Use machine_device_initcall() Christophe Leroy
2023-02-15 12:53 ` [PATCH v1 5/9] powerpc/85xx: Fix function naming for p1023_rdb platform Christophe Leroy
2023-02-15 12:53 ` [PATCH v1 6/9] powerpc: Make generic_calibrate_decr() the default Christophe Leroy
2023-02-15 12:53 ` [PATCH v1 7/9] powerpc: Add ppc_md_progress() Christophe Leroy
2023-02-15 12:53 ` [PATCH v1 8/9] powerpc: Use ppc_md_progress() Christophe Leroy
2023-02-15 12:53 ` [PATCH v1 9/9] powerpc/85xx: Don't check ppc_md.progress in mpc85xx_cds_setup_arch() Christophe Leroy
2023-02-15 18:44 ` [PATCH v1 1/9] powerpc/machdep: Define 'compatible' property in ppc_md and use it Nathan Lynch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).