of: Change of_machine_is_compatible() to return bool
authorMichael Ellerman <mpe@ellerman.id.au>
Thu, 14 Dec 2023 10:31:49 +0000 (21:31 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Sun, 3 Mar 2024 11:20:29 +0000 (22:20 +1100)
of_machine_is_compatible() currently returns a positive integer if it
finds a match. However none of the callers ever check the value, they
all treat it as a true/false.

So change of_machine_is_compatible() to return bool, which will allow
the implementation to be changed in a subsequent patch.

Suggested-by: Rob Herring <robh@kernel.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20231214103152.12269-2-mpe@ellerman.id.au
drivers/of/base.c
include/linux/of.h

index 3c85afb2697c3f752a5293e2e765278339df2328..faa88eb518a91c4514967349c0f9152a7c4c1e4a 100644 (file)
@@ -419,10 +419,9 @@ 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: A positive integer if the root node has the given value in its
- * compatible property.
+ * Return: true if the root node has the given value in its compatible property.
  */
-int of_machine_is_compatible(const char *compat)
+bool of_machine_is_compatible(const char *compat)
 {
        struct device_node *root;
        int rc = 0;
index e3418babc2032b96c5bcc91be9852271842bcad5..c5c663a7fb7752c9410addf94dcc63c1c8d1db4b 100644 (file)
@@ -402,7 +402,7 @@ 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 int of_machine_is_compatible(const char *compat);
+extern bool of_machine_is_compatible(const char *compat);
 bool of_machine_compatible_match(const char *const *compats);
 
 extern int of_add_property(struct device_node *np, struct property *prop);