of: Add of_machine_compatible_match()
authorMichael Ellerman <mpe@ellerman.id.au>
Thu, 14 Dec 2023 10:31:48 +0000 (21:31 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Sun, 3 Mar 2024 11:20:29 +0000 (22:20 +1100)
commitc029b22f8a98e14988f800d5c0176a9eaec3c8db
tree23c568ae23dfdee7aa0646fdfd89bff9f5e2ef83
parentaf1ebca503f4c5bb9345dd251faaa825431ce972
of: Add of_machine_compatible_match()

We have of_machine_is_compatible() to check if a machine is compatible
with a single compatible string. However some code is able to support
multiple compatible boards, and so wants to check for one of many
compatible strings.

So add of_machine_compatible_match() which takes a NULL terminated
array of compatible strings to check against the root node's
compatible property.

Compared to an open coded match this is slightly more self
documenting, and also avoids the caller needing to juggle the root
node either directly or via of_find_node_by_path().

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20231214103152.12269-1-mpe@ellerman.id.au
drivers/of/base.c
include/linux/of.h