Commit 23387258 authored by Sakari Ailus's avatar Sakari Ailus Committed by Rafael J. Wysocki

device property: Add fwnode_get_next_parent()

In order to differentiate the functionality between dropping a reference
to the node (or not) for the benefit of OF, introduce
fwnode_get_next_parent().
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 2bd5452d
...@@ -933,6 +933,27 @@ int device_add_properties(struct device *dev, ...@@ -933,6 +933,27 @@ int device_add_properties(struct device *dev,
} }
EXPORT_SYMBOL_GPL(device_add_properties); EXPORT_SYMBOL_GPL(device_add_properties);
/**
* fwnode_get_next_parent - Iterate to the node's parent
* @fwnode: Firmware whose parent is retrieved
*
* This is like fwnode_get_parent() except that it drops the refcount
* on the passed node, making it suitable for iterating through a
* node's parents.
*
* Returns a node pointer with refcount incremented, use
* fwnode_handle_node() on it when done.
*/
struct fwnode_handle *fwnode_get_next_parent(struct fwnode_handle *fwnode)
{
struct fwnode_handle *parent = fwnode_get_parent(fwnode);
fwnode_handle_put(fwnode);
return parent;
}
EXPORT_SYMBOL_GPL(fwnode_get_next_parent);
/** /**
* fwnode_get_parent - Return parent firwmare node * fwnode_get_parent - Return parent firwmare node
* @fwnode: Firmware whose parent is retrieved * @fwnode: Firmware whose parent is retrieved
......
...@@ -73,6 +73,7 @@ int fwnode_property_match_string(struct fwnode_handle *fwnode, ...@@ -73,6 +73,7 @@ int fwnode_property_match_string(struct fwnode_handle *fwnode,
const char *propname, const char *string); const char *propname, const char *string);
struct fwnode_handle *fwnode_get_parent(struct fwnode_handle *fwnode); struct fwnode_handle *fwnode_get_parent(struct fwnode_handle *fwnode);
struct fwnode_handle *fwnode_get_next_parent(struct fwnode_handle *fwnode);
struct fwnode_handle *fwnode_get_next_child_node(struct fwnode_handle *fwnode, struct fwnode_handle *fwnode_get_next_child_node(struct fwnode_handle *fwnode,
struct fwnode_handle *child); struct fwnode_handle *child);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment