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

From: Rob Herring
Date: Thu Dec 07 2023 - 15:16:13 EST



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

Reviewed-by: Rob Herring <robh@xxxxxxxxxx>