diff mbox series

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

Message ID 20200719161601.495421-30-sjg@chromium.org
State Accepted
Commit a0558aca55c16a7f561656cb11bf172ef414bcec
Delegated to: Tom Rini
Headers show
Series dm: Avoid including dm.h in header files | expand

Commit Message

Simon Glass July 19, 2020, 4:15 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>
---

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

Comments

Tom Rini Aug. 4, 2020, 3:06 p.m. UTC | #1
On Sun, Jul 19, 2020 at 10:15:59AM -0600, Simon Glass wrote:

> 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>

Applied to u-boot/master, thanks!
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_