diff options
author | Kevin Cernekee <cernekee@gmail.com> | 2014-11-12 15:54:01 -0500 |
---|---|---|
committer | Grant Likely <grant.likely@linaro.org> | 2014-11-18 12:32:55 -0500 |
commit | 53a4ab96c61a34d62717b1481f6043e0b4338d74 (patch) | |
tree | 080fa624bc76f9d2f8b5816860713f500ae4e748 | |
parent | 25c7a1de6c4b9f9eb867af4dc9215bbf9e08ef2e (diff) |
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: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Grant Likely <grant.likely@linaro.org>
-rw-r--r-- | drivers/of/base.c | 22 | ||||
-rw-r--r-- | include/linux/of.h | 6 |
2 files changed, 14 insertions, 14 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c index 4627e0acf4ad..2d5dfb8b2e65 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c | |||
@@ -522,27 +522,27 @@ EXPORT_SYMBOL(of_machine_is_compatible); | |||
522 | * | 522 | * |
523 | * @device: Node to check for availability, with locks already held | 523 | * @device: Node to check for availability, with locks already held |
524 | * | 524 | * |
525 | * Returns 1 if the status property is absent or set to "okay" or "ok", | 525 | * Returns true if the status property is absent or set to "okay" or "ok", |
526 | * 0 otherwise | 526 | * false otherwise |
527 | */ | 527 | */ |
528 | static int __of_device_is_available(const struct device_node *device) | 528 | static bool __of_device_is_available(const struct device_node *device) |
529 | { | 529 | { |
530 | const char *status; | 530 | const char *status; |
531 | int statlen; | 531 | int statlen; |
532 | 532 | ||
533 | if (!device) | 533 | if (!device) |
534 | return 0; | 534 | return false; |
535 | 535 | ||
536 | status = __of_get_property(device, "status", &statlen); | 536 | status = __of_get_property(device, "status", &statlen); |
537 | if (status == NULL) | 537 | if (status == NULL) |
538 | return 1; | 538 | return true; |
539 | 539 | ||
540 | if (statlen > 0) { | 540 | if (statlen > 0) { |
541 | if (!strcmp(status, "okay") || !strcmp(status, "ok")) | 541 | if (!strcmp(status, "okay") || !strcmp(status, "ok")) |
542 | return 1; | 542 | return true; |
543 | } | 543 | } |
544 | 544 | ||
545 | return 0; | 545 | return false; |
546 | } | 546 | } |
547 | 547 | ||
548 | /** | 548 | /** |
@@ -550,13 +550,13 @@ static int __of_device_is_available(const struct device_node *device) | |||
550 | * | 550 | * |
551 | * @device: Node to check for availability | 551 | * @device: Node to check for availability |
552 | * | 552 | * |
553 | * Returns 1 if the status property is absent or set to "okay" or "ok", | 553 | * Returns true if the status property is absent or set to "okay" or "ok", |
554 | * 0 otherwise | 554 | * false otherwise |
555 | */ | 555 | */ |
556 | int of_device_is_available(const struct device_node *device) | 556 | bool of_device_is_available(const struct device_node *device) |
557 | { | 557 | { |
558 | unsigned long flags; | 558 | unsigned long flags; |
559 | int res; | 559 | bool res; |
560 | 560 | ||
561 | raw_spin_lock_irqsave(&devtree_lock, flags); | 561 | raw_spin_lock_irqsave(&devtree_lock, flags); |
562 | res = __of_device_is_available(device); | 562 | res = __of_device_is_available(device); |
diff --git a/include/linux/of.h b/include/linux/of.h index 3c851a8f23eb..27635c89d8c2 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
@@ -276,7 +276,7 @@ extern int of_property_read_string_helper(struct device_node *np, | |||
276 | const char **out_strs, size_t sz, int index); | 276 | const char **out_strs, size_t sz, int index); |
277 | extern int of_device_is_compatible(const struct device_node *device, | 277 | extern int of_device_is_compatible(const struct device_node *device, |
278 | const char *); | 278 | const char *); |
279 | extern int of_device_is_available(const struct device_node *device); | 279 | extern bool of_device_is_available(const struct device_node *device); |
280 | extern const void *of_get_property(const struct device_node *node, | 280 | extern const void *of_get_property(const struct device_node *node, |
281 | const char *name, | 281 | const char *name, |
282 | int *lenp); | 282 | int *lenp); |
@@ -427,9 +427,9 @@ static inline int of_device_is_compatible(const struct device_node *device, | |||
427 | return 0; | 427 | return 0; |
428 | } | 428 | } |
429 | 429 | ||
430 | static inline int of_device_is_available(const struct device_node *device) | 430 | static inline bool of_device_is_available(const struct device_node *device) |
431 | { | 431 | { |
432 | return 0; | 432 | return false; |
433 | } | 433 | } |
434 | 434 | ||
435 | static inline struct property *of_find_property(const struct device_node *np, | 435 | static inline struct property *of_find_property(const struct device_node *np, |