summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Short <keithshort@chromium.org>2021-04-08 13:36:32 -0600
committerCommit Bot <commit-bot@chromium.org>2021-04-09 05:25:34 +0000
commitf7b050059033086772356760da618d51fe3dbdc4 (patch)
treeb69203196a3a9b850c0468d51997427fd6f3bb11
parent393c3c20dfd15d666c84b88a23cadac1c6dadb3f (diff)
downloadchrome-ec-f7b050059033086772356760da618d51fe3dbdc4.tar.gz
zephyr: Fix compiler warnings from zephyr tests
Fix the warning that an attribute declaration must precede the definition. BUG=none BRANCH=none TEST=zmake testall Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I9b0394d276e0fb39983cd43269804a70139c0655 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2816140 Commit-Queue: Yuval Peress <peress@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org>
-rw-r--r--include/host_command.h6
-rw-r--r--zephyr/shim/include/zephyr_host_command.h6
2 files changed, 9 insertions, 3 deletions
diff --git a/include/host_command.h b/include/host_command.h
index 459ad2e4e5..5453f34eee 100644
--- a/include/host_command.h
+++ b/include/host_command.h
@@ -256,7 +256,7 @@ __error("This function should only be called from Zephyr OS code")
#endif
struct host_command *zephyr_find_host_command(int command);
-#if defined(CONFIG_PLATFORM_EC_HOSTCMD)
+#if defined(CONFIG_ZEPHYR)
#include "zephyr_host_command.h"
#elif defined(HAS_TASK_HOSTCMD)
#define EXPAND(off, cmd) __host_cmd_(off, cmd)
@@ -284,14 +284,14 @@ struct host_command *zephyr_find_host_command(int command);
EXPANDSTR(EC_CMD_BOARD_SPECIFIC_BASE, command)))) \
= {routine, EC_PRIVATE_HOST_COMMAND_VALUE(command), \
version_mask}
-#else
+#else /* !CONFIG_ZEPHYR && !HAS_TASK_HOSTCMD */
#define DECLARE_HOST_COMMAND(command, routine, version_mask) \
enum ec_status (routine)(struct host_cmd_handler_args *args) \
__attribute__((unused))
#define DECLARE_PRIVATE_HOST_COMMAND(command, routine, version_mask) \
DECLARE_HOST_COMMAND(command, routine, version_mask)
-#endif
+#endif /* CONFIG_ZEPHYR */
/**
* Politely ask the CPU to enable/disable its own throttling.
diff --git a/zephyr/shim/include/zephyr_host_command.h b/zephyr/shim/include/zephyr_host_command.h
index d8ee0c2c9b..377578311c 100644
--- a/zephyr/shim/include/zephyr_host_command.h
+++ b/zephyr/shim/include/zephyr_host_command.h
@@ -12,6 +12,8 @@
#include <init.h>
+#ifdef CONFIG_PLATFORM_EC_HOSTCMD
+
/** Node in a list of host-command handlers */
struct zshim_host_command_node {
struct host_command *cmd;
@@ -50,3 +52,7 @@ void zshim_setup_host_command(
return 0; \
} \
SYS_INIT(_setup_host_command_##line, APPLICATION, 1)
+#else /* !CONFIG_PLATFORM_EC_HOSTCMD */
+#define DECLARE_HOST_COMMAND(command, routine, version_mask) \
+ enum ec_status (routine)(struct host_cmd_handler_args *args)
+#endif /* CONFIG_PLATFORM_EC_HOSTCMD */