struct uclass_driver *lists_uclass_lookup(enum uclass_id id)
{
struct uclass_driver *uclass =
- ll_entry_start(struct uclass_driver, uclass);
- const int n_ents = ll_entry_count(struct uclass_driver, uclass);
+ ll_entry_start(struct uclass_driver, uclass_driver);
+ const int n_ents = ll_entry_count(struct uclass_driver, uclass_driver);
struct uclass_driver *entry;
for (entry = uclass; entry != uclass + n_ents; entry++) {
const int n_ents = ll_entry_count(struct driver_info, driver_info);
bool missing_parent = false;
int result = 0;
- uint idx;
+ int idx;
/*
* Do one iteration through the driver_info records. For of-platdata,
int ret;
ret = bind_drivers_pass(parent, pre_reloc_only);
- if (!ret)
- break;
- if (ret != -EAGAIN && !result)
+ if (!result || result == -EAGAIN)
result = ret;
+ if (ret != -EAGAIN)
+ break;
}
return result;
return ret;
}
-#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
+#if CONFIG_IS_ENABLED(OF_REAL)
/**
* driver_check_compatible() - Check if a driver matches a compatible string
*
* @param of_match: List of compatible strings to match
* @param of_idp: Returns the match that was found
* @param compat: The compatible string to search for
- * @return 0 if there is a match, -ENOENT if no match
+ * Return: 0 if there is a match, -ENOENT if no match
*/
static int driver_check_compatible(const struct udevice_id *of_match,
const struct udevice_id **of_idp,
}
int lists_bind_fdt(struct udevice *parent, ofnode node, struct udevice **devp,
- bool pre_reloc_only)
+ struct driver *drv, bool pre_reloc_only)
{
struct driver *driver = ll_entry_start(struct driver, driver);
const int n_ents = ll_entry_count(struct driver, driver);
log_debug(" - attempt to match compatible string '%s'\n",
compat);
+ id = NULL;
for (entry = driver; entry != driver + n_ents; entry++) {
+ if (drv) {
+ if (drv != entry)
+ continue;
+ if (!entry->of_match)
+ break;
+ }
ret = driver_check_compatible(entry->of_match, &id,
compat);
if (!ret)
}
}
- log_debug(" - found match at '%s': '%s' matches '%s'\n",
- entry->name, entry->of_match->compatible,
- id->compatible);
+ if (entry->of_match)
+ log_debug(" - found match at '%s': '%s' matches '%s'\n",
+ entry->name, entry->of_match->compatible,
+ id->compatible);
ret = device_bind_with_driver_data(parent, entry, name,
- id->data, node, &dev);
+ 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 ret;
+ return log_msg_ret("bind", ret);
} else {
found = true;
if (devp)