diff mbox series

[U-Boot,30/30] dm: core: Guard against including dm.h in header files

Message ID 20191027155410.187957-30-sjg@chromium.org
State Superseded
Delegated to: Tom Rini
Headers show
Series [U-Boot,01/30] lib: Allow crc32 to be disabled. | expand

Commit Message

Simon Glass Oct. 27, 2019, 3:54 p.m. UTC
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@chromium.org>
dm: Avoid including dm.h in header files
At present a small number of header files include the dm.h header file.
The intent with driver model is for C files that use it to define dm.h
themselves. This helps indicate that driver model is supported and also
reduces the amount of code pointlessly included and relying on header
guards. Ultimately (combined with the reduction in size of common.h)
this should speed up U-Boot compilation.

This series removes all uses of dm.h in header files and adds a warning
to avert more such activity.
END

---

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

Patch

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_