summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2020-03-02 17:29:54 -0800
committerCommit Bot <commit-bot@chromium.org>2020-03-05 19:45:19 +0000
commit180ad9b2403656ff30de26569d108d205f8b1d9a (patch)
tree5150968f1008615d227e29e57bc3c35a5dfaee91
parent02ebf268d260b34a2a2b8f7937d2a3db0c2a3e86 (diff)
downloadchrome-ec-180ad9b2403656ff30de26569d108d205f8b1d9a.tar.gz
ec_commands.h: Minor changes to integrate with cros_ec_commands.h
- Update license - Extend #ifdef to remove code not needed by the kernel. BUG=chromium:945948 BRANCH=none TEST=compile. Check changes with linux-next/master cros_ec_commands.h. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Change-Id: If0d5a49498a17a24ad7fae6e6bab9b7378374067 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2084024 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
-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
+ *