summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/ec_commands.h17
-rwxr-xr-xutil/make_linux_ec_commands_h.sh2
2 files changed, 15 insertions, 4 deletions
diff --git a/include/ec_commands.h b/include/ec_commands.h
index 8f1e4ef523..a0e50fb9a7 100644
--- a/include/ec_commands.h
+++ b/include/ec_commands.h
@@ -16,12 +16,13 @@
extern "C" {
#endif
+#ifdef CHROMIUM_EC
/*
* CHROMIUM_EC is defined by the Makefile system of Chromium EC repository.
* It is used to not include macros that may cause conflicts in foreign
* projects (refer to crbug.com/984623).
*/
-#ifdef CHROMIUM_EC
+
/*
* Include common.h for CONFIG_HOSTCMD_ALIGNED, if it's defined. This
* generates more efficient code for accessing request/response structures on
@@ -34,6 +35,16 @@ extern "C" {
#define BUILD_ASSERT(_cond)
+#endif /* CHROMIUM_EC */
+
+#ifndef __KERNEL__
+/*
+ * Defines macros that may be needed but are for sure defined by the linux
+ * kernel. This section is removed when cros_ec_commands.h is generated (by
+ * util/make_linux_ec_commands_h.sh).
+ * cros_ec_commands.h looks more integrated to the kernel.
+ */
+
#ifndef BIT
#define BIT(nr) (1UL << (nr))
#endif
@@ -42,7 +53,7 @@ extern "C" {
#define BIT_ULL(nr) (1ULL << (nr))
#endif
-#endif /* CHROMIUM_EC */
+#endif /* __KERNEL__ */
/*
* Current version of this protocol
@@ -1050,7 +1061,7 @@ struct ec_response_hello {
/* Get version number */
#define EC_CMD_GET_VERSION 0x0002
-#ifndef CHROMIUM_EC
+#if !defined(CHROMIUM_EC) && !defined(__KERNEL__)
/*
* enum ec_current_image is deprecated and replaced by enum ec_image. This
* macro exists for backwards compatibility of external projects until they
diff --git a/util/make_linux_ec_commands_h.sh b/util/make_linux_ec_commands_h.sh
index b860e61f65..c5c3cf6c68 100755
--- a/util/make_linux_ec_commands_h.sh
+++ b/util/make_linux_ec_commands_h.sh
@@ -50,7 +50,7 @@ patch "${tmp}" << EOF
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
-+/* SPDX-License-Identifier: GPL-2.0 */
++/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Host communication command constants for ChromeOS EC
+ *