diff options
Diffstat (limited to 'zephyr/shim/include/zephyr_host_command.h')
-rw-r--r-- | zephyr/shim/include/zephyr_host_command.h | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/zephyr/shim/include/zephyr_host_command.h b/zephyr/shim/include/zephyr_host_command.h index cc67049614..e2f0a7c296 100644 --- a/zephyr/shim/include/zephyr_host_command.h +++ b/zephyr/shim/include/zephyr_host_command.h @@ -1,4 +1,4 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. +/* Copyright 2021 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -27,24 +27,19 @@ bool in_host_command_main(void); /** * See include/host_command.h for documentation. */ -#define DECLARE_HOST_COMMAND(_command, _routine, _version_mask) \ - STRUCT_SECTION_ITERABLE(host_command, _cros_hcmd_##_command) = { \ - .command = _command, \ - .handler = _routine, \ - .version_mask = _version_mask, \ +#define DECLARE_HOST_COMMAND(_command, _routine, _version_mask) \ + STRUCT_SECTION_ITERABLE(host_command, _cros_hcmd_##_command) = { \ + .command = _command, \ + .handler = _routine, \ + .version_mask = _version_mask, \ } #else /* !CONFIG_PLATFORM_EC_HOSTCMD */ /* - * Create a fake routine to call the function. The linker should - * garbage-collect it since it is behind 'if (0)' + * Create a global var to reference the host command. The linker should remove + * it since it is never referenced. */ -#define DECLARE_HOST_COMMAND(command, routine, version_mask) \ - int __remove_ ## command(void) \ - { \ - if (0) \ - routine(NULL); \ - return 0; \ - } +#define DECLARE_HOST_COMMAND(command, routine, version_mask) \ + int __remove_##command = ((int)(routine)) #endif /* CONFIG_PLATFORM_EC_HOSTCMD */ |