|
Lines 629-634
ofw_bus_find_child_device_by_phandle(device_t bus, phandle_t node)
Link Here
|
| 629 |
* node - consumers device node |
629 |
* node - consumers device node |
| 630 |
* list_name - name of parsed list - "clocks" |
630 |
* list_name - name of parsed list - "clocks" |
| 631 |
* cells_name - name of size property - "#clock-cells" |
631 |
* cells_name - name of size property - "#clock-cells" |
|
|
632 |
* idx - the index of the requested list entry, or, if -1, an indication |
| 633 |
* to return the number of entries in the parsed list. |
| 632 |
* Output arguments: |
634 |
* Output arguments: |
| 633 |
* producer - handle of producer |
635 |
* producer - handle of producer |
| 634 |
* ncells - number of cells in result |
636 |
* ncells - number of cells in result |
|
Lines 649-655
ofw_bus_parse_xref_list_alloc(phandle_t node, const char *list_name,
Link Here
|
| 649 |
(void **)&elems); |
651 |
(void **)&elems); |
| 650 |
if (nelems <= 0) |
652 |
if (nelems <= 0) |
| 651 |
return (ENOENT); |
653 |
return (ENOENT); |
| 652 |
rv = ENOENT; |
654 |
rv = (idx == -1) ? 0 : ENOENT; |
| 653 |
for (i = 0, cnt = 0; i < nelems; i += pcells, cnt++) { |
655 |
for (i = 0, cnt = 0; i < nelems; i += pcells, cnt++) { |
| 654 |
pnode = elems[i++]; |
656 |
pnode = elems[i++]; |
| 655 |
if (OF_getencprop(OF_node_from_xref(pnode), |
657 |
if (OF_getencprop(OF_node_from_xref(pnode), |
|
Lines 678-683
ofw_bus_parse_xref_list_alloc(phandle_t node, const char *list_name,
Link Here
|
| 678 |
} |
680 |
} |
| 679 |
if (elems != NULL) |
681 |
if (elems != NULL) |
| 680 |
free(elems, M_OFWPROP); |
682 |
free(elems, M_OFWPROP); |
|
|
683 |
if (idx == -1 && rv == 0) |
| 684 |
return (cnt); |
| 681 |
return (rv); |
685 |
return (rv); |
| 682 |
} |
686 |
} |
| 683 |
|
687 |
|