Skip to contentSkip to conversation

toradex: common: Make TDX_CFG_BLOCK select EVENT

PATCH In review Tom Rini 2 participants 5 messages May 19 – May 20

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/2 toradex: common: Make TDX_CFG_BLOCK select EVENT

Part of the TDX_CFG_BLOCK code makes use of an event to run one of the functions. Make this have a "select EVENT" so that it is always enabled.

---
This was only the case on colibri_vf today.

Cc Francesco Dolcini <[email protected]>
---
 board/toradex/common/Kconfig | 1 +
 1 file changed, 1 insertion(+)
board/toradex/common/Kconfig +1 -0
index b85893ab44e4..05f8341e4c36 100644
@@ -3,6 +3,7 @@
 
 menuconfig TDX_CFG_BLOCK
 	bool "Enable Toradex config block support"
+	select EVENT
 	select OF_BOARD_SETUP
 	select SYSINFO
 	help
Signature · 1 line
2.43.0
author
#1 lore raw

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

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.

---
 include/event.h | 2 ++
 1 file changed, 2 insertions(+)
include/event.h +2 -0
index 3ce5f992b04e..71fb14391f25 100644
@@ -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
Signature · 1 line
2.43.0
author
#2 lore raw

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

Quoted 23 lines · Tom Rini

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.

---
 include/event.h | 2 ++
 1 file changed, 2 insertions(+)
include/event.h +1 -0
index 3ce5f992b04e..71fb14391f25 100644
@@ -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.

include/event.h static inline const char *event_spy_id(struct evspy_info *spy) · line 355

Quoted 7 lines
include/event.h +1 -0
@@ -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

This was really my v0 of the changes, I have made this more general and will post a v2, of what I had intended, shortly.

Signature · 1 line
Tom
author
#3 lore raw

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

Quoted 30 lines · Tom Rini
Quoted 28 lines · Tom Rini

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.

---
 include/event.h | 2 ++
 1 file changed, 2 insertions(+)
include/event.h +2 -0
index 3ce5f992b04e..71fb14391f25 100644
@@ -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
 
Quoted 5 lines

include/event.h static inline const char *event_spy_id(struct evspy_info *spy) · line 355

Quoted 2 lines
include/event.h +0 -0
 /**
  * event_register - register a new spy

This was really my v0 of the changes, I have made this more general and will post a v2, of what I had intended, shortly.

On further testing, I'm going to stick with this version, trying to guard more of the file would require a larger restructure to avoid other compilation problems (the header being perhaps too broadly included, CONFIG_IS_ENABLED(...) checks, and so forth).

Signature · 1 line
Tom