summaryrefslogtreecommitdiff
path: root/drivers/base
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@linux.intel.com>2017-03-28 10:52:26 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-03-29 00:00:29 +0200
commit233872585de1cf26c3c3da5859ffb3aba45bd486 (patch)
tree4331c039ce70ba37369d07f088c8540ea32e037a /drivers/base
parent2bd5452d46df46d99b869b59a1532647e2981d75 (diff)
downloadlwn-233872585de1cf26c3c3da5859ffb3aba45bd486.tar.gz
lwn-233872585de1cf26c3c3da5859ffb3aba45bd486.zip
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: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/property.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/base/property.c b/drivers/base/property.c
index 8a53b8f1db66..627ebc9b570d 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -934,6 +934,27 @@ int device_add_properties(struct device *dev,
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: Firmware whose parent is retrieved
*