[PATCH 2/2] event: Guard more of the prototypes with an EVENT check

Tom Rini trini at konsulko.com
Tue May 19 20:28:56 CEST 2026


To make sure we cannot encounter the case where code is written to use
the event framework, but EVENT is not enabled, guard most of the header
with a build-time check. This will promote the case in question to a
build time failure and not a runtime debug issue.

Signed-off-by: Tom Rini <trini at konsulko.com>
---
 include/event.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/event.h b/include/event.h
index 3ce5f992b04e..71fb14391f25 100644
--- a/include/event.h
+++ b/include/event.h
@@ -308,6 +308,7 @@ static inline const char *event_spy_id(struct evspy_info *spy)
 #endif
 }
 
+#ifdef CONFIG_EVENT
 /*
  * It seems that LTO will drop list entries if it decides they are not used,
  * although the conditions that cause this are unclear.
@@ -348,6 +349,7 @@ static inline const char *event_spy_id(struct evspy_info *spy)
 	__used ll_entry_declare(struct evspy_info_simple, \
 		_type ## _3_ ## _func, \
 		evspy_info) = _ESPY_REC_SIMPLE(_type, _func)
+#endif
 
 /**
  * event_register - register a new spy
-- 
2.43.0



More information about the U-Boot mailing list