summaryrefslogtreecommitdiffstats
path: root/drivers/core
diff options
context:
space:
mode:
authorBin Meng <bmeng.cn@gmail.com>2018-10-15 02:20:57 -0700
committerSimon Glass <sjg@chromium.org>2018-11-14 09:16:27 -0800
commit651d0c019a428ca8b14352210c1ce7804dd51fae (patch)
tree899f50340f961295b0b7e4cfac051e9d823d20d4 /drivers/core
parenta6d4b0608b79023c703ca2ad1cbdfa784160449b (diff)
downloadu-boot-651d0c019a428ca8b14352210c1ce7804dd51fae.tar.gz
u-boot-651d0c019a428ca8b14352210c1ce7804dd51fae.tar.xz
u-boot-651d0c019a428ca8b14352210c1ce7804dd51fae.zip
dm: core: Allow uclass to set up a device's child after it is probed
Some buses need to set up their child devices after they are probed. Support a common child_post_probe() method for the uclass. With this change, the two APIs uclass_pre_probe_device() and uclass_post_probe_device() become symmetric. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/core')
-rw-r--r--drivers/core/uclass.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index 3113d6a56b..3c7b9cf0ad 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -687,8 +687,19 @@ int uclass_pre_probe_device(struct udevice *dev)
int uclass_post_probe_device(struct udevice *dev)
{
- struct uclass_driver *uc_drv = dev->uclass->uc_drv;
+ struct uclass_driver *uc_drv;
+ int ret;
+
+ if (dev->parent) {
+ uc_drv = dev->parent->uclass->uc_drv;
+ if (uc_drv->child_post_probe) {
+ ret = uc_drv->child_post_probe(dev);
+ if (ret)
+ return ret;
+ }
+ }
+ uc_drv = dev->uclass->uc_drv;
if (uc_drv->post_probe)
return uc_drv->post_probe(dev);