[PATCH 6.1.y-cip 1/2] of: Change of_machine_is_compatible() to return bool

Nobuhiro Iwamatsu <[email protected]>
Newsgroups org.cip-project.lists.cip-dev
Message-ID <1787105577-3655-2-git-send-email-nobuhiro.iwamatsu.x90@mail.toshiba>
From: Michael Ellerman <[email protected]>

commit cefdb366dcbe97908b6055595a15bf7689556bf8 upstream.

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 <[email protected]>
Signed-off-by: Michael Ellerman <[email protected]>
Link: https://msgid.link/[email protected]
Signed-off-by: Nobuhiro Iwamatsu <[email protected]>
---
 drivers/of/base.c  | 5 ++---
 include/linux/of.h | 2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 4d59c155a4cf9..84d00f141210e 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -605,10 +605,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;
diff --git a/include/linux/of.h b/include/linux/of.h
index 30d641eab4761..0e7dcee4d14b0 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -393,7 +393,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);
-- 
2.51.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.