| 386 | } |
| 387 | |
| 388 | const struct device_node * |
| 389 | of_get_next_child(const struct device_node *dev_node, |
| 390 | const struct device_node *prev) |
| 391 | { |
| 392 | const struct dt_dir *p, *c; |
| 393 | |
| 394 | DPAAX_HWWARN(!alive, "Device-tree driver not initialised!"); |
| 395 | |
| 396 | if (!dev_node) |
| 397 | return NULL; |
| 398 | p = node2dir(dev_node); |
| 399 | if (prev) { |
| 400 | c = node2dir(prev); |
| 401 | DPAAX_HWWARN((c->parent != p), "Parent/child mismatch"); |
| 402 | if (c->parent != p) |
| 403 | return NULL; |
| 404 | if (c->node.list.next == &p->subdirs) |
| 405 | /* prev was the last child */ |
| 406 | return NULL; |
| 407 | c = list_entry(c->node.list.next, struct dt_dir, node.list); |
| 408 | return &c->node.node; |
| 409 | } |
| 410 | /* Return first child */ |
| 411 | if (list_empty(&p->subdirs)) |
| 412 | return NULL; |
| 413 | c = list_entry(p->subdirs.next, struct dt_dir, node.list); |
| 414 | return &c->node.node; |
| 415 | } |
| 416 | |
| 417 | uint32_t |
| 418 | of_n_addr_cells(const struct device_node *dev_node) |
no test coverage detected