We have a number of drivers that can be used with and without device
trees. On AT91, some non-OF enabled configurations run from on-chip
SRAM, which is limited to few tens of kilobytes in size. We need to
be very size-concious there and having deep_probe_is_supported() as
static inline helper evaluating to false when unused makes it easy to
discard code that is not needed for the non-OF case.

Signed-off-by: Ahmad Fatoum <[email protected]>
---
 common/Makefile      | 2 +-
 include/deep-probe.h | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/common/Makefile b/common/Makefile
index 25f5653f906a..bd5b50bc3be2 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -6,7 +6,7 @@ obj-y                           += memory_display.o
 pbl-$(CONFIG_PBL_CONSOLE)      += memory_display.o
 obj-y                          += clock.o
 obj-y                          += console_common.o
-obj-y                          += deep-probe.o
+obj-$(CONFIG_OFDEVICE)         += deep-probe.o
 obj-y                          += startup.o
 obj-y                          += misc.o
 obj-pbl-y                      += memsize.o
diff --git a/include/deep-probe.h b/include/deep-probe.h
index f75ad1065c86..927dd8d6cf50 100644
--- a/include/deep-probe.h
+++ b/include/deep-probe.h
@@ -9,7 +9,14 @@ struct deep_probe_entry {
        const struct of_device_id *device_id;
 };
 
+#ifdef CONFIG_OFDEVICE
 bool deep_probe_is_supported(void);
+#else
+static inline bool deep_probe_is_supported(void)
+{
+       return false;
+}
+#endif
 
 extern struct deep_probe_entry __barebox_deep_probe_start;
 extern struct deep_probe_entry __barebox_deep_probe_end;
-- 
2.30.2


Reply via email to