[PATCH 29/31] dm: core: Guard against including dm.h in header files

Simon Glass sjg at chromium.org
Sun Jul 19 18:15:59 CEST 2020


Header files generally should not include header files just for a struct,
since forward declarations work just as well and reduce overhead.

Add a warning for dm.h being included, since this has crept into U-Boot.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 include/dm.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/dm.h b/include/dm.h
index 2e1afda440..a1b84169e6 100644
--- a/include/dm.h
+++ b/include/dm.h
@@ -3,6 +3,10 @@
  * Copyright (c) 2013 Google, Inc
  */
 
+#ifdef _DM_H_
+#warning "Suspect dm.h is included from a header file - please fix"
+#endif
+
 #ifndef _DM_H_
 #define _DM_H_
 
-- 
2.28.0.rc0.105.gf9edc3c819-goog



More information about the U-Boot mailing list