[PATCH v1 1/4] of: Add of_machine_compatible_match()

Rob Herring robh at kernel.org
Fri Dec 8 07:16:06 AEDT 2023


On Wed, 06 Dec 2023 17:13:32 +0100, Christophe Leroy wrote:
> From: Michael Ellerman <mpe at ellerman.id.au>
> 
> 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: Michael Ellerman <mpe at ellerman.id.au>
> Signed-off-by: Christophe Leroy <christophe.leroy at csgroup.eu>
> ---
>  drivers/of/base.c  | 21 +++++++++++++++++++++
>  include/linux/of.h |  6 ++++++
>  2 files changed, 27 insertions(+)
> 

Reviewed-by: Rob Herring <robh at kernel.org>



More information about the Linuxppc-dev mailing list