summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJes B. Klinke <jbk@chromium.org>2023-01-20 23:15:25 -0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-01-23 21:32:50 +0000
commitf6b1cc27cd267919218dc7727bd87dbc874d5d2e (patch)
tree30bd684180aa1159ec76b809417b1179f7cf3a47
parent67830158094d9a67e28a3bd196b51ec0d0617c22 (diff)
downloadchrome-ec-f6b1cc27cd267919218dc7727bd87dbc874d5d2e.tar.gz
common/hooks.h: Tolerate same function registered as multiple hooks
The file clock-stm32l4.c registers the function clock_chipset_startup as both HOOK_CHIPSET_STARTUP and HOOK_CHIPSET_RESUME. Before this change, compiling with hooks disabled would lead to a linker error as a function unused_hook_clock_chipset_startup() would be declared twice. This change makes it such that the hook, as well as the name of the registered function is concatenated into the synthetic function name. BUG=b:192262089 TEST=make BOARD=hyperdebug Change-Id: Ic7ead88e2fd86d509769a1c0a88a788b72576238 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4183953 Tested-by: Jes Klinke <jbk@chromium.org> Commit-Queue: Jes Klinke <jbk@chromium.org> Reviewed-by: Brian Nemec <bnemec@google.com>
-rw-r--r--include/hooks.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/include/hooks.h b/include/hooks.h
index aebf7a3c7e..a1bb97e55d 100644
--- a/include/hooks.h
+++ b/include/hooks.h
@@ -396,10 +396,10 @@ int hook_call_deferred(const struct deferred_data *data, int us);
* CONFIG_COMMON_RUNTIME nor CONFIG_PLATFORM_EC_HOOKS is defined)
*/
#define hook_call_deferred(unused1, unused2) -1
-#define DECLARE_HOOK(t, func, p) \
- void CONCAT2(unused_hook_, func)(void) \
- { \
- func(); \
+#define DECLARE_HOOK(t, func, p) \
+ void CONCAT4(unused_hook_, t, _, func)(void) \
+ { \
+ func(); \
}
#define DECLARE_DEFERRED(func) \
void CONCAT2(unused_deferred_, func)(void) \