Lines Matching refs:node
29 typedef void (*check_fn)(struct check *c, struct dt_info *dti, struct node *node);
62 struct node *node, in check_msg() argument
76 else if (node && node->srcpos) in check_msg()
77 pos = node->srcpos; in check_msg()
92 if (node) { 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()
120 #define FAIL(c, dti, node, ...) \ argument
124 check_msg((c), dti, node, NULL, __VA_ARGS__); \
127 #define FAIL_PROP(c, dti, node, prop, ...) \ argument
131 check_msg((c), dti, node, prop, __VA_ARGS__); \
135 static void check_nodes_props(struct check *c, struct dt_info *dti, struct node *node) in check_nodes_props() argument
137 struct node *child; in check_nodes_props()
139 TRACE(c, "%s", node->fullpath); in check_nodes_props()
141 c->fn(c, dti, node); in check_nodes_props()
143 for_each_child(node, child) in check_nodes_props()
157 struct node *dt = dti->dt; in run_check()
201 struct node *node) in check_always_fail() argument
203 FAIL(c, dti, node, "always_fail check"); in check_always_fail()
208 struct node *node) in check_is_string() argument
213 prop = get_property(node, propname); in check_is_string()
218 FAIL_PROP(c, dti, node, prop, "property is not a string"); in check_is_string()
226 struct node *node) in check_is_string_list() argument
233 prop = get_property(node, propname); in check_is_string_list()
242 FAIL_PROP(c, dti, node, prop, "property is not a string list"); in check_is_string_list()
255 struct node *node) in check_is_cell() argument
260 prop = get_property(node, propname); in check_is_cell()
265 FAIL_PROP(c, dti, node, prop, "property is not a single cell"); in check_is_cell()
277 struct node *node) in check_duplicate_node_names() argument
279 struct node *child, *child2; in check_duplicate_node_names()
281 for_each_child(node, child) in check_duplicate_node_names()
291 struct node *node) in check_duplicate_property_names() argument
295 for_each_property(node, prop) { in check_duplicate_property_names()
300 FAIL_PROP(c, dti, node, prop, "Duplicate property name"); in check_duplicate_property_names()
314 struct node *node) in check_node_name_chars() argument
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()
319 FAIL(c, dti, node, "Bad character '%c' in node name", in check_node_name_chars()
320 node->name[n]); in check_node_name_chars()
325 struct node *node) in check_node_name_chars_strict() argument
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()
330 FAIL(c, dti, node, "Character '%c' not recommended in node name", in check_node_name_chars_strict()
331 node->name[n]); in check_node_name_chars_strict()
336 struct node *node) in check_node_name_format() argument
338 if (strchr(get_unitname(node), '@')) in check_node_name_format()
339 FAIL(c, dti, node, "multiple '@' characters in node name"); in check_node_name_format()
344 struct node *node) in check_node_name_not_empty() argument
346 if (node->basenamelen == 0 && node->parent != NULL) in check_node_name_not_empty()
347 FAIL(c, dti, node, "Empty node name"); in check_node_name_not_empty()
353 struct node *node) in check_node_name_vs_property_name() argument
355 if (!node->parent) in check_node_name_vs_property_name()
358 if (get_property(node->parent, node->name)) { in check_node_name_vs_property_name()
359 FAIL(c, dti, node, "node name and property name conflict"); in check_node_name_vs_property_name()
366 struct node *node) in check_unit_address_vs_reg() argument
368 const char *unitname = get_unitname(node); in check_unit_address_vs_reg()
369 struct property *prop = get_property(node, "reg"); in check_unit_address_vs_reg()
371 if (get_subnode(node, "__overlay__")) { in check_unit_address_vs_reg()
377 prop = get_property(node, "ranges"); in check_unit_address_vs_reg()
384 FAIL(c, dti, node, "node has a reg or ranges property, but no unit name"); in check_unit_address_vs_reg()
387 FAIL(c, dti, node, "node has a unit name, but no reg or ranges property"); in check_unit_address_vs_reg()
393 struct node *node) in check_property_name_chars() argument
397 for_each_property(node, prop) { in check_property_name_chars()
401 FAIL_PROP(c, dti, node, prop, "Bad character '%c' in property name", in check_property_name_chars()
409 struct node *node) in check_property_name_chars_strict() argument
413 for_each_property(node, prop) { in check_property_name_chars_strict()
433 FAIL_PROP(c, dti, node, prop, "Character '%c' not recommended in property name", in check_property_name_chars_strict()
440 #define DESCLABEL_ARGS(node,prop,mark) \ argument
444 ((prop) ? "' in " : ""), (node)->fullpath
447 const char *label, struct node *node, in check_duplicate_label() argument
450 struct node *dt = dti->dt; in check_duplicate_label()
451 struct node *othernode = NULL; in check_duplicate_label()
466 if ((othernode != node) || (otherprop != prop) || (othermark != mark)) in check_duplicate_label()
467 FAIL(c, dti, node, "Duplicate label '%s' on " DESCLABEL_FMT in check_duplicate_label()
469 label, DESCLABEL_ARGS(node, prop, mark), in check_duplicate_label()
474 struct node *node) in check_duplicate_label_node() argument
479 for_each_label(node->labels, l) in check_duplicate_label_node()
480 check_duplicate_label(c, dti, l->label, node, NULL, NULL); in check_duplicate_label_node()
482 for_each_property(node, prop) { in check_duplicate_label_node()
486 check_duplicate_label(c, dti, l->label, node, prop, NULL); in check_duplicate_label_node()
489 check_duplicate_label(c, dti, m->ref, node, prop, m); in check_duplicate_label_node()
495 struct node *node, const char *propname) in check_phandle_prop() argument
497 struct node *root = dti->dt; in check_phandle_prop()
502 prop = get_property(node, propname); in check_phandle_prop()
507 FAIL_PROP(c, dti, node, prop, "bad length (%d) %s property", in check_phandle_prop()
515 if (node != get_node_by_ref(root, m->ref)) in check_phandle_prop()
519 FAIL(c, dti, node, "%s is a reference to another node", in check_phandle_prop()
533 FAIL_PROP(c, dti, node, prop, "bad value (0x%x) in %s property", in check_phandle_prop()
542 struct node *node) in check_explicit_phandles() argument
544 struct node *root = dti->dt; in check_explicit_phandles()
545 struct node *other; in check_explicit_phandles()
549 assert(!node->phandle); in check_explicit_phandles()
551 phandle = check_phandle_prop(c, dti, node, "phandle"); in check_explicit_phandles()
553 linux_phandle = check_phandle_prop(c, dti, node, "linux,phandle"); in check_explicit_phandles()
560 FAIL(c, dti, node, "mismatching 'phandle' and 'linux,phandle'" in check_explicit_phandles()
567 if (other && (other != node)) { in check_explicit_phandles()
568 FAIL(c, dti, node, "duplicated phandle 0x%x (seen before at %s)", in check_explicit_phandles()
573 node->phandle = phandle; in check_explicit_phandles()
578 struct node *node) in check_name_properties() argument
582 for (pp = &node->proplist; *pp; pp = &((*pp)->next)) in check_name_properties()
591 if ((prop->val.len != node->basenamelen + 1U) in check_name_properties()
592 || (memcmp(prop->val.val, node->name, node->basenamelen) != 0)) { in check_name_properties()
593 FAIL(c, dti, node, "\"name\" property is incorrect (\"%s\" instead" in check_name_properties()
612 struct node *node) in fixup_phandle_references() argument
614 struct node *dt = dti->dt; in fixup_phandle_references()
617 for_each_property(node, prop) { in fixup_phandle_references()
619 struct node *refnode; in fixup_phandle_references()
628 FAIL(c, dti, node, "Reference to non-existent node or " in fixup_phandle_references()
647 struct node *node) in fixup_path_references() argument
649 struct node *dt = dti->dt; in fixup_path_references()
652 for_each_property(node, prop) { in fixup_path_references()
654 struct node *refnode; in fixup_path_references()
662 FAIL(c, dti, node, "Reference to non-existent node or label \"%s\"\n", in fixup_path_references()
678 struct node *node) in fixup_omit_unused_nodes() argument
680 if (generate_symbols && node->labels) in fixup_omit_unused_nodes()
682 if (node->omit_if_unused && !node->is_referenced) in fixup_omit_unused_nodes()
683 delete_node(node); in fixup_omit_unused_nodes()
701 struct node *node) in check_names_is_string_list() argument
705 for_each_property(node, prop) { in check_names_is_string_list()
710 check_is_string_list(c, dti, node); in check_names_is_string_list()
716 struct node *node) in check_alias_paths() argument
720 if (!streq(node->name, "aliases")) in check_alias_paths()
723 for_each_property(node, prop) { in check_alias_paths()
732 FAIL_PROP(c, dti, node, prop, "aliases property is not a valid node (%s)", in check_alias_paths()
738 FAIL(c, dti, node, "aliases property name must include only lowercase and '-'"); in check_alias_paths()
744 struct node *node) in fixup_addr_size_cells() argument
748 node->addr_cells = -1; in fixup_addr_size_cells()
749 node->size_cells = -1; in fixup_addr_size_cells()
751 prop = get_property(node, "#address-cells"); in fixup_addr_size_cells()
753 node->addr_cells = propval_cell(prop); in fixup_addr_size_cells()
755 prop = get_property(node, "#size-cells"); in fixup_addr_size_cells()
757 node->size_cells = propval_cell(prop); in fixup_addr_size_cells()
768 struct node *node) in check_reg_format() argument
773 prop = get_property(node, "reg"); in check_reg_format()
777 if (!node->parent) { in check_reg_format()
778 FAIL(c, dti, node, "Root node has a \"reg\" property"); in check_reg_format()
783 FAIL_PROP(c, dti, node, prop, "property is empty"); in check_reg_format()
785 addr_cells = node_addr_cells(node->parent); in check_reg_format()
786 size_cells = node_size_cells(node->parent); in check_reg_format()
790 FAIL_PROP(c, dti, node, prop, "property has invalid length (%d bytes) " in check_reg_format()
797 struct node *node) in check_ranges_format() argument
803 prop = get_property(node, ranges); in check_ranges_format()
807 if (!node->parent) { in check_ranges_format()
808 FAIL_PROP(c, dti, node, prop, "Root node has a \"%s\" property", in check_ranges_format()
813 p_addr_cells = node_addr_cells(node->parent); in check_ranges_format()
814 p_size_cells = node_size_cells(node->parent); in check_ranges_format()
815 c_addr_cells = node_addr_cells(node); in check_ranges_format()
816 c_size_cells = node_size_cells(node); in check_ranges_format()
821 FAIL_PROP(c, dti, node, prop, "empty \"%s\" property but its " in check_ranges_format()
823 ranges, c_addr_cells, node->parent->fullpath, in check_ranges_format()
826 FAIL_PROP(c, dti, node, prop, "empty \"%s\" property but its " in check_ranges_format()
828 ranges, c_size_cells, node->parent->fullpath, in check_ranges_format()
831 FAIL_PROP(c, dti, node, prop, "\"%s\" property has invalid length (%d bytes) " in check_ranges_format()
844 static void check_pci_bridge(struct check *c, struct dt_info *dti, struct node *node) in check_pci_bridge() argument
849 prop = get_property(node, "device_type"); in check_pci_bridge()
853 node->bus = &pci_bus; in check_pci_bridge()
855 if (!strprefixeq(node->name, node->basenamelen, "pci") && in check_pci_bridge()
856 !strprefixeq(node->name, node->basenamelen, "pcie")) in check_pci_bridge()
857 FAIL(c, dti, node, "node name is not \"pci\" or \"pcie\""); in check_pci_bridge()
859 prop = get_property(node, "ranges"); in check_pci_bridge()
861 FAIL(c, dti, node, "missing ranges for PCI bridge (or not a bridge)"); in check_pci_bridge()
863 if (node_addr_cells(node) != 3) in check_pci_bridge()
864 FAIL(c, dti, node, "incorrect #address-cells for PCI bridge"); in check_pci_bridge()
865 if (node_size_cells(node) != 2) in check_pci_bridge()
866 FAIL(c, dti, node, "incorrect #size-cells for PCI bridge"); in check_pci_bridge()
868 prop = get_property(node, "bus-range"); in check_pci_bridge()
873 FAIL_PROP(c, dti, node, prop, "value must be 2 cells"); in check_pci_bridge()
878 FAIL_PROP(c, dti, node, prop, "1st cell must be less than or equal to 2nd cell"); in check_pci_bridge()
880 FAIL_PROP(c, dti, node, prop, "maximum bus number must be less than 256"); in check_pci_bridge()
885 static void check_pci_device_bus_num(struct check *c, struct dt_info *dti, struct node *node) in check_pci_device_bus_num() argument
891 if (!node->parent || (node->parent->bus != &pci_bus)) in check_pci_device_bus_num()
894 prop = get_property(node, "reg"); in check_pci_device_bus_num()
901 prop = get_property(node->parent, "bus-range"); in check_pci_device_bus_num()
910 FAIL_PROP(c, dti, node, prop, "PCI bus number %d out of range, expected (%d - %d)", in check_pci_device_bus_num()
915 static void check_pci_device_reg(struct check *c, struct dt_info *dti, struct node *node) in check_pci_device_reg() argument
918 const char *unitname = get_unitname(node); in check_pci_device_reg()
923 if (!node->parent || (node->parent->bus != &pci_bus)) in check_pci_device_reg()
926 prop = get_property(node, "reg"); in check_pci_device_reg()
932 FAIL_PROP(c, dti, node, prop, "PCI reg config space address cells 2 and 3 must be 0"); in check_pci_device_reg()
939 FAIL_PROP(c, dti, node, prop, "PCI reg address is not configuration space"); in check_pci_device_reg()
941 FAIL_PROP(c, dti, node, prop, "PCI reg config space address register number must be 0"); in check_pci_device_reg()
953 FAIL(c, dti, node, "PCI unit address format error, expected \"%s\"", in check_pci_device_reg()
962 static bool node_is_compatible(struct node *node, const char *compat) in node_is_compatible() argument
967 prop = get_property(node, "compatible"); in node_is_compatible()
979 static void check_simple_bus_bridge(struct check *c, struct dt_info *dti, struct node *node) in check_simple_bus_bridge() argument
981 if (node_is_compatible(node, "simple-bus")) in check_simple_bus_bridge()
982 node->bus = &simple_bus; in check_simple_bus_bridge()
987 static void check_simple_bus_reg(struct check *c, struct dt_info *dti, struct node *node) in check_simple_bus_reg() argument
990 const char *unitname = get_unitname(node); in check_simple_bus_reg()
996 if (!node->parent || (node->parent->bus != &simple_bus)) in check_simple_bus_reg()
999 prop = get_property(node, "reg"); in check_simple_bus_reg()
1003 prop = get_property(node, "ranges"); in check_simple_bus_reg()
1006 cells = ((cell_t *)prop->val.val) + node_addr_cells(node); in check_simple_bus_reg()
1010 if (node->parent->parent && !(node->bus == &simple_bus)) in check_simple_bus_reg()
1011 FAIL(c, dti, node, "missing or empty reg/ranges property"); in check_simple_bus_reg()
1015 size = node_addr_cells(node->parent); in check_simple_bus_reg()
1021 FAIL(c, dti, node, "simple-bus unit address format error, expected \"%s\"", in check_simple_bus_reg()
1030 static void check_i2c_bus_bridge(struct check *c, struct dt_info *dti, struct node *node) in check_i2c_bus_bridge() argument
1032 if (strprefixeq(node->name, node->basenamelen, "i2c-bus") || in check_i2c_bus_bridge()
1033 strprefixeq(node->name, node->basenamelen, "i2c-arb")) { in check_i2c_bus_bridge()
1034 node->bus = &i2c_bus; in check_i2c_bus_bridge()
1035 } else if (strprefixeq(node->name, node->basenamelen, "i2c")) { in check_i2c_bus_bridge()
1036 struct node *child; in check_i2c_bus_bridge()
1037 for_each_child(node, child) { in check_i2c_bus_bridge()
1041 node->bus = &i2c_bus; in check_i2c_bus_bridge()
1045 if (!node->children) in check_i2c_bus_bridge()
1048 if (node_addr_cells(node) != 1) in check_i2c_bus_bridge()
1049 FAIL(c, dti, node, "incorrect #address-cells for I2C bus"); in check_i2c_bus_bridge()
1050 if (node_size_cells(node) != 0) in check_i2c_bus_bridge()
1051 FAIL(c, dti, node, "incorrect #size-cells for I2C bus"); in check_i2c_bus_bridge()
1059 static void check_i2c_bus_reg(struct check *c, struct dt_info *dti, struct node *node) in check_i2c_bus_reg() argument
1062 const char *unitname = get_unitname(node); in check_i2c_bus_reg()
1068 if (!node->parent || (node->parent->bus != &i2c_bus)) in check_i2c_bus_reg()
1071 prop = get_property(node, "reg"); in check_i2c_bus_reg()
1076 FAIL(c, dti, node, "missing or empty reg property"); in check_i2c_bus_reg()
1085 FAIL(c, dti, node, "I2C bus unit address format error, expected \"%s\"", in check_i2c_bus_reg()
1095 FAIL_PROP(c, dti, node, prop, "I2C address must be less than 10-bits, got \"0x%x\"", in check_i2c_bus_reg()
1098 …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()
1108 static void check_spi_bus_bridge(struct check *c, struct dt_info *dti, struct node *node) in check_spi_bus_bridge() argument
1112 if (strprefixeq(node->name, node->basenamelen, "spi")) { in check_spi_bus_bridge()
1113 node->bus = &spi_bus; in check_spi_bus_bridge()
1116 struct node *child; in check_spi_bus_bridge()
1118 if (node_addr_cells(node) != 1 || node_size_cells(node) != 0) in check_spi_bus_bridge()
1121 for_each_child(node, child) { in check_spi_bus_bridge()
1125 node->bus = &spi_bus; in check_spi_bus_bridge()
1129 if (node->bus == &spi_bus) in check_spi_bus_bridge()
1133 if (node->bus == &spi_bus && get_property(node, "reg")) in check_spi_bus_bridge()
1134 FAIL(c, dti, node, "node name for SPI buses should be 'spi'"); in check_spi_bus_bridge()
1136 if (node->bus != &spi_bus || !node->children) in check_spi_bus_bridge()
1139 if (get_property(node, "spi-slave")) in check_spi_bus_bridge()
1141 if (node_addr_cells(node) != spi_addr_cells) in check_spi_bus_bridge()
1142 FAIL(c, dti, node, "incorrect #address-cells for SPI bus"); in check_spi_bus_bridge()
1143 if (node_size_cells(node) != 0) in check_spi_bus_bridge()
1144 FAIL(c, dti, node, "incorrect #size-cells for SPI bus"); in check_spi_bus_bridge()
1149 static void check_spi_bus_reg(struct check *c, struct dt_info *dti, struct node *node) in check_spi_bus_reg() argument
1152 const char *unitname = get_unitname(node); in check_spi_bus_reg()
1157 if (!node->parent || (node->parent->bus != &spi_bus)) in check_spi_bus_reg()
1160 if (get_property(node->parent, "spi-slave")) in check_spi_bus_reg()
1163 prop = get_property(node, "reg"); in check_spi_bus_reg()
1168 FAIL(c, dti, node, "missing or empty reg property"); in check_spi_bus_reg()
1175 FAIL(c, dti, node, "SPI bus unit address format error, expected \"%s\"", in check_spi_bus_reg()
1181 struct node *node) in check_unit_address_format() argument
1183 const char *unitname = get_unitname(node); in check_unit_address_format()
1185 if (node->parent && node->parent->bus) in check_unit_address_format()
1192 FAIL(c, dti, node, "unit name should not have leading \"0x\""); in check_unit_address_format()
1197 FAIL(c, dti, node, "unit name should not have leading 0s"); in check_unit_address_format()
1206 struct node *node) in check_avoid_default_addr_size() argument
1210 if (!node->parent) in check_avoid_default_addr_size()
1213 reg = get_property(node, "reg"); in check_avoid_default_addr_size()
1214 ranges = get_property(node, "ranges"); in check_avoid_default_addr_size()
1219 if (node->parent->addr_cells == -1) in check_avoid_default_addr_size()
1220 FAIL(c, dti, node, "Relying on default #address-cells value"); in check_avoid_default_addr_size()
1222 if (node->parent->size_cells == -1) in check_avoid_default_addr_size()
1223 FAIL(c, dti, node, "Relying on default #size-cells value"); in check_avoid_default_addr_size()
1229 struct node *node) in check_avoid_unnecessary_addr_size() argument
1231 struct node *child; in check_avoid_unnecessary_addr_size()
1233 if (!node->parent || node->addr_cells < 0 || node->size_cells < 0) in check_avoid_unnecessary_addr_size()
1236 if (get_property(node, "ranges") || get_property(node, "dma-ranges") || !node->children) in check_avoid_unnecessary_addr_size()
1239 for_each_child(node, child) { in check_avoid_unnecessary_addr_size()
1251 …FAIL(c, dti, node, "unnecessary #address-cells/#size-cells without \"ranges\", \"dma-ranges\" or c… in check_avoid_unnecessary_addr_size()
1255 static bool node_is_disabled(struct node *node) in node_is_disabled() argument
1259 prop = get_property(node, "status"); in node_is_disabled()
1271 struct node *node, in check_unique_unit_address_common() argument
1274 struct node *childa; in check_unique_unit_address_common()
1276 if (node->addr_cells < 0 || node->size_cells < 0) in check_unique_unit_address_common()
1279 if (!node->children) in check_unique_unit_address_common()
1282 for_each_child(node, childa) { in check_unique_unit_address_common()
1283 struct node *childb; in check_unique_unit_address_common()
1292 for_each_child(node, childb) { in check_unique_unit_address_common()
1307 struct node *node) in check_unique_unit_address() argument
1309 check_unique_unit_address_common(c, dti, node, false); in check_unique_unit_address()
1314 struct node *node) in check_unique_unit_address_if_enabled() argument
1316 check_unique_unit_address_common(c, dti, node, true); in check_unique_unit_address_if_enabled()
1323 struct node *node) in check_obsolete_chosen_interrupt_controller() argument
1325 struct node *dt = dti->dt; in check_obsolete_chosen_interrupt_controller()
1326 struct node *chosen; in check_obsolete_chosen_interrupt_controller()
1329 if (node != dt) in check_obsolete_chosen_interrupt_controller()
1339 FAIL_PROP(c, dti, node, prop, in check_obsolete_chosen_interrupt_controller()
1346 struct node *node) in check_chosen_node_is_root() argument
1348 if (!streq(node->name, "chosen")) in check_chosen_node_is_root()
1351 if (node->parent != dti->dt) in check_chosen_node_is_root()
1352 FAIL(c, dti, node, "chosen node must be at root node"); in check_chosen_node_is_root()
1357 struct node *node) in check_chosen_node_bootargs() argument
1361 if (!streq(node->name, "chosen")) in check_chosen_node_bootargs()
1364 prop = get_property(node, "bootargs"); in check_chosen_node_bootargs()
1369 check_is_string(c, dti, node); in check_chosen_node_bootargs()
1374 struct node *node) in check_chosen_node_stdout_path() argument
1378 if (!streq(node->name, "chosen")) in check_chosen_node_stdout_path()
1381 prop = get_property(node, "stdout-path"); in check_chosen_node_stdout_path()
1383 prop = get_property(node, "linux,stdout-path"); in check_chosen_node_stdout_path()
1386 FAIL_PROP(c, dti, node, prop, "Use 'stdout-path' instead"); in check_chosen_node_stdout_path()
1390 check_is_string(c, dti, node); in check_chosen_node_stdout_path()
1402 struct node *node, in check_property_phandle_args() argument
1406 struct node *root = dti->dt; in check_property_phandle_args()
1410 FAIL_PROP(c, dti, node, prop, in check_property_phandle_args()
1417 struct node *provider_node; in check_property_phandle_args()
1444 FAIL_PROP(c, dti, node, prop, in check_property_phandle_args()
1451 FAIL_PROP(c, dti, node, prop, in check_property_phandle_args()
1463 FAIL(c, dti, node, "Missing property '%s' in node %s or bad phandle (referred from %s[%d])", in check_property_phandle_args()
1472 FAIL_PROP(c, dti, node, prop, in check_property_phandle_args()
1482 struct node *node) in check_provider_cells_property() argument
1487 prop = get_property(node, provider->prop_name); in check_provider_cells_property()
1491 check_property_phandle_args(c, dti, node, prop, provider); in check_provider_cells_property()
1532 struct node *node) in check_gpios_property() argument
1537 if (get_property(node, "gpio-hog")) in check_gpios_property()
1540 for_each_property(node, prop) { in check_gpios_property()
1549 check_property_phandle_args(c, dti, node, prop, &provider); in check_gpios_property()
1557 struct node *node) in check_deprecated_gpio_property() argument
1561 for_each_property(node, prop) { in check_deprecated_gpio_property()
1568 FAIL_PROP(c, dti, node, prop, in check_deprecated_gpio_property()
1575 static bool node_is_interrupt_provider(struct node *node) in node_is_interrupt_provider() argument
1579 prop = get_property(node, "interrupt-controller"); in node_is_interrupt_provider()
1583 prop = get_property(node, "interrupt-map"); in node_is_interrupt_provider()
1592 struct node *node) in check_interrupt_provider() argument
1595 bool irq_provider = node_is_interrupt_provider(node); in check_interrupt_provider()
1597 prop = get_property(node, "#interrupt-cells"); in check_interrupt_provider()
1599 FAIL(c, dti, node, in check_interrupt_provider()
1605 FAIL(c, dti, node, in check_interrupt_provider()
1614 struct node *node) in check_interrupt_map() argument
1616 struct node *root = dti->dt; in check_interrupt_map()
1620 irq_map_prop = get_property(node, "interrupt-map"); in check_interrupt_map()
1624 if (node->addr_cells < 0) { in check_interrupt_map()
1625 FAIL(c, dti, node, in check_interrupt_map()
1629 cellsize = node_addr_cells(node); in check_interrupt_map()
1630 cellsize += propval_cell(get_property(node, "#interrupt-cells")); in check_interrupt_map()
1632 prop = get_property(node, "interrupt-map-mask"); in check_interrupt_map()
1634 FAIL_PROP(c, dti, node, prop, in check_interrupt_map()
1639 FAIL_PROP(c, dti, node, irq_map_prop, in check_interrupt_map()
1647 struct node *provider_node; in check_interrupt_map()
1653 FAIL_PROP(c, dti, node, irq_map_prop, in check_interrupt_map()
1664 FAIL_PROP(c, dti, node, irq_map_prop, in check_interrupt_map()
1672 FAIL_PROP(c, dti, node, irq_map_prop, in check_interrupt_map()
1682 …FAIL(c, dti, node, "Missing property '#interrupt-cells' in node %s or bad phandle (referred from i… in check_interrupt_map()
1691 FAIL_PROP(c, dti, node, irq_map_prop, in check_interrupt_map()
1697 FAIL_PROP(c, dti, node, irq_map_prop, in check_interrupt_map()
1706 struct node *node) in check_interrupts_property() argument
1708 struct node *root = dti->dt; in check_interrupts_property()
1709 struct node *irq_node = NULL, *parent = node; in check_interrupts_property()
1713 irq_prop = get_property(node, "interrupts"); in check_interrupts_property()
1718 FAIL_PROP(c, dti, node, irq_prop, "size (%d) is invalid, expected multiple of %zu", in check_interrupts_property()
1722 if (parent != node && node_is_interrupt_provider(parent)) { in check_interrupts_property()
1755 FAIL(c, dti, node, "Missing interrupt-parent"); in check_interrupts_property()
1767 FAIL_PROP(c, dti, node, prop, in check_interrupts_property()
1783 struct node *node) in check_graph_nodes() argument
1785 struct node *child; in check_graph_nodes()
1787 for_each_child(node, child) { in check_graph_nodes()
1793 if (!node->parent) { in check_graph_nodes()
1794 …FAIL(c, dti, node, "root node contains endpoint node '%s', potentially misplaced remote-endpoint p… in check_graph_nodes()
1797 node->bus = &graph_port_bus; in check_graph_nodes()
1800 if (!node->parent->bus && in check_graph_nodes()
1801 (streq(node->parent->name, "ports") || get_property(node, "reg"))) in check_graph_nodes()
1802 node->parent->bus = &graph_ports_bus; in check_graph_nodes()
1811 struct node *node) in check_graph_reg() argument
1814 const char *unitname = get_unitname(node); in check_graph_reg()
1817 prop = get_property(node, "reg"); in check_graph_reg()
1822 FAIL(c, dti, node, "graph node malformed 'reg' property"); in check_graph_reg()
1828 FAIL(c, dti, node, "graph node unit address error, expected \"%s\"", in check_graph_reg()
1831 if (node->parent->addr_cells != 1) in check_graph_reg()
1832 FAIL_PROP(c, dti, node, get_property(node, "#address-cells"), in check_graph_reg()
1834 node->parent->addr_cells); in check_graph_reg()
1835 if (node->parent->size_cells != 0) in check_graph_reg()
1836 FAIL_PROP(c, dti, node, get_property(node, "#size-cells"), in check_graph_reg()
1838 node->parent->size_cells); in check_graph_reg()
1842 struct node *node) in check_graph_port() argument
1844 if (node->bus != &graph_port_bus) in check_graph_port()
1847 check_graph_reg(c, dti, node); in check_graph_port()
1853 if (!strprefixeq(node->name, node->basenamelen, "port")) in check_graph_port()
1854 FAIL(c, dti, node, "graph port node name should be 'port'"); in check_graph_port()
1858 static struct node *get_remote_endpoint(struct check *c, struct dt_info *dti, in get_remote_endpoint()
1859 struct node *endpoint) in get_remote_endpoint()
1862 struct node *node; in get_remote_endpoint() local
1874 node = get_node_by_phandle(dti->dt, phandle); in get_remote_endpoint()
1875 if (!node) in get_remote_endpoint()
1878 return node; in get_remote_endpoint()
1882 struct node *node) in check_graph_endpoint() argument
1884 struct node *remote_node; in check_graph_endpoint()
1886 if (!node->parent || node->parent->bus != &graph_port_bus) in check_graph_endpoint()
1889 check_graph_reg(c, dti, node); in check_graph_endpoint()
1895 if (!strprefixeq(node->name, node->basenamelen, "endpoint")) in check_graph_endpoint()
1896 FAIL(c, dti, node, "graph endpoint node name should be 'endpoint'"); in check_graph_endpoint()
1898 remote_node = get_remote_endpoint(c, dti, node); in check_graph_endpoint()
1902 if (get_remote_endpoint(c, dti, remote_node) != node) in check_graph_endpoint()
1903 FAIL(c, dti, node, "graph connection to node '%s' is not bidirectional", in check_graph_endpoint()