diff options
author | Tom Rini <trini@konsulko.com> | 2025-01-14 11:43:01 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2025-01-14 11:43:01 -0600 |
commit | e17be5a07ad6947c13c39936be812a65e694ecee (patch) | |
tree | 92f8addda6ee3a888101a736c1fb7c5e5d5f719c /drivers/core/root.c | |
parent | 4eb937058ffd9d413929f566246eb684efe8eab5 (diff) | |
parent | 6995f2c8be901b5f3f4183ccc4a58c209e8bce52 (diff) |
Merge patch series "Adjust how autoprobe is implemented"
Simon Glass <sjg@chromium.org> says:
This little series makes a minor change to how autoprobe is
implemented, as discussed on the list.
Link: https://lore.kernel.org/r/20240626235717.272219-1-marex@denx.de
Link: https://lore.kernel.org/r/20241120153642.861633-1-sjg@chromium.org
Diffstat (limited to 'drivers/core/root.c')
-rw-r--r-- | drivers/core/root.c | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/drivers/core/root.c b/drivers/core/root.c index c7fb58285ca..15b8c83fee9 100644 --- a/drivers/core/root.c +++ b/drivers/core/root.c @@ -288,26 +288,40 @@ void *dm_priv_to_rw(void *priv) } #endif -static int dm_probe_devices(struct udevice *dev, bool pre_reloc_only) +/** + * dm_probe_devices() - Check whether to probe a device and all children + * + * Probes the device if DM_FLAG_PROBE_AFTER_BIND is enabled for it. Then scans + * all its children recursively to do the same. + * + * @dev: Device to (maybe) probe + * Return 0 if OK, -ve on error + */ +static int dm_probe_devices(struct udevice *dev) { - ofnode node = dev_ofnode(dev); struct udevice *child; - int ret; - - if (pre_reloc_only && - (!ofnode_valid(node) || !ofnode_pre_reloc(node)) && - !(dev->driver->flags & DM_FLAG_PRE_RELOC)) - goto probe_children; if (dev_get_flags(dev) & DM_FLAG_PROBE_AFTER_BIND) { + int ret; + ret = device_probe(dev); if (ret) return ret; } -probe_children: list_for_each_entry(child, &dev->child_head, sibling_node) - dm_probe_devices(child, pre_reloc_only); + dm_probe_devices(child); + + return 0; +} + +int dm_autoprobe(void) +{ + int ret; + + ret = dm_probe_devices(gd->dm_root); + if (ret) + return log_msg_ret("pro", ret); return 0; } @@ -344,7 +358,7 @@ static int dm_scan(bool pre_reloc_only) if (ret) return ret; - return dm_probe_devices(gd->dm_root, pre_reloc_only); + return 0; } int dm_init_and_scan(bool pre_reloc_only) |