Add dev_get_parent() as a convenience to obtain the parent of a device.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@ti.com>
Acked-by: Heiko Schocher <hs@denx.de>
return 0;
}
+struct udevice *dev_get_parent(struct udevice *child)
+{
+ return child->parent;
+}
+
ulong dev_get_of_data(struct udevice *dev)
{
return dev->of_id->data;
*/
void *dev_get_priv(struct udevice *dev);
+/**
+ * struct dev_get_parent() - Get the parent of a device
+ *
+ * @child: Child to check
+ * @return parent of child, or NULL if this is the root device
+ */
+struct udevice *dev_get_parent(struct udevice *child);
+
/**
* dev_get_of_data() - get the device tree data used to bind a device
*