]> git.sur5r.net Git - u-boot/blobdiff - drivers/core/lists.c
microblaze: Remove CONSOLE_ARG
[u-boot] / drivers / core / lists.c
index 3a1823db0205498fb8a42c4ffa75bc77d1c02770..c4fc216340d8169dde8c05cdc0f9556e7ed9815b 100644 (file)
@@ -25,9 +25,6 @@ struct driver *lists_driver_lookup_name(const char *name)
        const int n_ents = ll_entry_count(struct driver, driver);
        struct driver *entry;
 
-       if (!drv || !n_ents)
-               return NULL;
-
        for (entry = drv; entry != drv + n_ents; entry++) {
                if (!strcmp(name, entry->name))
                        return entry;
@@ -44,9 +41,6 @@ struct uclass_driver *lists_uclass_lookup(enum uclass_id id)
        const int n_ents = ll_entry_count(struct uclass_driver, uclass);
        struct uclass_driver *entry;
 
-       if ((id == UCLASS_INVALID) || !uclass)
-               return NULL;
-
        for (entry = uclass; entry != uclass + n_ents; entry++) {
                if (entry->id == id)
                        return entry;
@@ -79,26 +73,33 @@ int lists_bind_drivers(struct udevice *parent, bool pre_reloc_only)
 
 int device_bind_driver(struct udevice *parent, const char *drv_name,
                       const char *dev_name, struct udevice **devp)
+{
+       return device_bind_driver_to_node(parent, drv_name, dev_name, -1, devp);
+}
+
+int device_bind_driver_to_node(struct udevice *parent, const char *drv_name,
+                              const char *dev_name, int node,
+                              struct udevice **devp)
 {
        struct driver *drv;
        int ret;
 
        drv = lists_driver_lookup_name(drv_name);
        if (!drv) {
-               printf("Cannot find driver '%s'\n", drv_name);
+               debug("Cannot find driver '%s'\n", drv_name);
                return -ENOENT;
        }
-       ret = device_bind(parent, drv, dev_name, NULL, -1, devp);
+       ret = device_bind(parent, drv, dev_name, NULL, node, devp);
        if (ret) {
-               printf("Cannot create device named '%s' (err=%d)\n",
-                      dev_name, ret);
+               debug("Cannot create device named '%s' (err=%d)\n",
+                     dev_name, ret);
                return ret;
        }
 
        return 0;
 }
 
-#ifdef CONFIG_OF_CONTROL
+#if CONFIG_IS_ENABLED(OF_CONTROL)
 /**
  * driver_check_compatible() - Check if a driver is compatible with this node
  *
@@ -171,10 +172,11 @@ int lists_bind_fdt(struct udevice *parent, const void *blob, int offset,
                dm_dbg("   - found match at '%s'\n", entry->name);
                ret = device_bind(parent, entry, name, NULL, offset, &dev);
                if (ret) {
-                       dm_warn("Error binding driver '%s'\n", entry->name);
+                       dm_warn("Error binding driver '%s': %d\n", entry->name,
+                               ret);
                        return ret;
                } else {
-                       dev->of_id = id;
+                       dev->driver_data = id->data;
                        found = true;
                        if (devp)
                                *devp = dev;