From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: "Pali Rohár" <pali@kernel.org>,
"Michael Ellerman" <mpe@ellerman.id.au>,
"Nicholas Piggin" <npiggin@gmail.com>
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 02/10] powerpc/machdep: Define 'compatible' property in ppc_md and use it
Date: Sat, 18 Feb 2023 10:15:45 +0100 [thread overview]
Message-ID: <c3334a1e7c5691fbd49daa9167ae4f6dcfe64d21.1676711562.git.christophe.leroy@csgroup.eu> (raw)
In-Reply-To: <6cb9865d916231c38401ba34ad1a98c249fae135.1676711562.git.christophe.leroy@csgroup.eu>
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>
---
v2: Make it const
---
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 41815168a452..4f6e7d7ee388 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -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);
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index e77734e5a127..d2a446216444 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -630,13 +630,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
next prev parent reply other threads:[~2023-02-18 9:16 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-18 9:15 [PATCH v2 01/10] powerpc/machdep: Make machine name const Christophe Leroy
2023-02-18 9:15 ` Christophe Leroy [this message]
2023-02-18 9:15 ` [PATCH v2 03/10] powerpc/platforms: Use 'compatible' property for simple cases Christophe Leroy
2023-02-18 9:15 ` [PATCH v2 04/10] powerpc/47x: Split ppc47x machine in two Christophe Leroy
2023-02-18 9:15 ` [PATCH v2 05/10] powerpc/gamecube|wii : Use machine_device_initcall() Christophe Leroy
2023-02-18 9:15 ` [PATCH v2 06/10] powerpc/85xx: Fix function naming for p1023_rdb platform Christophe Leroy
2023-02-18 9:15 ` [PATCH v2 07/10] powerpc: Make generic_calibrate_decr() the default Christophe Leroy
2023-02-18 9:15 ` [PATCH v2 08/10] powerpc: Add ppc_md_progress() Christophe Leroy
2023-02-18 9:15 ` [PATCH v2 09/10] powerpc: Use ppc_md_progress() Christophe Leroy
2023-02-18 14:54 ` Joe Perches
2023-02-20 0:42 ` Michael Ellerman
2023-02-18 9:15 ` [PATCH v2 10/10] powerpc/85xx: Don't check ppc_md.progress in mpc85xx_cds_setup_arch() Christophe Leroy
2023-03-22 12:25 ` (subset) [PATCH v2 01/10] powerpc/machdep: Make machine name const Michael Ellerman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c3334a1e7c5691fbd49daa9167ae4f6dcfe64d21.1676711562.git.christophe.leroy@csgroup.eu \
--to=christophe.leroy@csgroup.eu \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=pali@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).