Commit 02eeb1bb authored by Simon Glass's avatar Simon Glass
Browse files

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: default avatarSimon Glass <sjg@chromium.org>
parent e564f054
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment