Commit 53a4ab96 authored by Kevin Cernekee's avatar Kevin Cernekee Committed by Grant Likely

of: Change of_device_is_available() to return bool

This function can only return true or false; using a bool makes it more
obvious to the reader.
Signed-off-by: default avatarKevin Cernekee <cernekee@gmail.com>
Signed-off-by: default avatarGrant Likely <grant.likely@linaro.org>
parent 25c7a1de
...@@ -522,27 +522,27 @@ EXPORT_SYMBOL(of_machine_is_compatible); ...@@ -522,27 +522,27 @@ EXPORT_SYMBOL(of_machine_is_compatible);
* *
* @device: Node to check for availability, with locks already held * @device: Node to check for availability, with locks already held
* *
* Returns 1 if the status property is absent or set to "okay" or "ok", * Returns true if the status property is absent or set to "okay" or "ok",
* 0 otherwise * false otherwise
*/ */
static int __of_device_is_available(const struct device_node *device) static bool __of_device_is_available(const struct device_node *device)
{ {
const char *status; const char *status;
int statlen; int statlen;
if (!device) if (!device)
return 0; return false;
status = __of_get_property(device, "status", &statlen); status = __of_get_property(device, "status", &statlen);
if (status == NULL) if (status == NULL)
return 1; return true;
if (statlen > 0) { if (statlen > 0) {
if (!strcmp(status, "okay") || !strcmp(status, "ok")) if (!strcmp(status, "okay") || !strcmp(status, "ok"))
return 1; return true;
} }
return 0; return false;
} }
/** /**
...@@ -550,13 +550,13 @@ static int __of_device_is_available(const struct device_node *device) ...@@ -550,13 +550,13 @@ static int __of_device_is_available(const struct device_node *device)
* *
* @device: Node to check for availability * @device: Node to check for availability
* *
* Returns 1 if the status property is absent or set to "okay" or "ok", * Returns true if the status property is absent or set to "okay" or "ok",
* 0 otherwise * false otherwise
*/ */
int of_device_is_available(const struct device_node *device) bool of_device_is_available(const struct device_node *device)
{ {
unsigned long flags; unsigned long flags;
int res; bool res;
raw_spin_lock_irqsave(&devtree_lock, flags); raw_spin_lock_irqsave(&devtree_lock, flags);
res = __of_device_is_available(device); res = __of_device_is_available(device);
......
...@@ -276,7 +276,7 @@ extern int of_property_read_string_helper(struct device_node *np, ...@@ -276,7 +276,7 @@ extern int of_property_read_string_helper(struct device_node *np,
const char **out_strs, size_t sz, int index); const char **out_strs, size_t sz, int index);
extern int of_device_is_compatible(const struct device_node *device, extern int of_device_is_compatible(const struct device_node *device,
const char *); const char *);
extern int of_device_is_available(const struct device_node *device); extern bool of_device_is_available(const struct device_node *device);
extern const void *of_get_property(const struct device_node *node, extern const void *of_get_property(const struct device_node *node,
const char *name, const char *name,
int *lenp); int *lenp);
...@@ -427,9 +427,9 @@ static inline int of_device_is_compatible(const struct device_node *device, ...@@ -427,9 +427,9 @@ static inline int of_device_is_compatible(const struct device_node *device,
return 0; return 0;
} }
static inline int of_device_is_available(const struct device_node *device) static inline bool of_device_is_available(const struct device_node *device)
{ {
return 0; return false;
} }
static inline struct property *of_find_property(const struct device_node *np, static inline struct property *of_find_property(const struct device_node *np,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment