]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
dm: core: gracefully handle alias seq without of
authorMarcel Ziswiler <marcel@ziswiler.com>
Mon, 20 May 2019 00:44:57 +0000 (02:44 +0200)
committerTom Rini <trini@konsulko.com>
Tue, 30 Jun 2020 15:12:28 +0000 (11:12 -0400)
Gracefully handle alias seq in the platform data rather than OF case.

Signed-off-by: Marcel Ziswiler <marcel@ziswiler.com>
drivers/core/read.c
include/dm/read.h

index 047089c886711411e66316c5aeb093f0bc93ce88..85b3b7a5adb7b0bb13b98a2d6772b71babebaa29 100644 (file)
@@ -275,15 +275,17 @@ int dev_read_alias_seq(const struct udevice *dev, int *devnump)
 {
        ofnode node = dev_ofnode(dev);
        const char *uc_name = dev->uclass->uc_drv->name;
-       int ret;
+       int ret = -ENOTSUPP;
 
        if (ofnode_is_np(node)) {
                ret = of_alias_get_id(ofnode_to_np(node), uc_name);
                if (ret >= 0)
                        *devnump = ret;
        } else {
+#if CONFIG_IS_ENABLED(OF_CONTROL)
                ret = fdtdec_get_alias_seq(gd->fdt_blob, uc_name,
                                           ofnode_to_offset(node), devnump);
+#endif
        }
 
        return ret;
index 1c1bc3702fd369da56e0dce28ff640785b0fff7d..3711386f5136e277a557552e6abf11eca0c1537a 100644 (file)
@@ -923,8 +923,12 @@ static inline const void *dev_read_prop_by_prop(struct ofprop *prop,
 
 static inline int dev_read_alias_seq(const struct udevice *dev, int *devnump)
 {
+#if CONFIG_IS_ENABLED(OF_CONTROL)
        return fdtdec_get_alias_seq(gd->fdt_blob, dev->uclass->uc_drv->name,
                                    dev_of_offset(dev), devnump);
+#else
+       return -ENOTSUPP;
+#endif
 }
 
 static inline int dev_read_u32_array(const struct udevice *dev,