.. | .. |
---|
628 | 628 | EXPORT_SYMBOL(of_device_is_available); |
---|
629 | 629 | |
---|
630 | 630 | /** |
---|
| 631 | + * __of_device_is_fail - check if a device has status "fail" or "fail-..." |
---|
| 632 | + * |
---|
| 633 | + * @device: Node to check status for, with locks already held |
---|
| 634 | + * |
---|
| 635 | + * Return: True if the status property is set to "fail" or "fail-..." (for any |
---|
| 636 | + * error code suffix), false otherwise |
---|
| 637 | + */ |
---|
| 638 | +static bool __of_device_is_fail(const struct device_node *device) |
---|
| 639 | +{ |
---|
| 640 | + const char *status; |
---|
| 641 | + |
---|
| 642 | + if (!device) |
---|
| 643 | + return false; |
---|
| 644 | + |
---|
| 645 | + status = __of_get_property(device, "status", NULL); |
---|
| 646 | + if (status == NULL) |
---|
| 647 | + return false; |
---|
| 648 | + |
---|
| 649 | + return !strcmp(status, "fail") || !strncmp(status, "fail-", 5); |
---|
| 650 | +} |
---|
| 651 | + |
---|
| 652 | +/** |
---|
631 | 653 | * of_device_is_big_endian - check if a device has BE registers |
---|
632 | 654 | * |
---|
633 | 655 | * @device: Node to check for endianness |
---|
.. | .. |
---|
775 | 797 | * of_get_next_cpu_node - Iterate on cpu nodes |
---|
776 | 798 | * @prev: previous child of the /cpus node, or NULL to get first |
---|
777 | 799 | * |
---|
| 800 | + * Unusable CPUs (those with the status property set to "fail" or "fail-...") |
---|
| 801 | + * will be skipped. |
---|
| 802 | + * |
---|
778 | 803 | * Returns a cpu node pointer with refcount incremented, use of_node_put() |
---|
779 | 804 | * on it when done. Returns NULL when prev is the last child. Decrements |
---|
780 | 805 | * the refcount of prev. |
---|
.. | .. |
---|
796 | 821 | of_node_put(node); |
---|
797 | 822 | } |
---|
798 | 823 | for (; next; next = next->sibling) { |
---|
| 824 | + if (__of_device_is_fail(next)) |
---|
| 825 | + continue; |
---|
799 | 826 | if (!(of_node_name_eq(next, "cpu") || |
---|
800 | 827 | __of_node_is_type(next, "cpu"))) |
---|
801 | 828 | continue; |
---|