]> git.sur5r.net Git - u-boot/commitdiff
dm: core: Add logging of some common errors
authorSimon Glass <sjg@chromium.org>
Mon, 11 Jun 2018 19:07:19 +0000 (13:07 -0600)
committerSimon Glass <sjg@chromium.org>
Mon, 9 Jul 2018 15:11:00 +0000 (09:11 -0600)
Add additional logging so that common errors when finding a device by
ofnode are easier to debug.

Signed-off-by: Simon Glass <sjg@chromium.org>
drivers/core/uclass.c

index 0085d3fb24ba353798924728a8aed93e64810509..d609b170e1a9efd4e0f6ed07ddf7a34706ef5530 100644 (file)
@@ -308,6 +308,7 @@ int uclass_find_device_by_ofnode(enum uclass_id id, ofnode node,
        struct udevice *dev;
        int ret;
 
+       log(LOGC_DM, LOGL_DEBUG, "Looking for %s\n", ofnode_get_name(node));
        *devp = NULL;
        if (!ofnode_valid(node))
                return -ENODEV;
@@ -316,13 +317,19 @@ int uclass_find_device_by_ofnode(enum uclass_id id, ofnode node,
                return ret;
 
        list_for_each_entry(dev, &uc->dev_head, uclass_node) {
+               log(LOGC_DM, LOGL_DEBUG_CONTENT, "      - checking %s\n",
+                   dev->name);
                if (ofnode_equal(dev_ofnode(dev), node)) {
                        *devp = dev;
-                       return 0;
+                       goto done;
                }
        }
+       ret = -ENODEV;
 
-       return -ENODEV;
+done:
+       log(LOGC_DM, LOGL_DEBUG, "   - result for %s: %s (ret=%d)\n",
+           ofnode_get_name(node), *devp ? (*devp)->name : "(none)", ret);
+       return ret;
 }
 
 #if CONFIG_IS_ENABLED(OF_CONTROL)
@@ -449,8 +456,11 @@ int uclass_get_device_by_ofnode(enum uclass_id id, ofnode node,
        struct udevice *dev;
        int ret;
 
+       log(LOGC_DM, LOGL_DEBUG, "Looking for %s\n", ofnode_get_name(node));
        *devp = NULL;
        ret = uclass_find_device_by_ofnode(id, node, &dev);
+       log(LOGC_DM, LOGL_DEBUG, "   - result for %s: %s (ret=%d)\n",
+           ofnode_get_name(node), dev ? dev->name : "(none)", ret);
 
        return uclass_get_device_tail(dev, ret, devp);
 }