| 656 | } |
| 657 | |
| 658 | struct rt_ofw_node *rt_ofw_find_node_by_phandle(rt_phandle phandle) |
| 659 | { |
| 660 | struct rt_ofw_node *np = RT_NULL; |
| 661 | |
| 662 | if (phandle >= OFW_PHANDLE_MIN && phandle <= OFW_PHANDLE_MAX) |
| 663 | { |
| 664 | /* rebase from zero */ |
| 665 | rt_phandle poff = phandle - _phandle_range[0]; |
| 666 | |
| 667 | np = _phandle_hash[poff]; |
| 668 | |
| 669 | if (!np) |
| 670 | { |
| 671 | rt_ofw_foreach_allnodes(np) |
| 672 | { |
| 673 | if (np->phandle == phandle) |
| 674 | { |
| 675 | _phandle_hash[poff] = np; |
| 676 | |
| 677 | break; |
| 678 | } |
| 679 | } |
| 680 | } |
| 681 | else |
| 682 | { |
| 683 | rt_ofw_node_get(np); |
| 684 | } |
| 685 | } |
| 686 | |
| 687 | return np; |
| 688 | } |
| 689 | |
| 690 | struct rt_ofw_node *rt_ofw_get_parent(const struct rt_ofw_node *np) |
| 691 | { |
no test coverage detected