Page MenuHomeFreeBSD

D5043.id12628.diff
No OneTemporary

D5043.id12628.diff

Index: sys/dev/ofw/ofw_bus_subr.c
===================================================================
--- sys/dev/ofw/ofw_bus_subr.c
+++ sys/dev/ofw/ofw_bus_subr.c
@@ -629,9 +629,12 @@
* node - consumers device node
* list_name - name of parsed list - "clocks"
* cells_name - name of size property - "#clock-cells"
+ * idx - the index of the requested list entry, or, if -1, an indication
+ * to return the number of entries in the parsed list.
* Output arguments:
* producer - handle of producer
- * ncells - number of cells in result
+ * ncells - number of cells in result or the number of items in the list when
+ * idx == -1.
* cells - array of decoded cells
*/
int
@@ -649,7 +652,7 @@
(void **)&elems);
if (nelems <= 0)
return (ENOENT);
- rv = ENOENT;
+ rv = (idx == -1) ? 0 : ENOENT;
for (i = 0, cnt = 0; i < nelems; i += pcells, cnt++) {
pnode = elems[i++];
if (OF_getencprop(OF_node_from_xref(pnode),
@@ -678,6 +681,8 @@
}
if (elems != NULL)
free(elems, M_OFWPROP);
+ if (idx == -1 && rv == 0)
+ *ncells = cnt;
return (rv);
}

File Metadata

Mime Type
text/plain
Expires
Sun, May 24, 6:45 PM (14 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33482897
Default Alt Text
D5043.id12628.diff (1 KB)

Event Timeline