]> git.sur5r.net Git - u-boot/commitdiff
dm: core: Add functions to find parent and OF data
authorSimon Glass <sjg@chromium.org>
Tue, 11 Nov 2014 17:46:19 +0000 (10:46 -0700)
committerSimon Glass <sjg@chromium.org>
Sat, 22 Nov 2014 09:16:47 +0000 (10:16 +0100)
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>
drivers/core/device.c
include/dm/device.h

index 81ddecade28cc5fac1ee09a2792ea625193a212f..6793e1c4f944b9db600687669a222728f19feafd 100644 (file)
@@ -381,6 +381,11 @@ int device_find_next_child(struct udevice **devp)
        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;
index 287504cb2707f7ae233e3bfcba2fa22b01cbb599..13598a15b68684ee81b023c30d8ec42e21941c2b 100644 (file)
@@ -207,6 +207,14 @@ void *dev_get_parentdata(struct udevice *dev);
  */
 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
  *