Lines Matching +full:prop +full:-

1 // SPDX-License-Identifier: GPL-2.0-or-later
12 fprintf(stderr, "=== %s: ", (c)->name); \
63 struct property *prop, in check_msg() argument
71 if (!(c->warn && (quiet < 1)) && !(c->error && (quiet < 2))) in check_msg()
74 if (prop && prop->srcpos) in check_msg()
75 pos = prop->srcpos; in check_msg()
76 else if (node && node->srcpos) in check_msg()
77 pos = node->srcpos; in check_msg()
83 } else if (streq(dti->outname, "-")) { in check_msg()
86 xasprintf(&str, "%s", dti->outname); in check_msg()
90 (c->error) ? "ERROR" : "Warning", c->name); in check_msg()
93 if (prop) in check_msg()
94 xasprintf_append(&str, "%s:%s: ", node->fullpath, prop->name); in check_msg()
96 xasprintf_append(&str, "%s: ", node->fullpath); in check_msg()
105 if (!prop && pos) { in check_msg()
106 pos = node->srcpos; in check_msg()
107 while (pos->next) { in check_msg()
108 pos = pos->next; in check_msg()
123 (c)->status = FAILED; \
127 #define FAIL_PROP(c, dti, node, prop, ...) \ argument
130 (c)->status = FAILED; \
131 check_msg((c), dti, node, prop, __VA_ARGS__); \
139 TRACE(c, "%s", node->fullpath); in check_nodes_props()
140 if (c->fn) in check_nodes_props()
141 c->fn(c, dti, node); in check_nodes_props()
157 struct node *dt = dti->dt; in run_check()
161 assert(!c->inprogress); in run_check()
163 if (c->status != UNCHECKED) in run_check()
166 c->inprogress = true; in run_check()
168 for (i = 0; i < c->num_prereqs; i++) { in run_check()
169 struct check *prq = c->prereq[i]; in run_check()
171 if (prq->status != PASSED) { in run_check()
172 c->status = PREREQ; in run_check()
174 c->prereq[i]->name); in run_check()
178 if (c->status != UNCHECKED) in run_check()
183 if (c->status == UNCHECKED) in run_check()
184 c->status = PASSED; in run_check()
186 TRACE(c, "\tCompleted, status %d", c->status); in run_check()
189 c->inprogress = false; in run_check()
190 if ((c->status != PASSED) && (c->error)) in run_check()
210 struct property *prop; in check_is_string() local
211 const char *propname = c->data; in check_is_string()
213 prop = get_property(node, propname); in check_is_string()
214 if (!prop) in check_is_string()
217 if (!data_is_one_string(prop->val)) in check_is_string()
218 FAIL_PROP(c, dti, node, prop, "property is not a string"); in check_is_string()
229 struct property *prop; in check_is_string_list() local
230 const char *propname = c->data; in check_is_string_list()
233 prop = get_property(node, propname); in check_is_string_list()
234 if (!prop) in check_is_string_list()
237 str = prop->val.val; in check_is_string_list()
238 rem = prop->val.len; in check_is_string_list()
242 FAIL_PROP(c, dti, node, prop, "property is not a string list"); in check_is_string_list()
245 rem -= l + 1; in check_is_string_list()
257 struct property *prop; in check_is_cell() local
258 const char *propname = c->data; in check_is_cell()
260 prop = get_property(node, propname); in check_is_cell()
261 if (!prop) in check_is_cell()
264 if (prop->val.len != sizeof(cell_t)) in check_is_cell()
265 FAIL_PROP(c, dti, node, prop, "property is not a single cell"); in check_is_cell()
282 for (child2 = child->next_sibling; in check_duplicate_node_names()
284 child2 = child2->next_sibling) in check_duplicate_node_names()
285 if (streq(child->name, child2->name)) in check_duplicate_node_names()
293 struct property *prop, *prop2; in check_duplicate_property_names() local
295 for_each_property(node, prop) { in check_duplicate_property_names()
296 for (prop2 = prop->next; prop2; prop2 = prop2->next) { in check_duplicate_property_names()
297 if (prop2->deleted) in check_duplicate_property_names()
299 if (streq(prop->name, prop2->name)) in check_duplicate_property_names()
300 FAIL_PROP(c, dti, node, prop, "Duplicate property name"); in check_duplicate_property_names()
309 #define NODECHARS LOWERCASE UPPERCASE DIGITS ",._+-@"
310 #define PROPCHARS LOWERCASE UPPERCASE DIGITS ",._+*#?-"
311 #define PROPNODECHARSSTRICT LOWERCASE UPPERCASE DIGITS ",-"
316 size_t n = strspn(node->name, c->data); in check_node_name_chars()
318 if (n < strlen(node->name)) in check_node_name_chars()
320 node->name[n]); in check_node_name_chars()
327 int n = strspn(node->name, c->data); in check_node_name_chars_strict()
329 if (n < node->basenamelen) in check_node_name_chars_strict()
331 node->name[n]); in check_node_name_chars_strict()
347 if (!node->parent) in check_node_name_vs_property_name()
350 if (get_property(node->parent, node->name)) { in check_node_name_vs_property_name()
361 struct property *prop = get_property(node, "reg"); in check_unit_address_vs_reg() local
368 if (!prop) { in check_unit_address_vs_reg()
369 prop = get_property(node, "ranges"); in check_unit_address_vs_reg()
370 if (prop && !prop->val.len) in check_unit_address_vs_reg()
371 prop = NULL; in check_unit_address_vs_reg()
374 if (prop) { in check_unit_address_vs_reg()
387 struct property *prop; in check_property_name_chars() local
389 for_each_property(node, prop) { in check_property_name_chars()
390 size_t n = strspn(prop->name, c->data); in check_property_name_chars()
392 if (n < strlen(prop->name)) in check_property_name_chars()
393 FAIL_PROP(c, dti, node, prop, "Bad character '%c' in property name", in check_property_name_chars()
394 prop->name[n]); in check_property_name_chars()
403 struct property *prop; in check_property_name_chars_strict() local
405 for_each_property(node, prop) { in check_property_name_chars_strict()
406 const char *name = prop->name; in check_property_name_chars_strict()
407 size_t n = strspn(name, c->data); in check_property_name_chars_strict()
409 if (n == strlen(prop->name)) in check_property_name_chars_strict()
420 if (name[n] == '#' && ((n == 0) || (name[n-1] == ','))) { in check_property_name_chars_strict()
422 n = strspn(name, c->data); in check_property_name_chars_strict()
425 FAIL_PROP(c, dti, node, prop, "Character '%c' not recommended in property name", in check_property_name_chars_strict()
432 #define DESCLABEL_ARGS(node,prop,mark) \ argument
434 ((prop) ? "'" : ""), \
435 ((prop) ? (prop)->name : ""), \
436 ((prop) ? "' in " : ""), (node)->fullpath
440 struct property *prop, struct marker *mark) in check_duplicate_label() argument
442 struct node *dt = dti->dt; in check_duplicate_label()
458 if ((othernode != node) || (otherprop != prop) || (othermark != mark)) in check_duplicate_label()
461 label, DESCLABEL_ARGS(node, prop, mark), in check_duplicate_label()
469 struct property *prop; in check_duplicate_label_node() local
471 for_each_label(node->labels, l) in check_duplicate_label_node()
472 check_duplicate_label(c, dti, l->label, node, NULL, NULL); in check_duplicate_label_node()
474 for_each_property(node, prop) { in check_duplicate_label_node()
475 struct marker *m = prop->val.markers; in check_duplicate_label_node()
477 for_each_label(prop->labels, l) in check_duplicate_label_node()
478 check_duplicate_label(c, dti, l->label, node, prop, NULL); in check_duplicate_label_node()
481 check_duplicate_label(c, dti, m->ref, node, prop, m); in check_duplicate_label_node()
489 struct node *root = dti->dt; in check_phandle_prop()
490 struct property *prop; in check_phandle_prop() local
494 prop = get_property(node, propname); in check_phandle_prop()
495 if (!prop) in check_phandle_prop()
498 if (prop->val.len != sizeof(cell_t)) { in check_phandle_prop()
499 FAIL_PROP(c, dti, node, prop, "bad length (%d) %s property", in check_phandle_prop()
500 prop->val.len, prop->name); in check_phandle_prop()
504 m = prop->val.markers; in check_phandle_prop()
506 assert(m->offset == 0); in check_phandle_prop()
507 if (node != get_node_by_ref(root, m->ref)) in check_phandle_prop()
512 prop->name); in check_phandle_prop()
515 * phandle is allowed - that means allocate a unique in check_phandle_prop()
522 phandle = propval_cell(prop); in check_phandle_prop()
525 FAIL_PROP(c, dti, node, prop, "bad value (0x%x) in %s property", in check_phandle_prop()
526 phandle, prop->name); in check_phandle_prop()
536 struct node *root = dti->dt; in check_explicit_phandles()
541 assert(!node->phandle); in check_explicit_phandles()
561 phandle, other->fullpath); in check_explicit_phandles()
565 node->phandle = phandle; in check_explicit_phandles()
572 struct property **pp, *prop = NULL; in check_name_properties() local
574 for (pp = &node->proplist; *pp; pp = &((*pp)->next)) in check_name_properties()
575 if (streq((*pp)->name, "name")) { in check_name_properties()
576 prop = *pp; in check_name_properties()
580 if (!prop) in check_name_properties()
583 if ((prop->val.len != node->basenamelen + 1U) in check_name_properties()
584 || (memcmp(prop->val.val, node->name, node->basenamelen) != 0)) { in check_name_properties()
586 " of base node name)", prop->val.val); in check_name_properties()
590 *pp = prop->next; in check_name_properties()
591 free(prop->name); in check_name_properties()
592 data_free(prop->val); in check_name_properties()
593 free(prop); in check_name_properties()
606 struct node *dt = dti->dt; in fixup_phandle_references()
607 struct property *prop; in fixup_phandle_references() local
609 for_each_property(node, prop) { in fixup_phandle_references()
610 struct marker *m = prop->val.markers; in fixup_phandle_references()
615 assert(m->offset + sizeof(cell_t) <= prop->val.len); in fixup_phandle_references()
617 refnode = get_node_by_ref(dt, m->ref); in fixup_phandle_references()
619 if (!(dti->dtsflags & DTSF_PLUGIN)) in fixup_phandle_references()
620 FAIL(c, dti, node, "Reference to non-existent node or " in fixup_phandle_references()
621 "label \"%s\"\n", m->ref); in fixup_phandle_references()
623 *((fdt32_t *)(prop->val.val + m->offset)) = in fixup_phandle_references()
629 *((fdt32_t *)(prop->val.val + m->offset)) = cpu_to_fdt32(phandle); in fixup_phandle_references()
641 struct node *dt = dti->dt; in fixup_path_references()
642 struct property *prop; in fixup_path_references() local
644 for_each_property(node, prop) { in fixup_path_references()
645 struct marker *m = prop->val.markers; in fixup_path_references()
650 assert(m->offset <= prop->val.len); in fixup_path_references()
652 refnode = get_node_by_ref(dt, m->ref); in fixup_path_references()
654 FAIL(c, dti, node, "Reference to non-existent node or label \"%s\"\n", in fixup_path_references()
655 m->ref); in fixup_path_references()
659 path = refnode->fullpath; in fixup_path_references()
660 prop->val = data_insert_at_marker(prop->val, m, path, in fixup_path_references()
672 if (generate_symbols && node->labels) in fixup_omit_unused_nodes()
674 if (node->omit_if_unused && !node->is_referenced) in fixup_omit_unused_nodes()
682 WARNING_IF_NOT_CELL(address_cells_is_cell, "#address-cells");
683 WARNING_IF_NOT_CELL(size_cells_is_cell, "#size-cells");
695 struct property *prop; in check_names_is_string_list() local
697 for_each_property(node, prop) { in check_names_is_string_list()
698 if (!strends(prop->name, "-names")) in check_names_is_string_list()
701 c->data = prop->name; in check_names_is_string_list()
710 struct property *prop; in check_alias_paths() local
712 if (!streq(node->name, "aliases")) in check_alias_paths()
715 for_each_property(node, prop) { in check_alias_paths()
716 if (streq(prop->name, "phandle") in check_alias_paths()
717 || streq(prop->name, "linux,phandle")) { in check_alias_paths()
721 if (!prop->val.val || !get_node_by_path(dti->dt, prop->val.val)) { in check_alias_paths()
722 FAIL_PROP(c, dti, node, prop, "aliases property is not a valid node (%s)", in check_alias_paths()
723 prop->val.val); in check_alias_paths()
726 if (strspn(prop->name, LOWERCASE DIGITS "-") != strlen(prop->name)) in check_alias_paths()
727 FAIL(c, dti, node, "aliases property name must include only lowercase and '-'"); in check_alias_paths()
735 struct property *prop; in fixup_addr_size_cells() local
737 node->addr_cells = -1; in fixup_addr_size_cells()
738 node->size_cells = -1; in fixup_addr_size_cells()
740 prop = get_property(node, "#address-cells"); in fixup_addr_size_cells()
741 if (prop) in fixup_addr_size_cells()
742 node->addr_cells = propval_cell(prop); in fixup_addr_size_cells()
744 prop = get_property(node, "#size-cells"); in fixup_addr_size_cells()
745 if (prop) in fixup_addr_size_cells()
746 node->size_cells = propval_cell(prop); in fixup_addr_size_cells()
752 (((n)->addr_cells == -1) ? 2 : (n)->addr_cells)
754 (((n)->size_cells == -1) ? 1 : (n)->size_cells)
759 struct property *prop; in check_reg_format() local
762 prop = get_property(node, "reg"); in check_reg_format()
763 if (!prop) in check_reg_format()
766 if (!node->parent) { in check_reg_format()
771 if (prop->val.len == 0) in check_reg_format()
772 FAIL_PROP(c, dti, node, prop, "property is empty"); in check_reg_format()
774 addr_cells = node_addr_cells(node->parent); in check_reg_format()
775 size_cells = node_size_cells(node->parent); in check_reg_format()
778 if (!is_multiple_of(prop->val.len, entrylen)) in check_reg_format()
779 FAIL_PROP(c, dti, node, prop, "property has invalid length (%d bytes) " in check_reg_format()
780 "(#address-cells == %d, #size-cells == %d)", in check_reg_format()
781 prop->val.len, addr_cells, size_cells); in check_reg_format()
788 struct property *prop; in check_ranges_format() local
790 const char *ranges = c->data; in check_ranges_format()
792 prop = get_property(node, ranges); in check_ranges_format()
793 if (!prop) in check_ranges_format()
796 if (!node->parent) { in check_ranges_format()
797 FAIL_PROP(c, dti, node, prop, "Root node has a \"%s\" property", in check_ranges_format()
802 p_addr_cells = node_addr_cells(node->parent); in check_ranges_format()
803 p_size_cells = node_size_cells(node->parent); in check_ranges_format()
808 if (prop->val.len == 0) { in check_ranges_format()
810 FAIL_PROP(c, dti, node, prop, "empty \"%s\" property but its " in check_ranges_format()
811 "#address-cells (%d) differs from %s (%d)", in check_ranges_format()
812 ranges, c_addr_cells, node->parent->fullpath, in check_ranges_format()
815 FAIL_PROP(c, dti, node, prop, "empty \"%s\" property but its " in check_ranges_format()
816 "#size-cells (%d) differs from %s (%d)", in check_ranges_format()
817 ranges, c_size_cells, node->parent->fullpath, in check_ranges_format()
819 } else if (!is_multiple_of(prop->val.len, entrylen)) { in check_ranges_format()
820 FAIL_PROP(c, dti, node, prop, "\"%s\" property has invalid length (%d bytes) " in check_ranges_format()
821 "(parent #address-cells == %d, child #address-cells == %d, " in check_ranges_format()
822 "#size-cells == %d)", ranges, prop->val.len, in check_ranges_format()
827 WARNING(dma_ranges_format, check_ranges_format, "dma-ranges", &addr_size_cells);
835 struct property *prop; in check_pci_bridge() local
838 prop = get_property(node, "device_type"); in check_pci_bridge()
839 if (!prop || !streq(prop->val.val, "pci")) in check_pci_bridge()
842 node->bus = &pci_bus; in check_pci_bridge()
844 if (!strprefixeq(node->name, node->basenamelen, "pci") && in check_pci_bridge()
845 !strprefixeq(node->name, node->basenamelen, "pcie")) in check_pci_bridge()
848 prop = get_property(node, "ranges"); in check_pci_bridge()
849 if (!prop) in check_pci_bridge()
853 FAIL(c, dti, node, "incorrect #address-cells for PCI bridge"); in check_pci_bridge()
855 FAIL(c, dti, node, "incorrect #size-cells for PCI bridge"); in check_pci_bridge()
857 prop = get_property(node, "bus-range"); in check_pci_bridge()
858 if (!prop) in check_pci_bridge()
861 if (prop->val.len != (sizeof(cell_t) * 2)) { in check_pci_bridge()
862 FAIL_PROP(c, dti, node, prop, "value must be 2 cells"); in check_pci_bridge()
865 cells = (cell_t *)prop->val.val; in check_pci_bridge()
867 FAIL_PROP(c, dti, node, prop, "1st cell must be less than or equal to 2nd cell"); in check_pci_bridge()
869 FAIL_PROP(c, dti, node, prop, "maximum bus number must be less than 256"); in check_pci_bridge()
876 struct property *prop; in check_pci_device_bus_num() local
880 if (!node->parent || (node->parent->bus != &pci_bus)) in check_pci_device_bus_num()
883 prop = get_property(node, "reg"); in check_pci_device_bus_num()
884 if (!prop) in check_pci_device_bus_num()
887 cells = (cell_t *)prop->val.val; in check_pci_device_bus_num()
890 prop = get_property(node->parent, "bus-range"); in check_pci_device_bus_num()
891 if (!prop) { in check_pci_device_bus_num()
894 cells = (cell_t *)prop->val.val; in check_pci_device_bus_num()
899 FAIL_PROP(c, dti, node, prop, "PCI bus number %d out of range, expected (%d - %d)", in check_pci_device_bus_num()
906 struct property *prop; in check_pci_device_reg() local
912 if (!node->parent || (node->parent->bus != &pci_bus)) in check_pci_device_reg()
915 prop = get_property(node, "reg"); in check_pci_device_reg()
916 if (!prop) in check_pci_device_reg()
919 cells = (cell_t *)prop->val.val; in check_pci_device_reg()
921 FAIL_PROP(c, dti, node, prop, "PCI reg config space address cells 2 and 3 must be 0"); in check_pci_device_reg()
928 FAIL_PROP(c, dti, node, prop, "PCI reg address is not configuration space"); in check_pci_device_reg()
930 FAIL_PROP(c, dti, node, prop, "PCI reg config space address register number must be 0"); in check_pci_device_reg()
948 .name = "simple-bus",
953 struct property *prop; in node_is_compatible() local
956 prop = get_property(node, "compatible"); in node_is_compatible()
957 if (!prop) in node_is_compatible()
960 for (str = prop->val.val, end = str + prop->val.len; str < end; in node_is_compatible()
961 str += strnlen(str, end - str) + 1) { in node_is_compatible()
970 if (node_is_compatible(node, "simple-bus")) in check_simple_bus_bridge()
971 node->bus = &simple_bus; in check_simple_bus_bridge()
978 struct property *prop; in check_simple_bus_reg() local
985 if (!node->parent || (node->parent->bus != &simple_bus)) in check_simple_bus_reg()
988 prop = get_property(node, "reg"); in check_simple_bus_reg()
989 if (prop) in check_simple_bus_reg()
990 cells = (cell_t *)prop->val.val; in check_simple_bus_reg()
992 prop = get_property(node, "ranges"); in check_simple_bus_reg()
993 if (prop && prop->val.len) in check_simple_bus_reg()
995 cells = ((cell_t *)prop->val.val) + node_addr_cells(node); in check_simple_bus_reg()
999 if (node->parent->parent && !(node->bus == &simple_bus)) in check_simple_bus_reg()
1004 size = node_addr_cells(node->parent); in check_simple_bus_reg()
1005 while (size--) in check_simple_bus_reg()
1010 FAIL(c, dti, node, "simple-bus unit address format error, expected \"%s\"", in check_simple_bus_reg()
1016 .name = "i2c-bus",
1021 if (strprefixeq(node->name, node->basenamelen, "i2c-bus") || in check_i2c_bus_bridge()
1022 strprefixeq(node->name, node->basenamelen, "i2c-arb")) { in check_i2c_bus_bridge()
1023 node->bus = &i2c_bus; in check_i2c_bus_bridge()
1024 } else if (strprefixeq(node->name, node->basenamelen, "i2c")) { in check_i2c_bus_bridge()
1027 if (strprefixeq(child->name, node->basenamelen, "i2c-bus")) in check_i2c_bus_bridge()
1030 node->bus = &i2c_bus; in check_i2c_bus_bridge()
1034 if (!node->children) in check_i2c_bus_bridge()
1038 FAIL(c, dti, node, "incorrect #address-cells for I2C bus"); in check_i2c_bus_bridge()
1040 FAIL(c, dti, node, "incorrect #size-cells for I2C bus"); in check_i2c_bus_bridge()
1050 struct property *prop; in check_i2c_bus_reg() local
1057 if (!node->parent || (node->parent->bus != &i2c_bus)) in check_i2c_bus_reg()
1060 prop = get_property(node, "reg"); in check_i2c_bus_reg()
1061 if (prop) in check_i2c_bus_reg()
1062 cells = (cell_t *)prop->val.val; in check_i2c_bus_reg()
1077 for (len = prop->val.len; len > 0; len -= 4) { in check_i2c_bus_reg()
1084 FAIL_PROP(c, dti, node, prop, "I2C address must be less than 10-bits, got \"0x%x\"", in check_i2c_bus_reg()
1087 …FAIL_PROP(c, dti, node, prop, "I2C address must be less than 7-bits, got \"0x%x\". Set I2C_TEN_BIT… in check_i2c_bus_reg()
1094 .name = "spi-bus",
1101 if (strprefixeq(node->name, node->basenamelen, "spi")) { in check_spi_bus_bridge()
1102 node->bus = &spi_bus; in check_spi_bus_bridge()
1111 struct property *prop; in check_spi_bus_bridge() local
1112 for_each_property(child, prop) { in check_spi_bus_bridge()
1113 if (strstarts(prop->name, "spi-")) { in check_spi_bus_bridge()
1114 node->bus = &spi_bus; in check_spi_bus_bridge()
1118 if (node->bus == &spi_bus) in check_spi_bus_bridge()
1122 if (node->bus == &spi_bus && get_property(node, "reg")) in check_spi_bus_bridge()
1125 if (node->bus != &spi_bus || !node->children) in check_spi_bus_bridge()
1128 if (get_property(node, "spi-slave")) in check_spi_bus_bridge()
1131 FAIL(c, dti, node, "incorrect #address-cells for SPI bus"); in check_spi_bus_bridge()
1133 FAIL(c, dti, node, "incorrect #size-cells for SPI bus"); in check_spi_bus_bridge()
1140 struct property *prop; in check_spi_bus_reg() local
1146 if (!node->parent || (node->parent->bus != &spi_bus)) in check_spi_bus_reg()
1149 if (get_property(node->parent, "spi-slave")) in check_spi_bus_reg()
1152 prop = get_property(node, "reg"); in check_spi_bus_reg()
1153 if (prop) in check_spi_bus_reg()
1154 cells = (cell_t *)prop->val.val; in check_spi_bus_reg()
1174 if (node->parent && node->parent->bus) in check_unit_address_format()
1199 if (!node->parent) in check_avoid_default_addr_size()
1208 if (node->parent->addr_cells == -1) in check_avoid_default_addr_size()
1209 FAIL(c, dti, node, "Relying on default #address-cells value"); in check_avoid_default_addr_size()
1211 if (node->parent->size_cells == -1) in check_avoid_default_addr_size()
1212 FAIL(c, dti, node, "Relying on default #size-cells value"); in check_avoid_default_addr_size()
1220 struct property *prop; in check_avoid_unnecessary_addr_size() local
1224 if (!node->parent || node->addr_cells < 0 || node->size_cells < 0) in check_avoid_unnecessary_addr_size()
1227 if (get_property(node, "ranges") || get_property(node, "dma-ranges") || !node->children) in check_avoid_unnecessary_addr_size()
1231 prop = get_property(child, "reg"); in check_avoid_unnecessary_addr_size()
1232 if (prop) in check_avoid_unnecessary_addr_size()
1237 …FAIL(c, dti, node, "unnecessary #address-cells/#size-cells without \"ranges\", \"dma-ranges\" or c… in check_avoid_unnecessary_addr_size()
1243 struct property *prop; in node_is_disabled() local
1245 prop = get_property(node, "status"); in node_is_disabled()
1246 if (prop) { in node_is_disabled()
1247 char *str = prop->val.val; in node_is_disabled()
1262 if (node->addr_cells < 0 || node->size_cells < 0) in check_unique_unit_address_common()
1265 if (!node->children) in check_unique_unit_address_common()
1287 FAIL(c, dti, childb, "duplicate unit-address (also used in node %s)", childa->fullpath); in check_unique_unit_address_common()
1311 struct node *dt = dti->dt; in check_obsolete_chosen_interrupt_controller()
1313 struct property *prop; in check_obsolete_chosen_interrupt_controller() local
1323 prop = get_property(chosen, "interrupt-controller"); in check_obsolete_chosen_interrupt_controller()
1324 if (prop) in check_obsolete_chosen_interrupt_controller()
1325 FAIL_PROP(c, dti, node, prop, in check_obsolete_chosen_interrupt_controller()
1326 "/chosen has obsolete \"interrupt-controller\" property"); in check_obsolete_chosen_interrupt_controller()
1334 if (!streq(node->name, "chosen")) in check_chosen_node_is_root()
1337 if (node->parent != dti->dt) in check_chosen_node_is_root()
1345 struct property *prop; in check_chosen_node_bootargs() local
1347 if (!streq(node->name, "chosen")) in check_chosen_node_bootargs()
1350 prop = get_property(node, "bootargs"); in check_chosen_node_bootargs()
1351 if (!prop) in check_chosen_node_bootargs()
1354 c->data = prop->name; in check_chosen_node_bootargs()
1362 struct property *prop; in check_chosen_node_stdout_path() local
1364 if (!streq(node->name, "chosen")) in check_chosen_node_stdout_path()
1367 prop = get_property(node, "stdout-path"); in check_chosen_node_stdout_path()
1368 if (!prop) { in check_chosen_node_stdout_path()
1369 prop = get_property(node, "linux,stdout-path"); in check_chosen_node_stdout_path()
1370 if (!prop) in check_chosen_node_stdout_path()
1372 FAIL_PROP(c, dti, node, prop, "Use 'stdout-path' instead"); in check_chosen_node_stdout_path()
1375 c->data = prop->name; in check_chosen_node_stdout_path()
1389 struct property *prop, in check_property_phandle_args() argument
1392 struct node *root = dti->dt; in check_property_phandle_args()
1395 if (!is_multiple_of(prop->val.len, sizeof(cell_t))) { in check_property_phandle_args()
1396 FAIL_PROP(c, dti, node, prop, in check_property_phandle_args()
1398 prop->val.len, sizeof(cell_t)); in check_property_phandle_args()
1402 for (cell = 0; cell < prop->val.len / sizeof(cell_t); cell += cellsize + 1) { in check_property_phandle_args()
1408 phandle = propval_cell_n(prop, cell); in check_property_phandle_args()
1410 * Some bindings use a cell value 0 or -1 to skip over optional in check_property_phandle_args()
1415 if (dti->dtsflags & DTSF_PLUGIN) in check_property_phandle_args()
1423 if (prop->val.markers) { in check_property_phandle_args()
1424 struct marker *m = prop->val.markers; in check_property_phandle_args()
1426 if (m->offset == (cell * sizeof(cell_t))) in check_property_phandle_args()
1430 FAIL_PROP(c, dti, node, prop, in check_property_phandle_args()
1437 FAIL_PROP(c, dti, node, prop, in check_property_phandle_args()
1443 cellprop = get_property(provider_node, provider->cell_name); in check_property_phandle_args()
1446 } else if (provider->optional) { in check_property_phandle_args()
1450 provider->cell_name, in check_property_phandle_args()
1451 provider_node->fullpath, in check_property_phandle_args()
1452 prop->name, cell); in check_property_phandle_args()
1457 if ((expected <= cell) || prop->val.len < expected) { in check_property_phandle_args()
1458 FAIL_PROP(c, dti, node, prop, in check_property_phandle_args()
1460 prop->val.len, cellsize); in check_property_phandle_args()
1470 const struct provider *provider = c->data; in check_provider_cells_property()
1471 struct property *prop; in check_provider_cells_property() local
1473 prop = get_property(node, provider->prop_name); in check_provider_cells_property()
1474 if (!prop) in check_provider_cells_property()
1477 check_property_phandle_args(c, dti, node, prop, provider); in check_provider_cells_property()
1484 WARNING_PROPERTY_PHANDLE_CELLS(clocks, "clocks", "#clock-cells");
1485 WARNING_PROPERTY_PHANDLE_CELLS(cooling_device, "cooling-device", "#cooling-cells");
1486 WARNING_PROPERTY_PHANDLE_CELLS(dmas, "dmas", "#dma-cells");
1487 WARNING_PROPERTY_PHANDLE_CELLS(hwlocks, "hwlocks", "#hwlock-cells");
1488 WARNING_PROPERTY_PHANDLE_CELLS(interrupts_extended, "interrupts-extended", "#interrupt-cells");
1489 WARNING_PROPERTY_PHANDLE_CELLS(io_channels, "io-channels", "#io-channel-cells");
1490 WARNING_PROPERTY_PHANDLE_CELLS(iommus, "iommus", "#iommu-cells");
1491 WARNING_PROPERTY_PHANDLE_CELLS(mboxes, "mboxes", "#mbox-cells");
1492 WARNING_PROPERTY_PHANDLE_CELLS(msi_parent, "msi-parent", "#msi-cells", true);
1493 WARNING_PROPERTY_PHANDLE_CELLS(mux_controls, "mux-controls", "#mux-control-cells");
1494 WARNING_PROPERTY_PHANDLE_CELLS(phys, "phys", "#phy-cells");
1495 WARNING_PROPERTY_PHANDLE_CELLS(power_domains, "power-domains", "#power-domain-cells");
1496 WARNING_PROPERTY_PHANDLE_CELLS(pwms, "pwms", "#pwm-cells");
1497 WARNING_PROPERTY_PHANDLE_CELLS(resets, "resets", "#reset-cells");
1498 WARNING_PROPERTY_PHANDLE_CELLS(sound_dai, "sound-dai", "#sound-dai-cells");
1499 WARNING_PROPERTY_PHANDLE_CELLS(thermal_sensors, "thermal-sensors", "#thermal-sensor-cells");
1501 static bool prop_is_gpio(struct property *prop) in prop_is_gpio() argument
1504 * *-gpios and *-gpio can appear in property names, in prop_is_gpio()
1507 if (strends(prop->name, ",nr-gpios")) in prop_is_gpio()
1510 return strends(prop->name, "-gpios") || in prop_is_gpio()
1511 streq(prop->name, "gpios") || in prop_is_gpio()
1512 strends(prop->name, "-gpio") || in prop_is_gpio()
1513 streq(prop->name, "gpio"); in prop_is_gpio()
1520 struct property *prop; in check_gpios_property() local
1523 if (get_property(node, "gpio-hog")) in check_gpios_property()
1526 for_each_property(node, prop) { in check_gpios_property()
1529 if (!prop_is_gpio(prop)) in check_gpios_property()
1532 provider.prop_name = prop->name; in check_gpios_property()
1533 provider.cell_name = "#gpio-cells"; in check_gpios_property()
1535 check_property_phandle_args(c, dti, node, prop, &provider); in check_gpios_property()
1545 struct property *prop; in check_deprecated_gpio_property() local
1547 for_each_property(node, prop) { in check_deprecated_gpio_property()
1548 if (!prop_is_gpio(prop)) in check_deprecated_gpio_property()
1551 if (!strends(prop->name, "gpio")) in check_deprecated_gpio_property()
1554 FAIL_PROP(c, dti, node, prop, in check_deprecated_gpio_property()
1555 "'[*-]gpio' is deprecated, use '[*-]gpios' instead"); in check_deprecated_gpio_property()
1563 struct property *prop; in node_is_interrupt_provider() local
1565 prop = get_property(node, "interrupt-controller"); in node_is_interrupt_provider()
1566 if (prop) in node_is_interrupt_provider()
1569 prop = get_property(node, "interrupt-map"); in node_is_interrupt_provider()
1570 if (prop) in node_is_interrupt_provider()
1580 struct property *prop; in check_interrupt_provider() local
1583 prop = get_property(node, "#interrupt-cells"); in check_interrupt_provider()
1584 if (irq_provider && !prop) { in check_interrupt_provider()
1586 "Missing '#interrupt-cells' in interrupt provider"); in check_interrupt_provider()
1590 if (!irq_provider && prop) { in check_interrupt_provider()
1592 "'#interrupt-cells' found, but node is not an interrupt provider"); in check_interrupt_provider()
1602 struct node *root = dti->dt; in check_interrupt_map()
1603 struct property *prop, *irq_map_prop; in check_interrupt_map() local
1606 irq_map_prop = get_property(node, "interrupt-map"); in check_interrupt_map()
1610 if (node->addr_cells < 0) { in check_interrupt_map()
1612 "Missing '#address-cells' in interrupt-map provider"); in check_interrupt_map()
1616 cellsize += propval_cell(get_property(node, "#interrupt-cells")); in check_interrupt_map()
1618 prop = get_property(node, "interrupt-map-mask"); in check_interrupt_map()
1619 if (prop && (prop->val.len != (cellsize * sizeof(cell_t)))) in check_interrupt_map()
1620 FAIL_PROP(c, dti, node, prop, in check_interrupt_map()
1622 prop->val.len, cellsize * sizeof(cell_t)); in check_interrupt_map()
1624 if (!is_multiple_of(irq_map_prop->val.len, sizeof(cell_t))) { in check_interrupt_map()
1627 irq_map_prop->val.len, sizeof(cell_t)); in check_interrupt_map()
1631 map_cells = irq_map_prop->val.len / sizeof(cell_t); in check_interrupt_map()
1641 irq_map_prop->val.len, (cell + cellsize) * sizeof(cell_t)); in check_interrupt_map()
1649 if (!(dti->dtsflags & DTSF_PLUGIN)) in check_interrupt_map()
1664 cellprop = get_property(provider_node, "#interrupt-cells"); in check_interrupt_map()
1668 …AIL(c, dti, node, "Missing property '#interrupt-cells' in node %s or bad phandle (referred from in… in check_interrupt_map()
1669 provider_node->fullpath, cell); in check_interrupt_map()
1673 cellprop = get_property(provider_node, "#address-cells"); in check_interrupt_map()
1681 irq_map_prop->val.len, cell * sizeof(cell_t)); in check_interrupt_map()
1690 struct node *root = dti->dt; in check_interrupts_property()
1692 struct property *irq_prop, *prop = NULL; in check_interrupts_property() local
1699 if (!is_multiple_of(irq_prop->val.len, sizeof(cell_t))) in check_interrupts_property()
1701 irq_prop->val.len, sizeof(cell_t)); in check_interrupts_property()
1703 while (parent && !prop) { in check_interrupts_property()
1709 prop = get_property(parent, "interrupt-parent"); in check_interrupts_property()
1710 if (prop) { in check_interrupts_property()
1711 phandle = propval_cell(prop); in check_interrupts_property()
1715 if (dti->dtsflags & DTSF_PLUGIN) in check_interrupts_property()
1717 FAIL_PROP(c, dti, parent, prop, "Invalid phandle"); in check_interrupts_property()
1723 FAIL_PROP(c, dti, parent, prop, "Bad phandle"); in check_interrupts_property()
1728 "Missing interrupt-controller or interrupt-map property"); in check_interrupts_property()
1733 parent = parent->parent; in check_interrupts_property()
1737 FAIL(c, dti, node, "Missing interrupt-parent"); in check_interrupts_property()
1741 prop = get_property(irq_node, "#interrupt-cells"); in check_interrupts_property()
1742 if (!prop) { in check_interrupts_property()
1747 irq_cells = propval_cell(prop); in check_interrupts_property()
1748 if (!is_multiple_of(irq_prop->val.len, irq_cells * sizeof(cell_t))) { in check_interrupts_property()
1749 FAIL_PROP(c, dti, node, prop, in check_interrupts_property()
1751 irq_prop->val.len, (int)(irq_cells * sizeof(cell_t))); in check_interrupts_property()
1757 .name = "graph-port",
1761 .name = "graph-ports",
1770 if (!(strprefixeq(child->name, child->basenamelen, "endpoint") || in check_graph_nodes()
1771 get_property(child, "remote-endpoint"))) in check_graph_nodes()
1775 if (!node->parent) { in check_graph_nodes()
1776 …ot node contains endpoint node '%s', potentially misplaced remote-endpoint property", child->name); in check_graph_nodes()
1779 node->bus = &graph_port_bus; in check_graph_nodes()
1782 if (!node->parent->bus && in check_graph_nodes()
1783 (streq(node->parent->name, "ports") || get_property(node, "reg"))) in check_graph_nodes()
1784 node->parent->bus = &graph_ports_bus; in check_graph_nodes()
1797 struct property *prop; in check_graph_reg() local
1799 prop = get_property(node, "reg"); in check_graph_reg()
1800 if (!prop || !unitname) in check_graph_reg()
1803 if (!(prop->val.val && prop->val.len == sizeof(cell_t))) { in check_graph_reg()
1808 snprintf(unit_addr, sizeof(unit_addr), "%x", propval_cell(prop)); in check_graph_reg()
1813 if (node->parent->addr_cells != 1) in check_graph_reg()
1814 FAIL_PROP(c, dti, node, get_property(node, "#address-cells"), in check_graph_reg()
1815 "graph node '#address-cells' is %d, must be 1", in check_graph_reg()
1816 node->parent->addr_cells); in check_graph_reg()
1817 if (node->parent->size_cells != 0) in check_graph_reg()
1818 FAIL_PROP(c, dti, node, get_property(node, "#size-cells"), in check_graph_reg()
1819 "graph node '#size-cells' is %d, must be 0", in check_graph_reg()
1820 node->parent->size_cells); in check_graph_reg()
1826 if (node->bus != &graph_port_bus) in check_graph_port()
1832 if (dti->dtsflags & DTSF_PLUGIN) in check_graph_port()
1835 if (!strprefixeq(node->name, node->basenamelen, "port")) in check_graph_port()
1845 struct property *prop; in get_remote_endpoint() local
1847 prop = get_property(endpoint, "remote-endpoint"); in get_remote_endpoint()
1848 if (!prop) in get_remote_endpoint()
1851 phandle = propval_cell(prop); in get_remote_endpoint()
1856 node = get_node_by_phandle(dti->dt, phandle); in get_remote_endpoint()
1858 FAIL_PROP(c, dti, endpoint, prop, "graph phandle is not valid"); in get_remote_endpoint()
1868 if (!node->parent || node->parent->bus != &graph_port_bus) in check_graph_endpoint()
1874 if (dti->dtsflags & DTSF_PLUGIN) in check_graph_endpoint()
1877 if (!strprefixeq(node->name, node->basenamelen, "endpoint")) in check_graph_endpoint()
1886 remote_node->fullpath); in check_graph_endpoint()
1896 if (node->bus != &graph_ports_bus && node->bus != &graph_port_bus) in check_graph_child_address()
1900 struct property *prop = get_property(child, "reg"); in check_graph_child_address() local
1902 /* No error if we have any non-zero unit address */ in check_graph_child_address()
1903 if (prop && propval_cell(prop) != 0 ) in check_graph_child_address()
1909 if (cnt == 1 && node->addr_cells != -1) in check_graph_child_address()
1910 …FAIL(c, dti, node, "graph node has single child node '%s', #address-cells/#size-cells are not nece… in check_graph_child_address()
1911 node->children->name); in check_graph_child_address()
2011 if ((warn && !c->warn) || (error && !c->error)) in enable_warning_error()
2012 for (i = 0; i < c->num_prereqs; i++) in enable_warning_error()
2013 enable_warning_error(c->prereq[i], warn, error); in enable_warning_error()
2015 c->warn = c->warn || warn; in enable_warning_error()
2016 c->error = c->error || error; in enable_warning_error()
2025 if ((warn && c->warn) || (error && c->error)) { in disable_warning_error()
2030 for (j = 0; j < cc->num_prereqs; j++) in disable_warning_error()
2031 if (cc->prereq[j] == c) in disable_warning_error()
2036 c->warn = c->warn && !warn; in disable_warning_error()
2037 c->error = c->error && !error; in disable_warning_error()
2046 if ((strncmp(arg, "no-", 3) == 0) in parse_checks_option()
2055 if (streq(c->name, name)) { in parse_checks_option()
2075 if (c->warn || c->error) in process_checks()
2082 "(use -f to force output)\n"); in process_checks()