Menu Close

Linux Device Tree of Functions For Finding Parent Directories and Sub-Directories

This article talks about the of Functions used for finding parent directories and sub-directories.

For related subjects, please refer to the SOC Table of Contents.

of_get_parent

This function is used to obtain the parent node of the specified node (if it exists), with the following format:

struct device_node *of_get_parent(const struct device_node *node);

node is the node that you want to find the parent node of.

The function will return the parent node if found.

 

of_get_next_child

This function uses iteration to find child nodes, with the following format:

struct device_node *of_get_next_child(const struct device_node *node,
                                      struct device_node       *prev);

node is the parent node that you want to find the child nodes of.

prev is the previous child node and is used to find the next child node. This can be set as NULL to start from the first child node.

The function will return the next child node found.

 

 

Posted in Textbook and Training Project

Related Articles

Leave a Reply

Your email address will not be published.

Leave the field below empty!