Skip to content

Commit cefdb36

Browse files
committed
of: Change of_machine_is_compatible() to return bool
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
1 parent c029b22 commit cefdb36

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

drivers/of/base.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -419,10 +419,9 @@ bool of_machine_compatible_match(const char *const *compats)
419419
* of_machine_is_compatible - Test root of device tree for a given compatible value
420420
* @compat: compatible string to look for in root node's compatible property.
421421
*
422-
* Return: A positive integer if the root node has the given value in its
423-
* compatible property.
422+
* Return: true if the root node has the given value in its compatible property.
424423
*/
425-
int of_machine_is_compatible(const char *compat)
424+
bool of_machine_is_compatible(const char *compat)
426425
{
427426
struct device_node *root;
428427
int rc = 0;

include/linux/of.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ extern void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align));
402402
extern int of_alias_get_id(struct device_node *np, const char *stem);
403403
extern int of_alias_get_highest_id(const char *stem);
404404

405-
extern int of_machine_is_compatible(const char *compat);
405+
extern bool of_machine_is_compatible(const char *compat);
406406
bool of_machine_compatible_match(const char *const *compats);
407407

408408
extern int of_add_property(struct device_node *np, struct property *prop);

0 commit comments

Comments
 (0)