Commit 2fc39acf authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman
Browse files

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: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/6cb9865d916231c38401ba34ad1a98c249fae135.1676711562.git.christophe.leroy@csgroup.eu
parent 35e175bd
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ struct pci_host_bridge;

struct machdep_calls {
	const char	*name;
	const char	*compatible;
#ifdef CONFIG_PPC64
#ifdef CONFIG_PM
	void		(*iommu_restore)(void);
+7 −6
Original line number Diff line number Diff line
@@ -630,14 +630,15 @@ 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");
		if (ppc_md.probe && !ppc_md.probe())
			continue;
		DBG("   %s match !\n", machine_id->name);
		break;
	}
		DBG("\n");
	}
	/* What can we do if we didn't find ? */
	if (machine_id >= &__machine_desc_end) {
		pr_err("No suitable machine description found !\n");