Lines Matching +full:reg +full:- +full:property

1 // SPDX-License-Identifier: GPL-2.0-or-later
12 fprintf(stderr, "=== %s: ", (c)->name); \
63 struct property *prop, in check_msg()
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()
94 xasprintf_append(&str, "%s:%s: ", node->fullpath, prop->name); in check_msg()
96 xasprintf_append(&str, "%s: ", node->fullpath); in check_msg()
106 pos = node->srcpos; in check_msg()
107 while (pos->next) { in check_msg()
108 pos = pos->next; in check_msg()
122 (c)->status = FAILED; \
129 (c)->status = FAILED; \
138 TRACE(c, "%s", node->fullpath); in check_nodes_props()
139 if (c->fn) in check_nodes_props()
140 c->fn(c, dti, node); in check_nodes_props()
148 struct node *dt = dti->dt; in run_check()
152 assert(!c->inprogress); in run_check()
154 if (c->status != UNCHECKED) in run_check()
157 c->inprogress = true; in run_check()
159 for (i = 0; i < c->num_prereqs; i++) { in run_check()
160 struct check *prq = c->prereq[i]; in run_check()
162 if (prq->status != PASSED) { in run_check()
163 c->status = PREREQ; in run_check()
165 c->prereq[i]->name); in run_check()
169 if (c->status != UNCHECKED) in run_check()
174 if (c->status == UNCHECKED) in run_check()
175 c->status = PASSED; in run_check()
177 TRACE(c, "\tCompleted, status %d", c->status); in run_check()
180 c->inprogress = false; in run_check()
181 if ((c->status != PASSED) && (c->error)) in run_check()
201 struct property *prop; in check_is_string()
202 char *propname = c->data; in check_is_string()
208 if (!data_is_one_string(prop->val)) in check_is_string()
209 FAIL_PROP(c, dti, node, prop, "property is not a string"); in check_is_string()
220 struct property *prop; in check_is_string_list()
221 char *propname = c->data; in check_is_string_list()
228 str = prop->val.val; in check_is_string_list()
229 rem = prop->val.len; in check_is_string_list()
233 FAIL_PROP(c, dti, node, prop, "property is not a string list"); in check_is_string_list()
236 rem -= l + 1; in check_is_string_list()
248 struct property *prop; in check_is_cell()
249 char *propname = c->data; in check_is_cell()
255 if (prop->val.len != sizeof(cell_t)) in check_is_cell()
256 FAIL_PROP(c, dti, node, prop, "property is not a single cell"); in check_is_cell()
273 for (child2 = child->next_sibling; in check_duplicate_node_names()
275 child2 = child2->next_sibling) in check_duplicate_node_names()
276 if (streq(child->name, child2->name)) in check_duplicate_node_names()
284 struct property *prop, *prop2; in check_duplicate_property_names()
287 for (prop2 = prop->next; prop2; prop2 = prop2->next) { in check_duplicate_property_names()
288 if (prop2->deleted) in check_duplicate_property_names()
290 if (streq(prop->name, prop2->name)) in check_duplicate_property_names()
291 FAIL_PROP(c, dti, node, prop, "Duplicate property name"); in check_duplicate_property_names()
300 #define PROPNODECHARS LOWERCASE UPPERCASE DIGITS ",._+*#?-"
301 #define PROPNODECHARSSTRICT LOWERCASE UPPERCASE DIGITS ",-"
306 int n = strspn(node->name, c->data); in check_node_name_chars()
308 if (n < strlen(node->name)) in check_node_name_chars()
310 node->name[n]); in check_node_name_chars()
317 int n = strspn(node->name, c->data); in check_node_name_chars_strict()
319 if (n < node->basenamelen) in check_node_name_chars_strict()
321 node->name[n]); in check_node_name_chars_strict()
337 struct property *prop = get_property(node, "reg"); in check_unit_address_vs_reg()
346 if (prop && !prop->val.len) in check_unit_address_vs_reg()
352 FAIL(c, dti, node, "node has a reg or ranges property, but no unit name"); in check_unit_address_vs_reg()
355 FAIL(c, dti, node, "node has a unit name, but no reg or ranges property"); in check_unit_address_vs_reg()
363 struct property *prop; in check_property_name_chars()
366 int n = strspn(prop->name, c->data); in check_property_name_chars()
368 if (n < strlen(prop->name)) in check_property_name_chars()
369 FAIL_PROP(c, dti, node, prop, "Bad character '%c' in property name", in check_property_name_chars()
370 prop->name[n]); in check_property_name_chars()
379 struct property *prop; in check_property_name_chars_strict()
382 const char *name = prop->name; in check_property_name_chars_strict()
383 int n = strspn(name, c->data); in check_property_name_chars_strict()
385 if (n == strlen(prop->name)) in check_property_name_chars_strict()
393 * # is only allowed at the beginning of property names not counting in check_property_name_chars_strict()
396 if (name[n] == '#' && ((n == 0) || (name[n-1] == ','))) { in check_property_name_chars_strict()
398 n = strspn(name, c->data); in check_property_name_chars_strict()
401 FAIL_PROP(c, dti, node, prop, "Character '%c' not recommended in property name", in check_property_name_chars_strict()
411 ((prop) ? (prop)->name : ""), \
412 ((prop) ? "' in " : ""), (node)->fullpath
416 struct property *prop, struct marker *mark) in check_duplicate_label()
418 struct node *dt = dti->dt; in check_duplicate_label()
420 struct property *otherprop = NULL; in check_duplicate_label()
445 struct property *prop; in check_duplicate_label_node()
447 for_each_label(node->labels, l) in check_duplicate_label_node()
448 check_duplicate_label(c, dti, l->label, node, NULL, NULL); in check_duplicate_label_node()
451 struct marker *m = prop->val.markers; in check_duplicate_label_node()
453 for_each_label(prop->labels, l) in check_duplicate_label_node()
454 check_duplicate_label(c, dti, l->label, node, prop, NULL); in check_duplicate_label_node()
457 check_duplicate_label(c, dti, m->ref, node, prop, m); in check_duplicate_label_node()
465 struct node *root = dti->dt; in check_phandle_prop()
466 struct property *prop; in check_phandle_prop()
474 if (prop->val.len != sizeof(cell_t)) { in check_phandle_prop()
475 FAIL_PROP(c, dti, node, prop, "bad length (%d) %s property", in check_phandle_prop()
476 prop->val.len, prop->name); in check_phandle_prop()
480 m = prop->val.markers; in check_phandle_prop()
482 assert(m->offset == 0); in check_phandle_prop()
483 if (node != get_node_by_ref(root, m->ref)) in check_phandle_prop()
488 prop->name); in check_phandle_prop()
491 * phandle is allowed - that means allocate a unique in check_phandle_prop()
500 if ((phandle == 0) || (phandle == -1)) { in check_phandle_prop()
501 FAIL_PROP(c, dti, node, prop, "bad value (0x%x) in %s property", in check_phandle_prop()
502 phandle, prop->name); in check_phandle_prop()
512 struct node *root = dti->dt; in check_explicit_phandles()
517 assert(!node->phandle); in check_explicit_phandles()
537 phandle, other->fullpath); in check_explicit_phandles()
541 node->phandle = phandle; in check_explicit_phandles()
548 struct property **pp, *prop = NULL; in check_name_properties()
550 for (pp = &node->proplist; *pp; pp = &((*pp)->next)) in check_name_properties()
551 if (streq((*pp)->name, "name")) { in check_name_properties()
557 return; /* No name property, that's fine */ in check_name_properties()
559 if ((prop->val.len != node->basenamelen+1) in check_name_properties()
560 || (memcmp(prop->val.val, node->name, node->basenamelen) != 0)) { in check_name_properties()
561 FAIL(c, dti, node, "\"name\" property is incorrect (\"%s\" instead" in check_name_properties()
562 " of base node name)", prop->val.val); in check_name_properties()
564 /* The name property is correct, and therefore redundant. in check_name_properties()
566 *pp = prop->next; in check_name_properties()
567 free(prop->name); in check_name_properties()
568 data_free(prop->val); in check_name_properties()
582 struct node *dt = dti->dt; in fixup_phandle_references()
583 struct property *prop; in fixup_phandle_references()
586 struct marker *m = prop->val.markers; in fixup_phandle_references()
591 assert(m->offset + sizeof(cell_t) <= prop->val.len); in fixup_phandle_references()
593 refnode = get_node_by_ref(dt, m->ref); in fixup_phandle_references()
595 if (!(dti->dtsflags & DTSF_PLUGIN)) in fixup_phandle_references()
596 FAIL(c, dti, node, "Reference to non-existent node or " in fixup_phandle_references()
597 "label \"%s\"\n", m->ref); in fixup_phandle_references()
599 *((fdt32_t *)(prop->val.val + m->offset)) = in fixup_phandle_references()
605 *((fdt32_t *)(prop->val.val + m->offset)) = cpu_to_fdt32(phandle); in fixup_phandle_references()
617 struct node *dt = dti->dt; in fixup_path_references()
618 struct property *prop; in fixup_path_references()
621 struct marker *m = prop->val.markers; in fixup_path_references()
626 assert(m->offset <= prop->val.len); in fixup_path_references()
628 refnode = get_node_by_ref(dt, m->ref); in fixup_path_references()
630 FAIL(c, dti, node, "Reference to non-existent node or label \"%s\"\n", in fixup_path_references()
631 m->ref); in fixup_path_references()
635 path = refnode->fullpath; in fixup_path_references()
636 prop->val = data_insert_at_marker(prop->val, m, path, in fixup_path_references()
648 if (generate_symbols && node->labels) in fixup_omit_unused_nodes()
650 if (node->omit_if_unused && !node->is_referenced) in fixup_omit_unused_nodes()
658 WARNING_IF_NOT_CELL(address_cells_is_cell, "#address-cells");
659 WARNING_IF_NOT_CELL(size_cells_is_cell, "#size-cells");
660 WARNING_IF_NOT_CELL(interrupt_cells_is_cell, "#interrupt-cells");
672 struct property *prop; in check_names_is_string_list()
675 const char *s = strrchr(prop->name, '-'); in check_names_is_string_list()
676 if (!s || !streq(s, "-names")) in check_names_is_string_list()
679 c->data = prop->name; in check_names_is_string_list()
688 struct property *prop; in check_alias_paths()
690 if (!streq(node->name, "aliases")) in check_alias_paths()
694 if (streq(prop->name, "phandle") in check_alias_paths()
695 || streq(prop->name, "linux,phandle")) { in check_alias_paths()
699 if (!prop->val.val || !get_node_by_path(dti->dt, prop->val.val)) { in check_alias_paths()
700 FAIL_PROP(c, dti, node, prop, "aliases property is not a valid node (%s)", in check_alias_paths()
701 prop->val.val); in check_alias_paths()
704 if (strspn(prop->name, LOWERCASE DIGITS "-") != strlen(prop->name)) in check_alias_paths()
705 FAIL(c, dti, node, "aliases property name must include only lowercase and '-'"); in check_alias_paths()
713 struct property *prop; in fixup_addr_size_cells()
715 node->addr_cells = -1; in fixup_addr_size_cells()
716 node->size_cells = -1; in fixup_addr_size_cells()
718 prop = get_property(node, "#address-cells"); in fixup_addr_size_cells()
720 node->addr_cells = propval_cell(prop); in fixup_addr_size_cells()
722 prop = get_property(node, "#size-cells"); in fixup_addr_size_cells()
724 node->size_cells = propval_cell(prop); in fixup_addr_size_cells()
730 (((n)->addr_cells == -1) ? 2 : (n)->addr_cells)
732 (((n)->size_cells == -1) ? 1 : (n)->size_cells)
737 struct property *prop; in check_reg_format()
740 prop = get_property(node, "reg"); in check_reg_format()
742 return; /* No "reg", that's fine */ in check_reg_format()
744 if (!node->parent) { in check_reg_format()
745 FAIL(c, dti, node, "Root node has a \"reg\" property"); in check_reg_format()
749 if (prop->val.len == 0) in check_reg_format()
750 FAIL_PROP(c, dti, node, prop, "property is empty"); in check_reg_format()
752 addr_cells = node_addr_cells(node->parent); in check_reg_format()
753 size_cells = node_size_cells(node->parent); in check_reg_format()
756 if (!entrylen || (prop->val.len % entrylen) != 0) in check_reg_format()
757 FAIL_PROP(c, dti, node, prop, "property has invalid length (%d bytes) " in check_reg_format()
758 "(#address-cells == %d, #size-cells == %d)", in check_reg_format()
759 prop->val.len, addr_cells, size_cells); in check_reg_format()
766 struct property *prop; in check_ranges_format()
768 const char *ranges = c->data; in check_ranges_format()
774 if (!node->parent) { in check_ranges_format()
775 FAIL_PROP(c, dti, node, prop, "Root node has a \"%s\" property", in check_ranges_format()
780 p_addr_cells = node_addr_cells(node->parent); in check_ranges_format()
781 p_size_cells = node_size_cells(node->parent); in check_ranges_format()
786 if (prop->val.len == 0) { in check_ranges_format()
788 FAIL_PROP(c, dti, node, prop, "empty \"%s\" property but its " in check_ranges_format()
789 "#address-cells (%d) differs from %s (%d)", in check_ranges_format()
790 ranges, c_addr_cells, node->parent->fullpath, in check_ranges_format()
793 FAIL_PROP(c, dti, node, prop, "empty \"%s\" property but its " in check_ranges_format()
794 "#size-cells (%d) differs from %s (%d)", in check_ranges_format()
795 ranges, c_size_cells, node->parent->fullpath, in check_ranges_format()
797 } else if ((prop->val.len % entrylen) != 0) { in check_ranges_format()
798 FAIL_PROP(c, dti, node, prop, "\"%s\" property has invalid length (%d bytes) " in check_ranges_format()
799 "(parent #address-cells == %d, child #address-cells == %d, " in check_ranges_format()
800 "#size-cells == %d)", ranges, prop->val.len, in check_ranges_format()
805 WARNING(dma_ranges_format, check_ranges_format, "dma-ranges", &addr_size_cells);
813 struct property *prop; in check_pci_bridge()
817 if (!prop || !streq(prop->val.val, "pci")) in check_pci_bridge()
820 node->bus = &pci_bus; in check_pci_bridge()
822 if (!strprefixeq(node->name, node->basenamelen, "pci") && in check_pci_bridge()
823 !strprefixeq(node->name, node->basenamelen, "pcie")) in check_pci_bridge()
831 FAIL(c, dti, node, "incorrect #address-cells for PCI bridge"); in check_pci_bridge()
833 FAIL(c, dti, node, "incorrect #size-cells for PCI bridge"); in check_pci_bridge()
835 prop = get_property(node, "bus-range"); in check_pci_bridge()
839 if (prop->val.len != (sizeof(cell_t) * 2)) { in check_pci_bridge()
843 cells = (cell_t *)prop->val.val; in check_pci_bridge()
854 struct property *prop; in check_pci_device_bus_num()
858 if (!node->parent || (node->parent->bus != &pci_bus)) in check_pci_device_bus_num()
861 prop = get_property(node, "reg"); in check_pci_device_bus_num()
865 cells = (cell_t *)prop->val.val; in check_pci_device_bus_num()
868 prop = get_property(node->parent, "bus-range"); in check_pci_device_bus_num()
872 cells = (cell_t *)prop->val.val; in check_pci_device_bus_num()
877 FAIL_PROP(c, dti, node, prop, "PCI bus number %d out of range, expected (%d - %d)", in check_pci_device_bus_num()
884 struct property *prop; in check_pci_device_reg()
887 unsigned int dev, func, reg; in check_pci_device_reg() local
890 if (!node->parent || (node->parent->bus != &pci_bus)) in check_pci_device_reg()
893 prop = get_property(node, "reg"); in check_pci_device_reg()
897 cells = (cell_t *)prop->val.val; in check_pci_device_reg()
899 FAIL_PROP(c, dti, node, prop, "PCI reg config space address cells 2 and 3 must be 0"); in check_pci_device_reg()
901 reg = fdt32_to_cpu(cells[0]); in check_pci_device_reg()
902 dev = (reg & 0xf800) >> 11; in check_pci_device_reg()
903 func = (reg & 0x700) >> 8; in check_pci_device_reg()
905 if (reg & 0xff000000) in check_pci_device_reg()
906 FAIL_PROP(c, dti, node, prop, "PCI reg address is not configuration space"); in check_pci_device_reg()
907 if (reg & 0x000000ff) in check_pci_device_reg()
908 FAIL_PROP(c, dti, node, prop, "PCI reg config space address register number must be 0"); in check_pci_device_reg()
926 .name = "simple-bus",
931 struct property *prop; in node_is_compatible()
938 for (str = prop->val.val, end = str + prop->val.len; str < end; in node_is_compatible()
939 str += strnlen(str, end - str) + 1) { in node_is_compatible()
948 if (node_is_compatible(node, "simple-bus")) in check_simple_bus_bridge()
949 node->bus = &simple_bus; in check_simple_bus_bridge()
956 struct property *prop; in check_simple_bus_reg()
960 uint64_t reg = 0; in check_simple_bus_reg() local
963 if (!node->parent || (node->parent->bus != &simple_bus)) in check_simple_bus_reg()
966 prop = get_property(node, "reg"); in check_simple_bus_reg()
968 cells = (cell_t *)prop->val.val; in check_simple_bus_reg()
971 if (prop && prop->val.len) in check_simple_bus_reg()
973 cells = ((cell_t *)prop->val.val) + node_addr_cells(node); in check_simple_bus_reg()
977 if (node->parent->parent && !(node->bus == &simple_bus)) in check_simple_bus_reg()
978 FAIL(c, dti, node, "missing or empty reg/ranges property"); in check_simple_bus_reg()
982 size = node_addr_cells(node->parent); in check_simple_bus_reg()
983 while (size--) in check_simple_bus_reg()
984 reg = (reg << 32) | fdt32_to_cpu(*(cells++)); in check_simple_bus_reg()
986 snprintf(unit_addr, sizeof(unit_addr), "%"PRIx64, reg); in check_simple_bus_reg()
988 FAIL(c, dti, node, "simple-bus unit address format error, expected \"%s\"", in check_simple_bus_reg()
994 .name = "i2c-bus",
999 if (strprefixeq(node->name, node->basenamelen, "i2c-bus") || in check_i2c_bus_bridge()
1000 strprefixeq(node->name, node->basenamelen, "i2c-arb")) { in check_i2c_bus_bridge()
1001 node->bus = &i2c_bus; in check_i2c_bus_bridge()
1002 } else if (strprefixeq(node->name, node->basenamelen, "i2c")) { in check_i2c_bus_bridge()
1005 if (strprefixeq(child->name, node->basenamelen, "i2c-bus")) in check_i2c_bus_bridge()
1008 node->bus = &i2c_bus; in check_i2c_bus_bridge()
1012 if (!node->children) in check_i2c_bus_bridge()
1016 FAIL(c, dti, node, "incorrect #address-cells for I2C bus"); in check_i2c_bus_bridge()
1018 FAIL(c, dti, node, "incorrect #size-cells for I2C bus"); in check_i2c_bus_bridge()
1028 struct property *prop; in check_i2c_bus_reg()
1031 uint32_t reg = 0; in check_i2c_bus_reg() local
1035 if (!node->parent || (node->parent->bus != &i2c_bus)) in check_i2c_bus_reg()
1038 prop = get_property(node, "reg"); in check_i2c_bus_reg()
1040 cells = (cell_t *)prop->val.val; in check_i2c_bus_reg()
1043 FAIL(c, dti, node, "missing or empty reg property"); in check_i2c_bus_reg()
1047 reg = fdt32_to_cpu(*cells); in check_i2c_bus_reg()
1049 reg &= ~I2C_OWN_SLAVE_ADDRESS; in check_i2c_bus_reg()
1050 snprintf(unit_addr, sizeof(unit_addr), "%x", reg); in check_i2c_bus_reg()
1055 for (len = prop->val.len; len > 0; len -= 4) { in check_i2c_bus_reg()
1056 reg = fdt32_to_cpu(*(cells++)); in check_i2c_bus_reg()
1058 reg &= ~I2C_OWN_SLAVE_ADDRESS; in check_i2c_bus_reg()
1060 if ((reg & I2C_TEN_BIT_ADDRESS) && ((reg & ~I2C_TEN_BIT_ADDRESS) > 0x3ff)) in check_i2c_bus_reg()
1061 FAIL_PROP(c, dti, node, prop, "I2C address must be less than 10-bits, got \"0x%x\"", in check_i2c_bus_reg()
1062 reg); in check_i2c_bus_reg()
1063 else if (reg > 0x7f) in check_i2c_bus_reg()
1064 …, "I2C address must be less than 7-bits, got \"0x%x\". Set I2C_TEN_BIT_ADDRESS for 10 bit addresse… in check_i2c_bus_reg()
1065 reg); in check_i2c_bus_reg()
1071 .name = "spi-bus",
1078 if (strprefixeq(node->name, node->basenamelen, "spi")) { in check_spi_bus_bridge()
1079 node->bus = &spi_bus; in check_spi_bus_bridge()
1088 struct property *prop; in check_spi_bus_bridge()
1090 if (strprefixeq(prop->name, 4, "spi-")) { in check_spi_bus_bridge()
1091 node->bus = &spi_bus; in check_spi_bus_bridge()
1095 if (node->bus == &spi_bus) in check_spi_bus_bridge()
1099 if (node->bus == &spi_bus && get_property(node, "reg")) in check_spi_bus_bridge()
1102 if (node->bus != &spi_bus || !node->children) in check_spi_bus_bridge()
1105 if (get_property(node, "spi-slave")) in check_spi_bus_bridge()
1108 FAIL(c, dti, node, "incorrect #address-cells for SPI bus"); in check_spi_bus_bridge()
1110 FAIL(c, dti, node, "incorrect #size-cells for SPI bus"); in check_spi_bus_bridge()
1117 struct property *prop; in check_spi_bus_reg()
1120 uint32_t reg = 0; in check_spi_bus_reg() local
1123 if (!node->parent || (node->parent->bus != &spi_bus)) in check_spi_bus_reg()
1126 if (get_property(node->parent, "spi-slave")) in check_spi_bus_reg()
1129 prop = get_property(node, "reg"); in check_spi_bus_reg()
1131 cells = (cell_t *)prop->val.val; in check_spi_bus_reg()
1134 FAIL(c, dti, node, "missing or empty reg property"); in check_spi_bus_reg()
1138 reg = fdt32_to_cpu(*cells); in check_spi_bus_reg()
1139 snprintf(unit_addr, sizeof(unit_addr), "%x", reg); in check_spi_bus_reg()
1151 if (node->parent && node->parent->bus) in check_unit_address_format()
1174 struct property *reg, *ranges; in check_avoid_default_addr_size() local
1176 if (!node->parent) in check_avoid_default_addr_size()
1179 reg = get_property(node, "reg"); in check_avoid_default_addr_size()
1182 if (!reg && !ranges) in check_avoid_default_addr_size()
1185 if (node->parent->addr_cells == -1) in check_avoid_default_addr_size()
1186 FAIL(c, dti, node, "Relying on default #address-cells value"); in check_avoid_default_addr_size()
1188 if (node->parent->size_cells == -1) in check_avoid_default_addr_size()
1189 FAIL(c, dti, node, "Relying on default #size-cells value"); in check_avoid_default_addr_size()
1197 struct property *prop; in check_avoid_unnecessary_addr_size()
1201 if (!node->parent || node->addr_cells < 0 || node->size_cells < 0) in check_avoid_unnecessary_addr_size()
1204 if (get_property(node, "ranges") || !node->children) in check_avoid_unnecessary_addr_size()
1208 prop = get_property(child, "reg"); in check_avoid_unnecessary_addr_size()
1214 …FAIL(c, dti, node, "unnecessary #address-cells/#size-cells without \"ranges\" or child \"reg\" pro… in check_avoid_unnecessary_addr_size()
1220 struct property *prop; in node_is_disabled()
1224 char *str = prop->val.val; in node_is_disabled()
1239 if (node->addr_cells < 0 || node->size_cells < 0) in check_unique_unit_address_common()
1242 if (!node->children) in check_unique_unit_address_common()
1264 FAIL(c, dti, childb, "duplicate unit-address (also used in node %s)", childa->fullpath); in check_unique_unit_address_common()
1288 struct node *dt = dti->dt; in check_obsolete_chosen_interrupt_controller()
1290 struct property *prop; in check_obsolete_chosen_interrupt_controller()
1300 prop = get_property(chosen, "interrupt-controller"); in check_obsolete_chosen_interrupt_controller()
1303 "/chosen has obsolete \"interrupt-controller\" property"); in check_obsolete_chosen_interrupt_controller()
1311 if (!streq(node->name, "chosen")) in check_chosen_node_is_root()
1314 if (node->parent != dti->dt) in check_chosen_node_is_root()
1322 struct property *prop; in check_chosen_node_bootargs()
1324 if (!streq(node->name, "chosen")) in check_chosen_node_bootargs()
1331 c->data = prop->name; in check_chosen_node_bootargs()
1339 struct property *prop; in check_chosen_node_stdout_path()
1341 if (!streq(node->name, "chosen")) in check_chosen_node_stdout_path()
1344 prop = get_property(node, "stdout-path"); in check_chosen_node_stdout_path()
1346 prop = get_property(node, "linux,stdout-path"); in check_chosen_node_stdout_path()
1349 FAIL_PROP(c, dti, node, prop, "Use 'stdout-path' instead"); in check_chosen_node_stdout_path()
1352 c->data = prop->name; in check_chosen_node_stdout_path()
1366 struct property *prop, in check_property_phandle_args()
1369 struct node *root = dti->dt; in check_property_phandle_args()
1372 if (prop->val.len % sizeof(cell_t)) { in check_property_phandle_args()
1374 "property size (%d) is invalid, expected multiple of %zu", in check_property_phandle_args()
1375 prop->val.len, sizeof(cell_t)); in check_property_phandle_args()
1379 for (cell = 0; cell < prop->val.len / sizeof(cell_t); cell += cellsize + 1) { in check_property_phandle_args()
1381 struct property *cellprop; in check_property_phandle_args()
1386 * Some bindings use a cell value 0 or -1 to skip over optional in check_property_phandle_args()
1389 if (phandle == 0 || phandle == -1) { in check_property_phandle_args()
1391 if (dti->dtsflags & DTSF_PLUGIN) in check_property_phandle_args()
1399 if (prop->val.markers) { in check_property_phandle_args()
1400 struct marker *m = prop->val.markers; in check_property_phandle_args()
1402 if (m->offset == (cell * sizeof(cell_t))) in check_property_phandle_args()
1419 cellprop = get_property(provider_node, provider->cell_name); in check_property_phandle_args()
1422 } else if (provider->optional) { in check_property_phandle_args()
1425 FAIL(c, dti, node, "Missing property '%s' in node %s or bad phandle (referred from %s[%d])", in check_property_phandle_args()
1426 provider->cell_name, in check_property_phandle_args()
1427 provider_node->fullpath, in check_property_phandle_args()
1428 prop->name, cell); in check_property_phandle_args()
1432 if (prop->val.len < ((cell + cellsize + 1) * sizeof(cell_t))) { in check_property_phandle_args()
1434 "property size (%d) too small for cell size %d", in check_property_phandle_args()
1435 prop->val.len, cellsize); in check_property_phandle_args()
1444 struct provider *provider = c->data; in check_provider_cells_property()
1445 struct property *prop; in check_provider_cells_property()
1447 prop = get_property(node, provider->prop_name); in check_provider_cells_property()
1457 WARNING_PROPERTY_PHANDLE_CELLS(clocks, "clocks", "#clock-cells");
1458 WARNING_PROPERTY_PHANDLE_CELLS(cooling_device, "cooling-device", "#cooling-cells");
1459 WARNING_PROPERTY_PHANDLE_CELLS(dmas, "dmas", "#dma-cells");
1460 WARNING_PROPERTY_PHANDLE_CELLS(hwlocks, "hwlocks", "#hwlock-cells");
1461 WARNING_PROPERTY_PHANDLE_CELLS(interrupts_extended, "interrupts-extended", "#interrupt-cells");
1462 WARNING_PROPERTY_PHANDLE_CELLS(io_channels, "io-channels", "#io-channel-cells");
1463 WARNING_PROPERTY_PHANDLE_CELLS(iommus, "iommus", "#iommu-cells");
1464 WARNING_PROPERTY_PHANDLE_CELLS(mboxes, "mboxes", "#mbox-cells");
1465 WARNING_PROPERTY_PHANDLE_CELLS(msi_parent, "msi-parent", "#msi-cells", true);
1466 WARNING_PROPERTY_PHANDLE_CELLS(mux_controls, "mux-controls", "#mux-control-cells");
1467 WARNING_PROPERTY_PHANDLE_CELLS(phys, "phys", "#phy-cells");
1468 WARNING_PROPERTY_PHANDLE_CELLS(power_domains, "power-domains", "#power-domain-cells");
1469 WARNING_PROPERTY_PHANDLE_CELLS(pwms, "pwms", "#pwm-cells");
1470 WARNING_PROPERTY_PHANDLE_CELLS(resets, "resets", "#reset-cells");
1471 WARNING_PROPERTY_PHANDLE_CELLS(sound_dai, "sound-dai", "#sound-dai-cells");
1472 WARNING_PROPERTY_PHANDLE_CELLS(thermal_sensors, "thermal-sensors", "#thermal-sensor-cells");
1474 static bool prop_is_gpio(struct property *prop) in prop_is_gpio()
1479 * *-gpios and *-gpio can appear in property names, in prop_is_gpio()
1482 if (strstr(prop->name, "nr-gpio")) in prop_is_gpio()
1485 str = strrchr(prop->name, '-'); in prop_is_gpio()
1489 str = prop->name; in prop_is_gpio()
1500 struct property *prop; in check_gpios_property()
1502 /* Skip GPIO hog nodes which have 'gpios' property */ in check_gpios_property()
1503 if (get_property(node, "gpio-hog")) in check_gpios_property()
1512 provider.prop_name = prop->name; in check_gpios_property()
1513 provider.cell_name = "#gpio-cells"; in check_gpios_property()
1525 struct property *prop; in check_deprecated_gpio_property()
1533 str = strstr(prop->name, "gpio"); in check_deprecated_gpio_property()
1538 "'[*-]gpio' is deprecated, use '[*-]gpios' instead"); in check_deprecated_gpio_property()
1546 struct property *prop; in node_is_interrupt_provider()
1548 prop = get_property(node, "interrupt-controller"); in node_is_interrupt_provider()
1552 prop = get_property(node, "interrupt-map"); in node_is_interrupt_provider()
1563 struct property *prop; in check_interrupt_provider()
1568 prop = get_property(node, "#interrupt-cells"); in check_interrupt_provider()
1571 "Missing #interrupt-cells in interrupt provider"); in check_interrupt_provider()
1573 prop = get_property(node, "#address-cells"); in check_interrupt_provider()
1576 "Missing #address-cells in interrupt provider"); in check_interrupt_provider()
1584 struct node *root = dti->dt; in check_interrupts_property()
1586 struct property *irq_prop, *prop = NULL; in check_interrupts_property()
1593 if (irq_prop->val.len % sizeof(cell_t)) in check_interrupts_property()
1595 irq_prop->val.len, sizeof(cell_t)); in check_interrupts_property()
1603 prop = get_property(parent, "interrupt-parent"); in check_interrupts_property()
1606 if ((phandle == 0) || (phandle == -1)) { in check_interrupts_property()
1609 if (dti->dtsflags & DTSF_PLUGIN) in check_interrupts_property()
1622 "Missing interrupt-controller or interrupt-map property"); in check_interrupts_property()
1627 parent = parent->parent; in check_interrupts_property()
1631 FAIL(c, dti, node, "Missing interrupt-parent"); in check_interrupts_property()
1635 prop = get_property(irq_node, "#interrupt-cells"); in check_interrupts_property()
1642 if (irq_prop->val.len % (irq_cells * sizeof(cell_t))) { in check_interrupts_property()
1645 irq_prop->val.len, (int)(irq_cells * sizeof(cell_t))); in check_interrupts_property()
1651 .name = "graph-port",
1655 .name = "graph-ports",
1664 if (!(strprefixeq(child->name, child->basenamelen, "endpoint") || in check_graph_nodes()
1665 get_property(child, "remote-endpoint"))) in check_graph_nodes()
1668 node->bus = &graph_port_bus; in check_graph_nodes()
1671 if (!node->parent->bus && in check_graph_nodes()
1672 (streq(node->parent->name, "ports") || get_property(node, "reg"))) in check_graph_nodes()
1673 node->parent->bus = &graph_ports_bus; in check_graph_nodes()
1687 if (node->bus != &graph_ports_bus && node->bus != &graph_port_bus) in check_graph_child_address()
1691 struct property *prop = get_property(child, "reg"); in check_graph_child_address()
1693 /* No error if we have any non-zero unit address */ in check_graph_child_address()
1700 if (cnt == 1 && node->addr_cells != -1) in check_graph_child_address()
1701 …FAIL(c, dti, node, "graph node has single child node '%s', #address-cells/#size-cells are not nece… in check_graph_child_address()
1702 node->children->name); in check_graph_child_address()
1711 struct property *prop; in check_graph_reg()
1713 prop = get_property(node, "reg"); in check_graph_reg()
1717 if (!(prop->val.val && prop->val.len == sizeof(cell_t))) { in check_graph_reg()
1718 FAIL(c, dti, node, "graph node malformed 'reg' property"); in check_graph_reg()
1727 if (node->parent->addr_cells != 1) in check_graph_reg()
1728 FAIL_PROP(c, dti, node, get_property(node, "#address-cells"), in check_graph_reg()
1729 "graph node '#address-cells' is %d, must be 1", in check_graph_reg()
1730 node->parent->addr_cells); in check_graph_reg()
1731 if (node->parent->size_cells != 0) in check_graph_reg()
1732 FAIL_PROP(c, dti, node, get_property(node, "#size-cells"), in check_graph_reg()
1733 "graph node '#size-cells' is %d, must be 0", in check_graph_reg()
1734 node->parent->size_cells); in check_graph_reg()
1740 if (node->bus != &graph_port_bus) in check_graph_port()
1743 if (!strprefixeq(node->name, node->basenamelen, "port")) in check_graph_port()
1755 struct property *prop; in get_remote_endpoint()
1757 prop = get_property(endpoint, "remote-endpoint"); in get_remote_endpoint()
1763 if (phandle == 0 || phandle == -1) in get_remote_endpoint()
1766 node = get_node_by_phandle(dti->dt, phandle); in get_remote_endpoint()
1778 if (!node->parent || node->parent->bus != &graph_port_bus) in check_graph_endpoint()
1781 if (!strprefixeq(node->name, node->basenamelen, "endpoint")) in check_graph_endpoint()
1792 remote_node->fullpath); in check_graph_endpoint()
1875 if ((warn && !c->warn) || (error && !c->error)) in enable_warning_error()
1876 for (i = 0; i < c->num_prereqs; i++) in enable_warning_error()
1877 enable_warning_error(c->prereq[i], warn, error); in enable_warning_error()
1879 c->warn = c->warn || warn; in enable_warning_error()
1880 c->error = c->error || error; in enable_warning_error()
1889 if ((warn && c->warn) || (error && c->error)) { in disable_warning_error()
1894 for (j = 0; j < cc->num_prereqs; j++) in disable_warning_error()
1895 if (cc->prereq[j] == c) in disable_warning_error()
1900 c->warn = c->warn && !warn; in disable_warning_error()
1901 c->error = c->error && !error; in disable_warning_error()
1910 if ((strncmp(arg, "no-", 3) == 0) in parse_checks_option()
1919 if (streq(c->name, name)) { in parse_checks_option()
1939 if (c->warn || c->error) in process_checks()
1946 "(use -f to force output)\n"); in process_checks()