diff options
| author | Tom Rini <[email protected]> | 2026-01-28 09:21:17 -0600 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2026-01-28 09:21:17 -0600 |
| commit | e8ec8d980a31c4a1d665e4aa9089d6aa27cb0d0b (patch) | |
| tree | 629a81743f41c1ab97ddc1ce75f6a192ab7ab788 /drivers | |
| parent | cd4f4f74213aa02df1a0f2c533cd2cabfac6aa2e (diff) | |
| parent | c7e0e3fd33ca9809605a6de0a58809daf1224bff (diff) | |
Merge patch series "dm: core: Support same compatible in host/gadget musb drivers"
Markus Schneider-Pargmann (TI.com) <[email protected]> says:
musb currently uses a wrapper driver that binds on the parent device of
the actual musb devices to manage the differentiation between gadget and
host modes. However in the upstream devicetree this parent devicetree
node can not be used to match the wrapper driver.
To be able to probe the musb devices in host/gadget mode directly, this
series introduces support for returning -ENODEV in bind functions
resulting in iterating the remaining drivers potentially binding to
other drivers that match the compatible.
Link: https://lore.kernel.org/r/20260127-topic-musb-probing-v2026-01-v4-0-ea3201e0f809@baylibre.com
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/core/lists.c | 75 |
1 files changed, 37 insertions, 38 deletions
diff --git a/drivers/core/lists.c b/drivers/core/lists.c index c7be504b6fc..2545dc142f6 100644 --- a/drivers/core/lists.c +++ b/drivers/core/lists.c @@ -204,10 +204,8 @@ int lists_bind_fdt(struct udevice *parent, ofnode node, struct udevice **devp, const struct udevice_id *id; struct driver *entry; struct udevice *dev; - bool found = false; const char *name, *compat_list, *compat; int compat_length, i; - int result = 0; int ret = 0; if (devp) @@ -237,55 +235,56 @@ int lists_bind_fdt(struct udevice *parent, ofnode node, struct udevice **devp, log_debug(" - attempt to match compatible string '%s'\n", compat); - id = NULL; for (entry = driver; entry != driver + n_ents; entry++) { + /* Search for drivers with matching drv or existing of_match */ if (drv) { if (drv != entry) continue; - if (!entry->of_match) - break; + } else if (!entry->of_match) { + continue; } - ret = driver_check_compatible(entry->of_match, &id, - compat); - if (!ret) - break; - } - if (entry == driver + n_ents) - continue; - - if (pre_reloc_only) { - if (!ofnode_pre_reloc(node) && - !(entry->flags & DM_FLAG_PRE_RELOC)) { - log_debug("Skipping device pre-relocation\n"); - return 0; + + id = NULL; + if (entry->of_match) { + ret = driver_check_compatible(entry->of_match, &id, + compat); + if (ret) + continue; + log_debug(" - found match at driver '%s' for '%s'\n", + entry->name, id->compatible); + } + + if (pre_reloc_only) { + if (!ofnode_pre_reloc(node) && + !(entry->flags & DM_FLAG_PRE_RELOC)) { + log_debug("Skipping device pre-relocation\n"); + return 0; + } + } + + ret = device_bind_with_driver_data(parent, entry, name, + id ? id->data : 0, node, + &dev); + if (!drv && ret == -ENODEV) { + log_debug(" - Driver '%s' refuses to bind\n", entry->name); + continue; + } + if (ret) { + dm_warn("Error binding driver '%s': %d\n", entry->name, + ret); + return log_msg_ret("bind", ret); } - } - if (entry->of_match) - log_debug(" - found match at driver '%s' for '%s'\n", - entry->name, id->compatible); - ret = device_bind_with_driver_data(parent, entry, name, - id ? id->data : 0, node, - &dev); - if (ret == -ENODEV) { - log_debug("Driver '%s' refuses to bind\n", entry->name); - continue; - } - if (ret) { - dm_warn("Error binding driver '%s': %d\n", entry->name, - ret); - return log_msg_ret("bind", ret); - } else { - found = true; if (devp) *devp = dev; + + return 0; } - break; } - if (!found && !result && ret != -ENODEV) + if (ret != -ENODEV) log_debug("No match for node '%s'\n", name); - return result; + return 0; } #endif |
