diff options
author | Christophe Leroy <christophe.leroy@csgroup.eu> | 2023-12-14 11:31:50 +0100 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2024-03-03 12:20:29 +0100 |
commit | 1ac8205f907517a306b661212496fedce79d7cc5 (patch) | |
tree | 0a5bb5238b154f06be8fcd282c04e8f69d159f27 /drivers/of | |
parent | of: Change of_machine_is_compatible() to return bool (diff) | |
download | linux-1ac8205f907517a306b661212496fedce79d7cc5.tar.xz linux-1ac8205f907517a306b661212496fedce79d7cc5.zip |
of: Reimplement of_machine_is_compatible() using of_machine_compatible_match()
of_machine_compatible_match() works with a table of strings.
of_machine_is_compatible() is a simplier version with only one string.
Re-implement of_machine_is_compatible() by setting a table of strings
with a single string then using of_machine_compatible_match().
Suggested-by: Rob Herring <robh+dt@kernel.org>
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-3-mpe@ellerman.id.au
Diffstat (limited to 'drivers/of')
-rw-r--r-- | drivers/of/base.c | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c index faa88eb518a9..df8d9733b054 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -414,26 +414,7 @@ bool of_machine_compatible_match(const char *const *compats) return rc != 0; } - -/** - * of_machine_is_compatible - Test root of device tree for a given compatible value - * @compat: compatible string to look for in root node's compatible property. - * - * Return: true if the root node has the given value in its compatible property. - */ -bool of_machine_is_compatible(const char *compat) -{ - struct device_node *root; - int rc = 0; - - root = of_find_node_by_path("/"); - if (root) { - rc = of_device_is_compatible(root, compat); - of_node_put(root); - } - return rc; -} -EXPORT_SYMBOL(of_machine_is_compatible); +EXPORT_SYMBOL(of_machine_compatible_match); /** * __of_device_is_available - check if a device is available for use |