diff options
author | Christophe Leroy <christophe.leroy@csgroup.eu> | 2023-12-14 13:31:50 +0300 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2024-03-03 14:20:29 +0300 |
commit | 1ac8205f907517a306b661212496fedce79d7cc5 (patch) | |
tree | 0a5bb5238b154f06be8fcd282c04e8f69d159f27 /include/linux/of.h | |
parent | cefdb366dcbe97908b6055595a15bf7689556bf8 (diff) | |
download | linux-1ac8205f907517a306b661212496fedce79d7cc5.tar.xz |
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 'include/linux/of.h')
-rw-r--r-- | include/linux/of.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/include/linux/of.h b/include/linux/of.h index c5c663a7fb77..03ed4e37ca57 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -402,9 +402,21 @@ extern void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)); extern int of_alias_get_id(struct device_node *np, const char *stem); extern int of_alias_get_highest_id(const char *stem); -extern bool of_machine_is_compatible(const char *compat); bool of_machine_compatible_match(const char *const *compats); +/** + * 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. + */ +static inline bool of_machine_is_compatible(const char *compat) +{ + const char *compats[] = { compat, NULL }; + + return of_machine_compatible_match(compats); +} + extern int of_add_property(struct device_node *np, struct property *prop); extern int of_remove_property(struct device_node *np, struct property *prop); extern int of_update_property(struct device_node *np, struct property *newprop); |