Lines Matching refs:c

24 #define TRACE(c, ...) \  argument
26 fprintf(stderr, "=== %s: ", (c)->name); \
31 #define TRACE(c, fmt, ...) do { } while (0) argument
49 typedef void (*tree_check_fn)(struct check *c, struct node *dt);
50 typedef void (*node_check_fn)(struct check *c, struct node *dt, struct node *node);
51 typedef void (*prop_check_fn)(struct check *c, struct node *dt,
91 static inline void check_msg(struct check *c, const char *fmt, ...) __attribute__((format (printf, …
93 static inline void check_msg(struct check *c, const char *fmt, ...) in check_msg() argument
98 if ((c->level < WARN) || (c->level <= quiet)) in check_msg()
102 (c->level == ERROR) ? "ERROR" : "Warning", c->name); in check_msg()
107 #define FAIL(c, ...) \ argument
109 TRACE((c), "\t\tFAILED at %s:%d", __FILE__, __LINE__); \
110 (c)->status = FAILED; \
111 check_msg((c), __VA_ARGS__); \
114 static void check_nodes_props(struct check *c, struct node *dt, struct node *node) in check_nodes_props() argument
119 TRACE(c, "%s", node->fullpath); in check_nodes_props()
120 if (c->node_fn) in check_nodes_props()
121 c->node_fn(c, dt, node); in check_nodes_props()
123 if (c->prop_fn) in check_nodes_props()
125 TRACE(c, "%s\t'%s'", node->fullpath, prop->name); in check_nodes_props()
126 c->prop_fn(c, dt, node, prop); in check_nodes_props()
130 check_nodes_props(c, dt, child); in check_nodes_props()
133 static int run_check(struct check *c, struct node *dt) in run_check() argument
138 assert(!c->inprogress); in run_check()
140 if (c->status != UNCHECKED) in run_check()
143 c->inprogress = 1; in run_check()
145 for (i = 0; i < c->num_prereqs; i++) { in run_check()
146 struct check *prq = c->prereq[i]; in run_check()
149 c->status = PREREQ; in run_check()
150 check_msg(c, "Failed prerequisite '%s'", in run_check()
151 c->prereq[i]->name); in run_check()
155 if (c->status != UNCHECKED) in run_check()
158 if (c->node_fn || c->prop_fn) in run_check()
159 check_nodes_props(c, dt, dt); in run_check()
161 if (c->tree_fn) in run_check()
162 c->tree_fn(c, dt); in run_check()
163 if (c->status == UNCHECKED) in run_check()
164 c->status = PASSED; in run_check()
166 TRACE(c, "\tCompleted, status %d", c->status); in run_check()
169 c->inprogress = 0; in run_check()
170 if ((c->status != PASSED) && (c->level == ERROR)) in run_check()
179 static void check_is_string(struct check *c, struct node *root, in check_is_string() argument
183 char *propname = c->data; in check_is_string()
190 FAIL(c, "\"%s\" property in %s is not a string", in check_is_string()
196 static void check_is_cell(struct check *c, struct node *root, in check_is_cell() argument
200 char *propname = c->data; in check_is_cell()
207 FAIL(c, "\"%s\" property in %s is not a single cell", in check_is_cell()
217 static void check_duplicate_node_names(struct check *c, struct node *dt, in check_duplicate_node_names() argument
227 FAIL(c, "Duplicate node name %s", in check_duplicate_node_names()
232 static void check_duplicate_property_names(struct check *c, struct node *dt, in check_duplicate_property_names() argument
240 FAIL(c, "Duplicate property name %s in %s", in check_duplicate_property_names()
250 static void check_node_name_chars(struct check *c, struct node *dt, in check_node_name_chars() argument
253 int n = strspn(node->name, c->data); in check_node_name_chars()
256 FAIL(c, "Bad character '%c' in node %s", in check_node_name_chars()
261 static void check_node_name_format(struct check *c, struct node *dt, in check_node_name_format() argument
265 FAIL(c, "Node %s has multiple '@' characters in name", in check_node_name_format()
270 static void check_property_name_chars(struct check *c, struct node *dt, in check_property_name_chars() argument
273 int n = strspn(prop->name, c->data); in check_property_name_chars()
276 FAIL(c, "Bad character '%c' in property name \"%s\", node %s", in check_property_name_chars()
288 static void check_duplicate_label(struct check *c, struct node *dt, in check_duplicate_label() argument
308 FAIL(c, "Duplicate label '%s' on " DESCLABEL_FMT in check_duplicate_label()
314 static void check_duplicate_label_node(struct check *c, struct node *dt, in check_duplicate_label_node() argument
320 check_duplicate_label(c, dt, l->label, node, NULL, NULL); in check_duplicate_label_node()
322 static void check_duplicate_label_prop(struct check *c, struct node *dt, in check_duplicate_label_prop() argument
329 check_duplicate_label(c, dt, l->label, node, prop, NULL); in check_duplicate_label_prop()
332 check_duplicate_label(c, dt, m->ref, node, prop, m); in check_duplicate_label_prop()
337 static void check_explicit_phandles(struct check *c, struct node *root, in check_explicit_phandles() argument
349 FAIL(c, "%s has bad length (%d) %s property", in check_explicit_phandles()
361 FAIL(c, "%s in %s is a reference to another node", in check_explicit_phandles()
376 FAIL(c, "%s has bad value (0x%x) in %s property", in check_explicit_phandles()
382 FAIL(c, "%s has %s property which replaces existing phandle information", in check_explicit_phandles()
387 FAIL(c, "%s has duplicated phandle 0x%x (seen before at %s)", in check_explicit_phandles()
396 static void check_name_properties(struct check *c, struct node *root, in check_name_properties() argument
412 FAIL(c, "\"name\" property in %s is incorrect (\"%s\" instead" in check_name_properties()
430 static void fixup_phandle_references(struct check *c, struct node *dt, in fixup_phandle_references() argument
442 FAIL(c, "Reference to non-existent node or label \"%s\"\n", in fixup_phandle_references()
454 static void fixup_path_references(struct check *c, struct node *dt, in fixup_path_references() argument
466 FAIL(c, "Reference to non-existent node or label \"%s\"\n", in fixup_path_references()
490 static void fixup_addr_size_cells(struct check *c, struct node *dt, in fixup_addr_size_cells() argument
514 static void check_reg_format(struct check *c, struct node *dt, in check_reg_format() argument
525 FAIL(c, "Root node has a \"reg\" property"); in check_reg_format()
530 FAIL(c, "\"reg\" property in %s is empty", node->fullpath); in check_reg_format()
537 FAIL(c, "\"reg\" property in %s has invalid length (%d bytes) " in check_reg_format()
543 static void check_ranges_format(struct check *c, struct node *dt, in check_ranges_format() argument
554 FAIL(c, "Root node has a \"ranges\" property"); in check_ranges_format()
566 FAIL(c, "%s has empty \"ranges\" property but its " in check_ranges_format()
571 FAIL(c, "%s has empty \"ranges\" property but its " in check_ranges_format()
576 FAIL(c, "\"ranges\" property in %s has invalid length (%d bytes) " in check_ranges_format()
587 static void check_avoid_default_addr_size(struct check *c, struct node *dt, in check_avoid_default_addr_size() argument
602 FAIL(c, "Relying on default #address-cells value for %s", in check_avoid_default_addr_size()
606 FAIL(c, "Relying on default #size-cells value for %s", in check_avoid_default_addr_size()
611 static void check_obsolete_chosen_interrupt_controller(struct check *c, in check_obsolete_chosen_interrupt_controller() argument
623 FAIL(c, "/chosen has obsolete \"interrupt-controller\" " in check_obsolete_chosen_interrupt_controller()
654 struct check *c = check_table[i]; in process_checks() local
656 if (c->level != IGNORE) in process_checks()
657 error = error || run_check(c, dt); in process_checks()