summaryrefslogtreecommitdiff
path: root/drivers/core
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2015-03-05 12:25:21 -0700
committerSimon Glass <sjg@chromium.org>2015-04-16 19:27:42 -0600
commit02eeb1bbb1749903b157140de5dedebf7e44edcf (patch)
treead21efe7fd3f21488dc43b9703b8ee41fab16c10 /drivers/core
parente564f054af002d9e6a1080ed9d4bc2c6052a4435 (diff)
downloadu-boot-imx-02eeb1bbb1749903b157140de5dedebf7e44edcf.zip
u-boot-imx-02eeb1bbb1749903b157140de5dedebf7e44edcf.tar.gz
u-boot-imx-02eeb1bbb1749903b157140de5dedebf7e44edcf.tar.bz2
dm: core: Mark device as active before calling its probe() method
At present the device is not active when the probe() method is called. But some probe() methods want to set up the device and this can involve accessing it through normal methods. For example a PCI bus may wish to set up its PCI parameters using calls to pci_hose_write_config_dword() and similar. At present this does not work because every such call within the probe() method sees that the device is not active and attempts to probe it. Already we mark the device as probed before calling the uclass post_probe() method. This is a subtle change but I believe the new approach is better. Since the scope of the change is only the probe() method and all its callees it should still be within the control of the board author. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/core')
-rw-r--r--drivers/core/device.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/core/device.c b/drivers/core/device.c
index 92e8a57..6bd4b26 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -243,14 +243,15 @@ int device_probe_child(struct udevice *dev, void *parent_priv)
goto fail;
}
+ dev->flags |= DM_FLAG_ACTIVATED;
if (drv->probe) {
ret = drv->probe(dev);
- if (ret)
+ if (ret) {
+ dev->flags &= ~DM_FLAG_ACTIVATED;
goto fail;
+ }
}
- dev->flags |= DM_FLAG_ACTIVATED;
-
ret = uclass_post_probe_device(dev);
if (ret) {
dev->flags &= ~DM_FLAG_ACTIVATED;