Commit d7677bfc04920aa5e6a7c886a5095bcd53e0503a

Authored by Marek Vasut
Committed by Marek Vasut
1 parent d22c8be964

dm: core: Decouple DM from DT

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>

Showing 3 changed files with 7 additions and 7 deletions Side-by-side Diff

drivers/core/device.c
... ... @@ -526,6 +526,7 @@
526 526 return 0;
527 527 }
528 528  
  529 +#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
529 530 /**
530 531 * device_find_by_ofnode() - Return device associated with given ofnode
531 532 *
... ... @@ -552,6 +553,7 @@
552 553  
553 554 return -ENODEV;
554 555 }
  556 +#endif
555 557  
556 558 int device_get_child(struct udevice *parent, int index, struct udevice **devp)
557 559 {
... ... @@ -817,6 +819,7 @@
817 819 return 0;
818 820 }
819 821  
  822 +#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
820 823 bool device_is_compatible(struct udevice *dev, const char *compat)
821 824 {
822 825 return ofnode_device_is_compatible(dev_ofnode(dev), compat);
... ... @@ -879,4 +882,5 @@
879 882  
880 883 return lists_bind_fdt(parent, node, NULL, false);
881 884 }
  885 +#endif
... ... @@ -314,13 +314,6 @@
314 314 #endif
315 315 return dm_scan_fdt_node(gd->dm_root, blob, 0, pre_reloc_only);
316 316 }
317   -#else
318   -static int dm_scan_fdt_node(struct udevice *parent, const void *blob,
319   - int offset, bool pre_reloc_only)
320   -{
321   - return 0;
322   -}
323   -#endif
324 317  
325 318 static int dm_scan_fdt_ofnode_path(const char *path, bool pre_reloc_only)
326 319 {
... ... @@ -360,6 +353,7 @@
360 353  
361 354 return ret;
362 355 }
  356 +#endif
363 357  
364 358 __weak int dm_scan_other(bool pre_reloc_only)
365 359 {
... ... @@ -31,6 +31,7 @@
31 31 return count;
32 32 }
33 33  
  34 +#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
34 35 bool dm_ofnode_pre_reloc(ofnode node)
35 36 {
36 37 #if defined(CONFIG_SPL_BUILD) || defined(CONFIG_TPL_BUILD)
... ... @@ -56,4 +57,5 @@
56 57 return false;
57 58 #endif
58 59 }
  60 +#endif