Changeset de3db94a in mainline for kernel/genarch/src/ofw/ofw_tree.c
- Timestamp:
- 2012-03-02T15:12:01Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 71232af
- Parents:
- dabbe28
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/genarch/src/ofw/ofw_tree.c
rdabbe28 rde3db94a 38 38 #include <genarch/ofw/ofw_tree.h> 39 39 #include <mm/slab.h> 40 #include <sysinfo/sysinfo.h> 40 41 #include <memstr.h> 41 42 #include <str.h> … … 355 356 } 356 357 358 /** Map OpenFirmware device subtree rooted in a node into sysinfo. 359 * 360 * Child nodes are processed recursively and peer nodes are processed 361 * iteratively in order to avoid stack overflow. 362 * 363 * @param node Root of the subtree. 364 * @param path Current path, NULL for the very root of the entire tree. 365 * 366 */ 367 static void ofw_tree_node_sysinfo(ofw_tree_node_t *node, const char *path) 368 { 369 char *cur_path = (char *) malloc(PATH_MAX_LEN, 0); 370 371 for (ofw_tree_node_t *cur = node; cur; cur = cur->peer) { 372 if ((cur->parent) && (path)) 373 snprintf(cur_path, PATH_MAX_LEN, "%s.%s", path, cur->da_name); 374 else 375 snprintf(cur_path, PATH_MAX_LEN, "firmware.%s", cur->da_name); 376 377 sysinfo_set_item_undefined(cur_path, NULL); 378 379 if (cur->child) 380 ofw_tree_node_sysinfo(cur->child, cur_path); 381 } 382 383 free(cur_path); 384 } 385 386 /** Map the OpenFirmware device tree into sysinfo. */ 387 void ofw_sysinfo_map(void) 388 { 389 ofw_tree_node_sysinfo(ofw_root, NULL); 390 } 391 357 392 /** @} 358 393 */
Note:
See TracChangeset
for help on using the changeset viewer.