dm: core: Update uclass_find_device_by_phandle() for livetree
authorSimon Glass <sjg@chromium.org>
Fri, 19 May 2017 02:09:12 +0000 (20:09 -0600)
committerSimon Glass <sjg@chromium.org>
Thu, 1 Jun 2017 13:03:09 +0000 (07:03 -0600)
Adjust this function to work with livetree.

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

index 630b2e7336850fbd2a5574ca523cb4bc5a20681d..21dc696da353cad0e4365b46c0a9a01d4372641e 100644 (file)
@@ -324,8 +324,7 @@ static int uclass_find_device_by_phandle(enum uclass_id id,
        int ret;
 
        *devp = NULL;
-       find_phandle = fdtdec_get_int(gd->fdt_blob, dev_of_offset(parent), name,
-                                     -1);
+       find_phandle = dev_read_u32_default(parent, name, -1);
        if (find_phandle <= 0)
                return -ENOENT;
        ret = uclass_get(id, &uc);
@@ -335,7 +334,7 @@ static int uclass_find_device_by_phandle(enum uclass_id id,
        list_for_each_entry(dev, &uc->dev_head, uclass_node) {
                uint phandle;
 
-               phandle = fdt_get_phandle(gd->fdt_blob, dev_of_offset(dev));
+               phandle = dev_read_phandle(dev);
 
                if (phandle == find_phandle) {
                        *devp = dev;