aboutsummaryrefslogtreecommitdiff
path: root/drivers/core
diff options
context:
space:
mode:
authorSimon Glass2014-10-13 23:41:50 -0600
committerSimon Glass2014-10-22 10:36:46 -0600
commitaccd4b19b39bde7398aa8d1a8eeb66f3a14dde5b (patch)
tree09bcc8e1c9ebd5b6213bdb198b35691f8902e57a /drivers/core
parenta8981d4f80b010666ad754d20a4f389f94d6726d (diff)
dm: core: Allow parents to pass data to children during probe
Buses sometimes want to pass data to their children when they are probed. For example, a SPI bus may want to tell the slave device about the chip select it is connected to. Add a new function to permit the parent data to be supplied to the child. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Jagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>
Diffstat (limited to 'drivers/core')
-rw-r--r--drivers/core/device.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/core/device.c b/drivers/core/device.c
index 9538874017a..49faa29dc1a 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -232,7 +232,7 @@ static void device_free(struct udevice *dev)
}
}
-int device_probe(struct udevice *dev)
+int device_probe_child(struct udevice *dev, void *parent_priv)
{
struct driver *drv;
int size = 0;
@@ -282,6 +282,8 @@ int device_probe(struct udevice *dev)
ret = -ENOMEM;
goto fail;
}
+ if (parent_priv)
+ memcpy(dev->parent_priv, parent_priv, size);
}
ret = device_probe(dev->parent);
@@ -335,6 +337,11 @@ fail:
return ret;
}
+int device_probe(struct udevice *dev)
+{
+ return device_probe_child(dev, NULL);
+}
+
int device_remove(struct udevice *dev)
{
struct driver *drv;