[PATCH 3/3] debug_ll: pl011: define PUTC_LL only when requested

Sascha Hauer <[email protected]>
Newsgroups org.infradead.lists.barebox
Message-ID <[email protected]>
pl011.h is mainly included from include/debug_ll.h to provide the
PUTC_LL() implementation. It is also included by some boards to get
debug_ll_pl011_putc(). If a board includes it and at the same time
DEBUG_LL is enabled for another board we end up with conflicting
definitions of PUTC_LL(). To prevent this add a #define DEFINE_PUTC_LL
to include/debug_ll.h. A debug_ll.h file now may only provide PUTC_LL()
when this define is set.

Signed-off-by: Sascha Hauer <[email protected]>
---
 include/debug_ll.h       | 2 ++
 include/debug_ll/pl011.h | 6 +-----
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/include/debug_ll.h b/include/debug_ll.h
index 1410783b73..4cab96fbc4 100644
--- a/include/debug_ll.h
+++ b/include/debug_ll.h
@@ -19,7 +19,9 @@
  * this initialization. Depending on the PUTC_LL implementation the board might
  * also hang in PUTC_LL without proper initialization.
  */
+#define DEFINE_PUTC_LL
 #include <asm/debug_ll.h>
+#undef DEFINE_PUTC_LL
 #endif
 
 #if defined (CONFIG_DEBUG_LL)
diff --git a/include/debug_ll/pl011.h b/include/debug_ll/pl011.h
index aeec456f20..bded6720aa 100644
--- a/include/debug_ll/pl011.h
+++ b/include/debug_ll/pl011.h
@@ -16,11 +16,7 @@ static inline void debug_ll_pl011_putc(void __iomem *base, int c)
 	writel(c, base + UART01x_DR);
 }
 
-#ifdef CONFIG_DEBUG_LL
-
-#ifndef DEBUG_LL_UART_ADDR
-#error DEBUG_LL_UART_ADDR is undefined!
-#endif
+#if defined(CONFIG_DEBUG_LL) && defined(DEFINE_PUTC_LL)
 
 static inline void PUTC_LL(char c)
 {

-- 
2.47.3
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.