Skip to content

Commit

Permalink
of: Change of_machine_is_compatible() to return bool
Browse files Browse the repository at this point in the history
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]
  • Loading branch information
mpe committed Mar 3, 2024
1 parent c029b22 commit cefdb36
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions drivers/of/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion include/linux/of.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit cefdb36

Please sign in to comment.