Lines Matching +full:dt +full:- +full:node
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
26 fprintf(stderr, "=== %s: ", (c)->name); \
43 typedef void (*check_fn)(struct check *c, struct dt_info *dti, struct node *node);
76 struct node *node, in check_msg() argument
83 if ((c->warn && (quiet < 1)) in check_msg()
84 || (c->error && (quiet < 2))) { in check_msg()
86 strcmp(dti->outname, "-") ? dti->outname : "<stdout>", in check_msg()
87 (c->error) ? "ERROR" : "Warning", c->name); in check_msg()
88 if (node) { in check_msg()
89 fprintf(stderr, "%s", node->fullpath); in check_msg()
91 fprintf(stderr, ":%s", prop->name); in check_msg()
100 #define FAIL(c, dti, node, ...) \ argument
103 (c)->status = FAILED; \
104 check_msg((c), dti, node, NULL, __VA_ARGS__); \
107 #define FAIL_PROP(c, dti, node, prop, ...) \ argument
110 (c)->status = FAILED; \
111 check_msg((c), dti, node, prop, __VA_ARGS__); \
115 static void check_nodes_props(struct check *c, struct dt_info *dti, struct node *node) in check_nodes_props() argument
117 struct node *child; in check_nodes_props()
119 TRACE(c, "%s", node->fullpath); in check_nodes_props()
120 if (c->fn) in check_nodes_props()
121 c->fn(c, dti, node); in check_nodes_props()
123 for_each_child(node, child) in check_nodes_props()
129 struct node *dt = dti->dt; in run_check() local
133 assert(!c->inprogress); in run_check()
135 if (c->status != UNCHECKED) in run_check()
138 c->inprogress = true; in run_check()
140 for (i = 0; i < c->num_prereqs; i++) { in run_check()
141 struct check *prq = c->prereq[i]; in run_check()
143 if (prq->status != PASSED) { in run_check()
144 c->status = PREREQ; in run_check()
146 c->prereq[i]->name); in run_check()
150 if (c->status != UNCHECKED) in run_check()
153 check_nodes_props(c, dti, dt); in run_check()
155 if (c->status == UNCHECKED) in run_check()
156 c->status = PASSED; in run_check()
158 TRACE(c, "\tCompleted, status %d", c->status); in run_check()
161 c->inprogress = false; in run_check()
162 if ((c->status != PASSED) && (c->error)) in run_check()
173 struct node *node) in check_always_fail() argument
175 FAIL(c, dti, node, "always_fail check"); in check_always_fail()
180 struct node *node) in check_is_string() argument
183 char *propname = c->data; in check_is_string()
185 prop = get_property(node, propname); in check_is_string()
189 if (!data_is_one_string(prop->val)) in check_is_string()
190 FAIL_PROP(c, dti, node, prop, "property is not a string"); in check_is_string()
198 struct node *node) in check_is_string_list() argument
202 char *propname = c->data; in check_is_string_list()
205 prop = get_property(node, propname); in check_is_string_list()
209 str = prop->val.val; in check_is_string_list()
210 rem = prop->val.len; in check_is_string_list()
214 FAIL_PROP(c, dti, node, prop, "property is not a string list"); in check_is_string_list()
217 rem -= l + 1; in check_is_string_list()
227 struct node *node) in check_is_cell() argument
230 char *propname = c->data; in check_is_cell()
232 prop = get_property(node, propname); in check_is_cell()
236 if (prop->val.len != sizeof(cell_t)) in check_is_cell()
237 FAIL_PROP(c, dti, node, prop, "property is not a single cell"); in check_is_cell()
249 struct node *node) in check_duplicate_node_names() argument
251 struct node *child, *child2; in check_duplicate_node_names()
253 for_each_child(node, child) in check_duplicate_node_names()
254 for (child2 = child->next_sibling; in check_duplicate_node_names()
256 child2 = child2->next_sibling) in check_duplicate_node_names()
257 if (streq(child->name, child2->name)) in check_duplicate_node_names()
258 FAIL(c, dti, node, "Duplicate node name"); in check_duplicate_node_names()
263 struct node *node) in check_duplicate_property_names() argument
267 for_each_property(node, prop) { in check_duplicate_property_names()
268 for (prop2 = prop->next; prop2; prop2 = prop2->next) { in check_duplicate_property_names()
269 if (prop2->deleted) in check_duplicate_property_names()
271 if (streq(prop->name, prop2->name)) in check_duplicate_property_names()
272 FAIL_PROP(c, dti, node, prop, "Duplicate property name"); in check_duplicate_property_names()
281 #define PROPNODECHARS LOWERCASE UPPERCASE DIGITS ",._+*#?-"
282 #define PROPNODECHARSSTRICT LOWERCASE UPPERCASE DIGITS ",-"
285 struct node *node) in check_node_name_chars() argument
287 int n = strspn(node->name, c->data); in check_node_name_chars()
289 if (n < strlen(node->name)) in check_node_name_chars()
290 FAIL(c, dti, node, "Bad character '%c' in node name", in check_node_name_chars()
291 node->name[n]); in check_node_name_chars()
296 struct node *node) in check_node_name_chars_strict() argument
298 int n = strspn(node->name, c->data); in check_node_name_chars_strict()
300 if (n < node->basenamelen) in check_node_name_chars_strict()
301 FAIL(c, dti, node, "Character '%c' not recommended in node name", in check_node_name_chars_strict()
302 node->name[n]); in check_node_name_chars_strict()
307 struct node *node) in check_node_name_format() argument
309 if (strchr(get_unitname(node), '@')) in check_node_name_format()
310 FAIL(c, dti, node, "multiple '@' characters in node name"); in check_node_name_format()
315 struct node *node) in check_unit_address_vs_reg() argument
317 const char *unitname = get_unitname(node); in check_unit_address_vs_reg()
318 struct property *prop = get_property(node, "reg"); in check_unit_address_vs_reg()
321 prop = get_property(node, "ranges"); in check_unit_address_vs_reg()
322 if (prop && !prop->val.len) in check_unit_address_vs_reg()
328 FAIL(c, dti, node, "node has a reg or ranges property, but no unit name"); in check_unit_address_vs_reg()
331 FAIL(c, dti, node, "node has a unit name, but no reg property"); in check_unit_address_vs_reg()
337 struct node *node) in check_property_name_chars() argument
341 for_each_property(node, prop) { in check_property_name_chars()
342 int n = strspn(prop->name, c->data); in check_property_name_chars()
344 if (n < strlen(prop->name)) in check_property_name_chars()
345 FAIL_PROP(c, dti, node, prop, "Bad character '%c' in property name", in check_property_name_chars()
346 prop->name[n]); in check_property_name_chars()
353 struct node *node) in check_property_name_chars_strict() argument
357 for_each_property(node, prop) { in check_property_name_chars_strict()
358 const char *name = prop->name; in check_property_name_chars_strict()
359 int n = strspn(name, c->data); in check_property_name_chars_strict()
361 if (n == strlen(prop->name)) in check_property_name_chars_strict()
372 if (name[n] == '#' && ((n == 0) || (name[n-1] == ','))) { in check_property_name_chars_strict()
374 n = strspn(name, c->data); in check_property_name_chars_strict()
377 FAIL_PROP(c, dti, node, prop, "Character '%c' not recommended in property name", in check_property_name_chars_strict()
384 #define DESCLABEL_ARGS(node,prop,mark) \ argument
387 ((prop) ? (prop)->name : ""), \
388 ((prop) ? "' in " : ""), (node)->fullpath
391 const char *label, struct node *node, in check_duplicate_label() argument
394 struct node *dt = dti->dt; in check_duplicate_label() local
395 struct node *othernode = NULL; in check_duplicate_label()
399 othernode = get_node_by_label(dt, label); in check_duplicate_label()
402 otherprop = get_property_by_label(dt, label, &othernode); in check_duplicate_label()
404 othermark = get_marker_label(dt, label, &othernode, in check_duplicate_label()
410 if ((othernode != node) || (otherprop != prop) || (othermark != mark)) in check_duplicate_label()
411 FAIL(c, dti, node, "Duplicate label '%s' on " DESCLABEL_FMT in check_duplicate_label()
413 label, DESCLABEL_ARGS(node, prop, mark), in check_duplicate_label()
418 struct node *node) in check_duplicate_label_node() argument
423 for_each_label(node->labels, l) in check_duplicate_label_node()
424 check_duplicate_label(c, dti, l->label, node, NULL, NULL); in check_duplicate_label_node()
426 for_each_property(node, prop) { in check_duplicate_label_node()
427 struct marker *m = prop->val.markers; in check_duplicate_label_node()
429 for_each_label(prop->labels, l) in check_duplicate_label_node()
430 check_duplicate_label(c, dti, l->label, node, prop, NULL); in check_duplicate_label_node()
433 check_duplicate_label(c, dti, m->ref, node, prop, m); in check_duplicate_label_node()
439 struct node *node, const char *propname) in check_phandle_prop() argument
441 struct node *root = dti->dt; in check_phandle_prop()
446 prop = get_property(node, propname); in check_phandle_prop()
450 if (prop->val.len != sizeof(cell_t)) { in check_phandle_prop()
451 FAIL_PROP(c, dti, node, prop, "bad length (%d) %s property", in check_phandle_prop()
452 prop->val.len, prop->name); in check_phandle_prop()
456 m = prop->val.markers; in check_phandle_prop()
458 assert(m->offset == 0); in check_phandle_prop()
459 if (node != get_node_by_ref(root, m->ref)) in check_phandle_prop()
460 /* "Set this node's phandle equal to some in check_phandle_prop()
461 * other node's phandle". That's nonsensical in check_phandle_prop()
463 FAIL(c, dti, node, "%s is a reference to another node", in check_phandle_prop()
464 prop->name); in check_phandle_prop()
466 /* But setting this node's phandle equal to its own in check_phandle_prop()
467 * phandle is allowed - that means allocate a unique in check_phandle_prop()
468 * phandle for this node, even if it's not otherwise in check_phandle_prop()
476 if ((phandle == 0) || (phandle == -1)) { in check_phandle_prop()
477 FAIL_PROP(c, dti, node, prop, "bad value (0x%x) in %s property", in check_phandle_prop()
478 phandle, prop->name); in check_phandle_prop()
486 struct node *node) in check_explicit_phandles() argument
488 struct node *root = dti->dt; in check_explicit_phandles()
489 struct node *other; in check_explicit_phandles()
493 assert(!node->phandle); in check_explicit_phandles()
495 phandle = check_phandle_prop(c, dti, node, "phandle"); in check_explicit_phandles()
497 linux_phandle = check_phandle_prop(c, dti, node, "linux,phandle"); in check_explicit_phandles()
504 FAIL(c, dti, node, "mismatching 'phandle' and 'linux,phandle'" in check_explicit_phandles()
511 if (other && (other != node)) { in check_explicit_phandles()
512 FAIL(c, dti, node, "duplicated phandle 0x%x (seen before at %s)", in check_explicit_phandles()
513 phandle, other->fullpath); in check_explicit_phandles()
517 node->phandle = phandle; in check_explicit_phandles()
522 struct node *node) in check_name_properties() argument
526 for (pp = &node->proplist; *pp; pp = &((*pp)->next)) in check_name_properties()
527 if (streq((*pp)->name, "name")) { in check_name_properties()
535 if ((prop->val.len != node->basenamelen+1) in check_name_properties()
536 || (memcmp(prop->val.val, node->name, node->basenamelen) != 0)) { in check_name_properties()
537 FAIL(c, dti, node, "\"name\" property is incorrect (\"%s\" instead" in check_name_properties()
538 " of base node name)", prop->val.val); in check_name_properties()
542 *pp = prop->next; in check_name_properties()
543 free(prop->name); in check_name_properties()
544 data_free(prop->val); in check_name_properties()
556 struct node *node) in fixup_phandle_references() argument
558 struct node *dt = dti->dt; in fixup_phandle_references() local
561 for_each_property(node, prop) { in fixup_phandle_references()
562 struct marker *m = prop->val.markers; in fixup_phandle_references()
563 struct node *refnode; in fixup_phandle_references()
567 assert(m->offset + sizeof(cell_t) <= prop->val.len); in fixup_phandle_references()
569 refnode = get_node_by_ref(dt, m->ref); in fixup_phandle_references()
571 if (!(dti->dtsflags & DTSF_PLUGIN)) in fixup_phandle_references()
572 FAIL(c, dti, node, "Reference to non-existent node or " in fixup_phandle_references()
573 "label \"%s\"\n", m->ref); in fixup_phandle_references()
575 *((fdt32_t *)(prop->val.val + m->offset)) = in fixup_phandle_references()
580 phandle = get_node_phandle(dt, refnode); in fixup_phandle_references()
581 *((fdt32_t *)(prop->val.val + m->offset)) = cpu_to_fdt32(phandle); in fixup_phandle_references()
589 struct node *node) in fixup_path_references() argument
591 struct node *dt = dti->dt; in fixup_path_references() local
594 for_each_property(node, prop) { in fixup_path_references()
595 struct marker *m = prop->val.markers; in fixup_path_references()
596 struct node *refnode; in fixup_path_references()
600 assert(m->offset <= prop->val.len); in fixup_path_references()
602 refnode = get_node_by_ref(dt, m->ref); in fixup_path_references()
604 FAIL(c, dti, node, "Reference to non-existent node or label \"%s\"\n", in fixup_path_references()
605 m->ref); in fixup_path_references()
609 path = refnode->fullpath; in fixup_path_references()
610 prop->val = data_insert_at_marker(prop->val, m, path, in fixup_path_references()
620 WARNING_IF_NOT_CELL(address_cells_is_cell, "#address-cells");
621 WARNING_IF_NOT_CELL(size_cells_is_cell, "#size-cells");
622 WARNING_IF_NOT_CELL(interrupt_cells_is_cell, "#interrupt-cells");
632 struct node *node) in check_names_is_string_list() argument
636 for_each_property(node, prop) { in check_names_is_string_list()
637 const char *s = strrchr(prop->name, '-'); in check_names_is_string_list()
638 if (!s || !streq(s, "-names")) in check_names_is_string_list()
641 c->data = prop->name; in check_names_is_string_list()
642 check_is_string_list(c, dti, node); in check_names_is_string_list()
648 struct node *node) in check_alias_paths() argument
652 if (!streq(node->name, "aliases")) in check_alias_paths()
655 for_each_property(node, prop) { in check_alias_paths()
656 if (!prop->val.val || !get_node_by_path(dti->dt, prop->val.val)) { in check_alias_paths()
657 FAIL_PROP(c, dti, node, prop, "aliases property is not a valid node (%s)", in check_alias_paths()
658 prop->val.val); in check_alias_paths()
661 if (strspn(prop->name, LOWERCASE DIGITS "-") != strlen(prop->name)) in check_alias_paths()
662 FAIL(c, dti, node, "aliases property name must include only lowercase and '-'"); in check_alias_paths()
668 struct node *node) in fixup_addr_size_cells() argument
672 node->addr_cells = -1; in fixup_addr_size_cells()
673 node->size_cells = -1; in fixup_addr_size_cells()
675 prop = get_property(node, "#address-cells"); in fixup_addr_size_cells()
677 node->addr_cells = propval_cell(prop); in fixup_addr_size_cells()
679 prop = get_property(node, "#size-cells"); in fixup_addr_size_cells()
681 node->size_cells = propval_cell(prop); in fixup_addr_size_cells()
687 (((n)->addr_cells == -1) ? 2 : (n)->addr_cells)
689 (((n)->size_cells == -1) ? 1 : (n)->size_cells)
692 struct node *node) in check_reg_format() argument
697 prop = get_property(node, "reg"); in check_reg_format()
701 if (!node->parent) { in check_reg_format()
702 FAIL(c, dti, node, "Root node has a \"reg\" property"); in check_reg_format()
706 if (prop->val.len == 0) in check_reg_format()
707 FAIL_PROP(c, dti, node, prop, "property is empty"); in check_reg_format()
709 addr_cells = node_addr_cells(node->parent); in check_reg_format()
710 size_cells = node_size_cells(node->parent); in check_reg_format()
713 if (!entrylen || (prop->val.len % entrylen) != 0) in check_reg_format()
714 FAIL_PROP(c, dti, node, prop, "property has invalid length (%d bytes) " in check_reg_format()
715 "(#address-cells == %d, #size-cells == %d)", in check_reg_format()
716 prop->val.len, addr_cells, size_cells); in check_reg_format()
721 struct node *node) in check_ranges_format() argument
726 prop = get_property(node, "ranges"); in check_ranges_format()
730 if (!node->parent) { in check_ranges_format()
731 FAIL_PROP(c, dti, node, prop, "Root node has a \"ranges\" property"); in check_ranges_format()
735 p_addr_cells = node_addr_cells(node->parent); in check_ranges_format()
736 p_size_cells = node_size_cells(node->parent); in check_ranges_format()
737 c_addr_cells = node_addr_cells(node); in check_ranges_format()
738 c_size_cells = node_size_cells(node); in check_ranges_format()
741 if (prop->val.len == 0) { in check_ranges_format()
743 FAIL_PROP(c, dti, node, prop, "empty \"ranges\" property but its " in check_ranges_format()
744 "#address-cells (%d) differs from %s (%d)", in check_ranges_format()
745 c_addr_cells, node->parent->fullpath, in check_ranges_format()
748 FAIL_PROP(c, dti, node, prop, "empty \"ranges\" property but its " in check_ranges_format()
749 "#size-cells (%d) differs from %s (%d)", in check_ranges_format()
750 c_size_cells, node->parent->fullpath, in check_ranges_format()
752 } else if ((prop->val.len % entrylen) != 0) { in check_ranges_format()
753 FAIL_PROP(c, dti, node, prop, "\"ranges\" property has invalid length (%d bytes) " in check_ranges_format()
754 "(parent #address-cells == %d, child #address-cells == %d, " in check_ranges_format()
755 "#size-cells == %d)", prop->val.len, in check_ranges_format()
765 static void check_pci_bridge(struct check *c, struct dt_info *dti, struct node *node) in check_pci_bridge() argument
770 prop = get_property(node, "device_type"); in check_pci_bridge()
771 if (!prop || !streq(prop->val.val, "pci")) in check_pci_bridge()
774 node->bus = &pci_bus; in check_pci_bridge()
776 if (!strprefixeq(node->name, node->basenamelen, "pci") && in check_pci_bridge()
777 !strprefixeq(node->name, node->basenamelen, "pcie")) in check_pci_bridge()
778 FAIL(c, dti, node, "node name is not \"pci\" or \"pcie\""); in check_pci_bridge()
780 prop = get_property(node, "ranges"); in check_pci_bridge()
782 FAIL(c, dti, node, "missing ranges for PCI bridge (or not a bridge)"); in check_pci_bridge()
784 if (node_addr_cells(node) != 3) in check_pci_bridge()
785 FAIL(c, dti, node, "incorrect #address-cells for PCI bridge"); in check_pci_bridge()
786 if (node_size_cells(node) != 2) in check_pci_bridge()
787 FAIL(c, dti, node, "incorrect #size-cells for PCI bridge"); in check_pci_bridge()
789 prop = get_property(node, "bus-range"); in check_pci_bridge()
791 FAIL(c, dti, node, "missing bus-range for PCI bridge"); in check_pci_bridge()
794 if (prop->val.len != (sizeof(cell_t) * 2)) { in check_pci_bridge()
795 FAIL_PROP(c, dti, node, prop, "value must be 2 cells"); in check_pci_bridge()
798 cells = (cell_t *)prop->val.val; in check_pci_bridge()
800 FAIL_PROP(c, dti, node, prop, "1st cell must be less than or equal to 2nd cell"); in check_pci_bridge()
802 FAIL_PROP(c, dti, node, prop, "maximum bus number must be less than 256"); in check_pci_bridge()
807 static void check_pci_device_bus_num(struct check *c, struct dt_info *dti, struct node *node) in check_pci_device_bus_num() argument
813 if (!node->parent || (node->parent->bus != &pci_bus)) in check_pci_device_bus_num()
816 prop = get_property(node, "reg"); in check_pci_device_bus_num()
820 cells = (cell_t *)prop->val.val; in check_pci_device_bus_num()
823 prop = get_property(node->parent, "bus-range"); in check_pci_device_bus_num()
827 cells = (cell_t *)prop->val.val; in check_pci_device_bus_num()
832 FAIL_PROP(c, dti, node, prop, "PCI bus number %d out of range, expected (%d - %d)", in check_pci_device_bus_num()
837 static void check_pci_device_reg(struct check *c, struct dt_info *dti, struct node *node) in check_pci_device_reg() argument
840 const char *unitname = get_unitname(node); in check_pci_device_reg()
845 if (!node->parent || (node->parent->bus != &pci_bus)) in check_pci_device_reg()
848 prop = get_property(node, "reg"); in check_pci_device_reg()
850 FAIL(c, dti, node, "missing PCI reg property"); in check_pci_device_reg()
854 cells = (cell_t *)prop->val.val; in check_pci_device_reg()
856 FAIL_PROP(c, dti, node, prop, "PCI reg config space address cells 2 and 3 must be 0"); in check_pci_device_reg()
863 FAIL_PROP(c, dti, node, prop, "PCI reg address is not configuration space"); in check_pci_device_reg()
865 FAIL_PROP(c, dti, node, prop, "PCI reg config space address register number must be 0"); in check_pci_device_reg()
877 FAIL(c, dti, node, "PCI unit address format error, expected \"%s\"", in check_pci_device_reg()
883 .name = "simple-bus",
886 static bool node_is_compatible(struct node *node, const char *compat) in node_is_compatible() argument
891 prop = get_property(node, "compatible"); in node_is_compatible()
895 for (str = prop->val.val, end = str + prop->val.len; str < end; in node_is_compatible()
896 str += strnlen(str, end - str) + 1) { in node_is_compatible()
897 if (strprefixeq(str, end - str, compat)) in node_is_compatible()
903 static void check_simple_bus_bridge(struct check *c, struct dt_info *dti, struct node *node) in check_simple_bus_bridge() argument
905 if (node_is_compatible(node, "simple-bus")) in check_simple_bus_bridge()
906 node->bus = &simple_bus; in check_simple_bus_bridge()
910 static void check_simple_bus_reg(struct check *c, struct dt_info *dti, struct node *node) in check_simple_bus_reg() argument
913 const char *unitname = get_unitname(node); in check_simple_bus_reg()
919 if (!node->parent || (node->parent->bus != &simple_bus)) in check_simple_bus_reg()
922 prop = get_property(node, "reg"); in check_simple_bus_reg()
924 cells = (cell_t *)prop->val.val; in check_simple_bus_reg()
926 prop = get_property(node, "ranges"); in check_simple_bus_reg()
927 if (prop && prop->val.len) in check_simple_bus_reg()
929 cells = ((cell_t *)prop->val.val) + node_addr_cells(node); in check_simple_bus_reg()
933 if (node->parent->parent && !(node->bus == &simple_bus)) in check_simple_bus_reg()
934 FAIL(c, dti, node, "missing or empty reg/ranges property"); in check_simple_bus_reg()
938 size = node_addr_cells(node->parent); in check_simple_bus_reg()
939 while (size--) in check_simple_bus_reg()
944 FAIL(c, dti, node, "simple-bus unit address format error, expected \"%s\"", in check_simple_bus_reg()
950 struct node *node) in check_unit_address_format() argument
952 const char *unitname = get_unitname(node); in check_unit_address_format()
954 if (node->parent && node->parent->bus) in check_unit_address_format()
961 FAIL(c, dti, node, "unit name should not have leading \"0x\""); in check_unit_address_format()
966 FAIL(c, dti, node, "unit name should not have leading 0s"); in check_unit_address_format()
975 struct node *node) in check_avoid_default_addr_size() argument
979 if (!node->parent) in check_avoid_default_addr_size()
980 return; /* Ignore root node */ in check_avoid_default_addr_size()
982 reg = get_property(node, "reg"); in check_avoid_default_addr_size()
983 ranges = get_property(node, "ranges"); in check_avoid_default_addr_size()
988 if (node->parent->addr_cells == -1) in check_avoid_default_addr_size()
989 FAIL(c, dti, node, "Relying on default #address-cells value"); in check_avoid_default_addr_size()
991 if (node->parent->size_cells == -1) in check_avoid_default_addr_size()
992 FAIL(c, dti, node, "Relying on default #size-cells value"); in check_avoid_default_addr_size()
998 struct node *node) in check_avoid_unnecessary_addr_size() argument
1001 struct node *child; in check_avoid_unnecessary_addr_size()
1004 if (!node->parent || node->addr_cells < 0 || node->size_cells < 0) in check_avoid_unnecessary_addr_size()
1007 if (get_property(node, "ranges") || !node->children) in check_avoid_unnecessary_addr_size()
1010 for_each_child(node, child) { in check_avoid_unnecessary_addr_size()
1017 …FAIL(c, dti, node, "unnecessary #address-cells/#size-cells without \"ranges\" or child \"reg\" pro… in check_avoid_unnecessary_addr_size()
1023 struct node *node) in check_obsolete_chosen_interrupt_controller() argument
1025 struct node *dt = dti->dt; in check_obsolete_chosen_interrupt_controller() local
1026 struct node *chosen; in check_obsolete_chosen_interrupt_controller()
1029 if (node != dt) in check_obsolete_chosen_interrupt_controller()
1033 chosen = get_node_by_path(dt, "/chosen"); in check_obsolete_chosen_interrupt_controller()
1037 prop = get_property(chosen, "interrupt-controller"); in check_obsolete_chosen_interrupt_controller()
1039 FAIL_PROP(c, dti, node, prop, in check_obsolete_chosen_interrupt_controller()
1040 "/chosen has obsolete \"interrupt-controller\" property"); in check_obsolete_chosen_interrupt_controller()
1046 struct node *node) in check_chosen_node_is_root() argument
1048 if (!streq(node->name, "chosen")) in check_chosen_node_is_root()
1051 if (node->parent != dti->dt) in check_chosen_node_is_root()
1052 FAIL(c, dti, node, "chosen node must be at root node"); in check_chosen_node_is_root()
1057 struct node *node) in check_chosen_node_bootargs() argument
1061 if (!streq(node->name, "chosen")) in check_chosen_node_bootargs()
1064 prop = get_property(node, "bootargs"); in check_chosen_node_bootargs()
1068 c->data = prop->name; in check_chosen_node_bootargs()
1069 check_is_string(c, dti, node); in check_chosen_node_bootargs()
1074 struct node *node) in check_chosen_node_stdout_path() argument
1078 if (!streq(node->name, "chosen")) in check_chosen_node_stdout_path()
1081 prop = get_property(node, "stdout-path"); in check_chosen_node_stdout_path()
1083 prop = get_property(node, "linux,stdout-path"); in check_chosen_node_stdout_path()
1086 FAIL_PROP(c, dti, node, prop, "Use 'stdout-path' instead"); in check_chosen_node_stdout_path()
1089 c->data = prop->name; in check_chosen_node_stdout_path()
1090 check_is_string(c, dti, node); in check_chosen_node_stdout_path()
1102 struct node *node, in check_property_phandle_args() argument
1106 struct node *root = dti->dt; in check_property_phandle_args()
1109 if (prop->val.len % sizeof(cell_t)) { in check_property_phandle_args()
1110 FAIL_PROP(c, dti, node, prop, in check_property_phandle_args()
1112 prop->val.len, sizeof(cell_t)); in check_property_phandle_args()
1116 for (cell = 0; cell < prop->val.len / sizeof(cell_t); cell += cellsize + 1) { in check_property_phandle_args()
1117 struct node *provider_node; in check_property_phandle_args()
1123 * Some bindings use a cell value 0 or -1 to skip over optional in check_property_phandle_args()
1126 if (phandle == 0 || phandle == -1) { in check_property_phandle_args()
1128 if (dti->dtsflags & DTSF_PLUGIN) in check_property_phandle_args()
1136 if (prop->val.markers) { in check_property_phandle_args()
1137 struct marker *m = prop->val.markers; in check_property_phandle_args()
1139 if (m->offset == (cell * sizeof(cell_t))) in check_property_phandle_args()
1143 FAIL_PROP(c, dti, node, prop, in check_property_phandle_args()
1150 FAIL_PROP(c, dti, node, prop, in check_property_phandle_args()
1151 "Could not get phandle node for (cell %d)", in check_property_phandle_args()
1156 cellprop = get_property(provider_node, provider->cell_name); in check_property_phandle_args()
1159 } else if (provider->optional) { in check_property_phandle_args()
1162 FAIL(c, dti, node, "Missing property '%s' in node %s or bad phandle (referred from %s[%d])", in check_property_phandle_args()
1163 provider->cell_name, in check_property_phandle_args()
1164 provider_node->fullpath, in check_property_phandle_args()
1165 prop->name, cell); in check_property_phandle_args()
1169 if (prop->val.len < ((cell + cellsize + 1) * sizeof(cell_t))) { in check_property_phandle_args()
1170 FAIL_PROP(c, dti, node, prop, in check_property_phandle_args()
1172 prop->val.len, cellsize); in check_property_phandle_args()
1179 struct node *node) in check_provider_cells_property() argument
1181 struct provider *provider = c->data; in check_provider_cells_property()
1184 prop = get_property(node, provider->prop_name); in check_provider_cells_property()
1188 check_property_phandle_args(c, dti, node, prop, provider); in check_provider_cells_property()
1194 WARNING_PROPERTY_PHANDLE_CELLS(clocks, "clocks", "#clock-cells");
1195 WARNING_PROPERTY_PHANDLE_CELLS(cooling_device, "cooling-device", "#cooling-cells");
1196 WARNING_PROPERTY_PHANDLE_CELLS(dmas, "dmas", "#dma-cells");
1197 WARNING_PROPERTY_PHANDLE_CELLS(hwlocks, "hwlocks", "#hwlock-cells");
1198 WARNING_PROPERTY_PHANDLE_CELLS(interrupts_extended, "interrupts-extended", "#interrupt-cells");
1199 WARNING_PROPERTY_PHANDLE_CELLS(io_channels, "io-channels", "#io-channel-cells");
1200 WARNING_PROPERTY_PHANDLE_CELLS(iommus, "iommus", "#iommu-cells");
1201 WARNING_PROPERTY_PHANDLE_CELLS(mboxes, "mboxes", "#mbox-cells");
1202 WARNING_PROPERTY_PHANDLE_CELLS(msi_parent, "msi-parent", "#msi-cells", true);
1203 WARNING_PROPERTY_PHANDLE_CELLS(mux_controls, "mux-controls", "#mux-control-cells");
1204 WARNING_PROPERTY_PHANDLE_CELLS(phys, "phys", "#phy-cells");
1205 WARNING_PROPERTY_PHANDLE_CELLS(power_domains, "power-domains", "#power-domain-cells");
1206 WARNING_PROPERTY_PHANDLE_CELLS(pwms, "pwms", "#pwm-cells");
1207 WARNING_PROPERTY_PHANDLE_CELLS(resets, "resets", "#reset-cells");
1208 WARNING_PROPERTY_PHANDLE_CELLS(sound_dai, "sound-dai", "#sound-dai-cells");
1209 WARNING_PROPERTY_PHANDLE_CELLS(thermal_sensors, "thermal-sensors", "#thermal-sensor-cells");
1216 * *-gpios and *-gpio can appear in property names, in prop_is_gpio()
1219 if (strstr(prop->name, "nr-gpio")) in prop_is_gpio()
1222 str = strrchr(prop->name, '-'); in prop_is_gpio()
1226 str = prop->name; in prop_is_gpio()
1235 struct node *node) in check_gpios_property() argument
1240 if (get_property(node, "gpio-hog")) in check_gpios_property()
1243 for_each_property(node, prop) { in check_gpios_property()
1249 provider.prop_name = prop->name; in check_gpios_property()
1250 provider.cell_name = "#gpio-cells"; in check_gpios_property()
1252 check_property_phandle_args(c, dti, node, prop, &provider); in check_gpios_property()
1260 struct node *node) in check_deprecated_gpio_property() argument
1264 for_each_property(node, prop) { in check_deprecated_gpio_property()
1270 str = strstr(prop->name, "gpio"); in check_deprecated_gpio_property()
1274 FAIL_PROP(c, dti, node, prop, in check_deprecated_gpio_property()
1275 "'[*-]gpio' is deprecated, use '[*-]gpios' instead"); in check_deprecated_gpio_property()
1281 static bool node_is_interrupt_provider(struct node *node) in node_is_interrupt_provider() argument
1285 prop = get_property(node, "interrupt-controller"); in node_is_interrupt_provider()
1289 prop = get_property(node, "interrupt-map"); in node_is_interrupt_provider()
1297 struct node *node) in check_interrupts_property() argument
1299 struct node *root = dti->dt; in check_interrupts_property()
1300 struct node *irq_node = NULL, *parent = node; in check_interrupts_property()
1304 irq_prop = get_property(node, "interrupts"); in check_interrupts_property()
1308 if (irq_prop->val.len % sizeof(cell_t)) in check_interrupts_property()
1309 FAIL_PROP(c, dti, node, irq_prop, "size (%d) is invalid, expected multiple of %zu", in check_interrupts_property()
1310 irq_prop->val.len, sizeof(cell_t)); in check_interrupts_property()
1313 if (parent != node && node_is_interrupt_provider(parent)) { in check_interrupts_property()
1318 prop = get_property(parent, "interrupt-parent"); in check_interrupts_property()
1322 if ((phandle == 0 || phandle == -1) && in check_interrupts_property()
1323 (dti->dtsflags & DTSF_PLUGIN)) in check_interrupts_property()
1333 "Missing interrupt-controller or interrupt-map property"); in check_interrupts_property()
1338 parent = parent->parent; in check_interrupts_property()
1342 FAIL(c, dti, node, "Missing interrupt-parent"); in check_interrupts_property()
1346 prop = get_property(irq_node, "#interrupt-cells"); in check_interrupts_property()
1348 FAIL(c, dti, irq_node, "Missing #interrupt-cells in interrupt-parent"); in check_interrupts_property()
1353 if (irq_prop->val.len % (irq_cells * sizeof(cell_t))) { in check_interrupts_property()
1354 FAIL_PROP(c, dti, node, prop, in check_interrupts_property()
1356 irq_prop->val.len, (int)(irq_cells * sizeof(cell_t))); in check_interrupts_property()
1428 if ((warn && !c->warn) || (error && !c->error)) in enable_warning_error()
1429 for (i = 0; i < c->num_prereqs; i++) in enable_warning_error()
1430 enable_warning_error(c->prereq[i], warn, error); in enable_warning_error()
1432 c->warn = c->warn || warn; in enable_warning_error()
1433 c->error = c->error || error; in enable_warning_error()
1442 if ((warn && c->warn) || (error && c->error)) { in disable_warning_error()
1447 for (j = 0; j < cc->num_prereqs; j++) in disable_warning_error()
1448 if (cc->prereq[j] == c) in disable_warning_error()
1453 c->warn = c->warn && !warn; in disable_warning_error()
1454 c->error = c->error && !error; in disable_warning_error()
1463 if ((strncmp(arg, "no-", 3) == 0) in parse_checks_option()
1472 if (streq(c->name, name)) { in parse_checks_option()
1492 if (c->warn || c->error) in process_checks()
1499 "(use -f to force output)\n"); in process_checks()