dm: core: Decouple DM from DT
authorMarek Vasut <marek.vasut+renesas@gmail.com>
Sat, 31 Aug 2019 16:03:28 +0000 (18:03 +0200)
committerMarek Vasut <marex@denx.de>
Mon, 2 Sep 2019 15:38:42 +0000 (17:38 +0200)
Some of the DM functions depend on OF_CONTROL, which is incorrect.
DM and DT are orthogonal. Add macro guards around such functions to
avoid compiling them in when DM is enabled, while OF_CONTROL is not.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
drivers/core/device.c
drivers/core/root.c
drivers/core/util.c

index 474c1642ee511a4353addfe7cfe275ac29ebff52..05dadf98f95950f0b5c29a4ff113dcab7ce3ee74 100644 (file)
@@ -526,6 +526,7 @@ static int device_get_device_tail(struct udevice *dev, int ret,
        return 0;
 }
 
+#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
 /**
  * device_find_by_ofnode() - Return device associated with given ofnode
  *
@@ -552,6 +553,7 @@ static int device_find_by_ofnode(ofnode node, struct udevice **devp)
 
        return -ENODEV;
 }
+#endif
 
 int device_get_child(struct udevice *parent, int index, struct udevice **devp)
 {
@@ -817,6 +819,7 @@ int device_set_name(struct udevice *dev, const char *name)
        return 0;
 }
 
+#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
 bool device_is_compatible(struct udevice *dev, const char *compat)
 {
        return ofnode_device_is_compatible(dev_ofnode(dev), compat);
@@ -879,3 +882,4 @@ int dev_enable_by_path(const char *path)
 
        return lists_bind_fdt(parent, node, NULL, false);
 }
+#endif
index aa5ca4087a592643ad9bbd3f4865633ef334a476..e85643819e7bbdf5cdfe49145257cde82e88571a 100644 (file)
@@ -314,13 +314,6 @@ int dm_scan_fdt(const void *blob, bool pre_reloc_only)
 #endif
        return dm_scan_fdt_node(gd->dm_root, blob, 0, pre_reloc_only);
 }
-#else
-static int dm_scan_fdt_node(struct udevice *parent, const void *blob,
-                           int offset, bool pre_reloc_only)
-{
-       return 0;
-}
-#endif
 
 static int dm_scan_fdt_ofnode_path(const char *path, bool pre_reloc_only)
 {
@@ -360,6 +353,7 @@ int dm_extended_scan_fdt(const void *blob, bool pre_reloc_only)
 
        return ret;
 }
+#endif
 
 __weak int dm_scan_other(bool pre_reloc_only)
 {
index 60b939a92401fee3bf4a5a36a3992f1f4dfd8292..7dc1a2af0282cf7ddecc749dc66fc3bc8851051c 100644 (file)
@@ -31,6 +31,7 @@ int list_count_items(struct list_head *head)
        return count;
 }
 
+#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
 bool dm_ofnode_pre_reloc(ofnode node)
 {
 #if defined(CONFIG_SPL_BUILD) || defined(CONFIG_TPL_BUILD)
@@ -56,3 +57,4 @@ bool dm_ofnode_pre_reloc(ofnode node)
        return false;
 #endif
 }
+#endif