From: Michael Ellerman <mpe@ellerman.id.au>
To: <linuxppc-dev@lists.ozlabs.org>
Cc: robh+dt@kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 2/5] of: Change of_machine_is_compatible() to return bool
Date: Thu, 14 Dec 2023 21:31:49 +1100 [thread overview]
Message-ID: <20231214103152.12269-2-mpe@ellerman.id.au> (raw)
In-Reply-To: <20231214103152.12269-1-mpe@ellerman.id.au>
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>
---
drivers/of/base.c | 5 ++---
include/linux/of.h | 2 +-
2 files changed, 3 insertions(+), 4 deletions(-)
v2: New.
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 9020be2eb4d5..c82c8b77badc 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -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;
diff --git a/include/linux/of.h b/include/linux/of.h
index e3418babc203..c5c663a7fb77 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -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);
--
2.43.0
next prev parent reply other threads:[~2023-12-14 10:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-14 10:31 [PATCH v2 1/5] of: Add of_machine_compatible_match() Michael Ellerman
2023-12-14 10:31 ` Michael Ellerman [this message]
2023-12-14 10:31 ` [PATCH v2 3/5] of: Reimplement of_machine_is_compatible() using of_machine_compatible_match() Michael Ellerman
2023-12-14 10:31 ` [PATCH v2 4/5] powerpc/machdep: Define 'compatibles' property in ppc_md and use it Michael Ellerman
2023-12-14 10:31 ` [PATCH v2 5/5] powerpc: Stop using of_root Michael Ellerman
2024-03-13 13:19 ` [PATCH v2 1/5] of: Add of_machine_compatible_match() Michael Ellerman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231214103152.12269-2-mpe@ellerman.id.au \
--to=mpe@ellerman.id.au \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=robh+dt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).