summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabio Baltieri <fabiobaltieri@google.com>2022-12-21 12:39:06 +0000
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-12-23 12:01:26 +0000
commit2202295d5f00c0d9fd1247ad6adf7389e87c64fb (patch)
tree6343a9d5b18f13baa83b04e6b585ea4695c3fbd1
parentf541b5df493e24c45d7d57d1f3a884157f3eae81 (diff)
downloadchrome-ec-2202295d5f00c0d9fd1247ad6adf7389e87c64fb.tar.gz
zephyr: ec-console: remove DT_PATH usages
Use a compatible lookup to find the ec-console node, add check for duplicate nodes, drop a redundant explicit setting (it defaults to y). BRANCH=none BUG=none TEST=cq dry run TEST=zmake compare-builds -a Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: Ie2920843e2315a866bb0244b86bfd1e2d5d24b5b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4116775 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Al Semjonovs <asemjonovs@google.com>
-rw-r--r--zephyr/shim/src/console.c15
-rw-r--r--zephyr/test/drivers/default/prj.conf1
2 files changed, 10 insertions, 6 deletions
diff --git a/zephyr/shim/src/console.c b/zephyr/shim/src/console.c
index fa6dc5a613..60e698f2c0 100644
--- a/zephyr/shim/src/console.c
+++ b/zephyr/shim/src/console.c
@@ -268,11 +268,16 @@ int zshim_run_ec_console_command(const struct zephyr_console_command *command,
return ret;
}
-#if defined(CONFIG_CONSOLE_CHANNEL) && DT_NODE_EXISTS(DT_PATH(ec_console))
-#define EC_CONSOLE DT_PATH(ec_console)
+BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(ec_console) <= 1,
+ "at most one ec-console compatible node may be present");
-static const char *const disabled_channels[] = DT_PROP(EC_CONSOLE, disabled);
-static const size_t disabled_channel_count = DT_PROP_LEN(EC_CONSOLE, disabled);
+#define EC_CONSOLE_NODE DT_COMPAT_GET_ANY_STATUS_OKAY(ec_console)
+#if DT_NODE_EXISTS(EC_CONSOLE_NODE)
+
+static const char *const disabled_channels[] =
+ DT_PROP(EC_CONSOLE_NODE, disabled);
+static const size_t disabled_channel_count =
+ DT_PROP_LEN(EC_CONSOLE_NODE, disabled);
static int init_ec_console(const struct device *unused)
{
for (size_t i = 0; i < disabled_channel_count; i++)
@@ -281,7 +286,7 @@ static int init_ec_console(const struct device *unused)
return 0;
}
SYS_INIT(init_ec_console, PRE_KERNEL_1, 50);
-#endif /* CONFIG_CONSOLE_CHANNEL && DT_NODE_EXISTS(DT_PATH(ec_console)) */
+#endif /* CONFIG_PLATFORM_EC_CONSOLE_CHANNEL */
static int init_ec_shell(const struct device *unused)
{
diff --git a/zephyr/test/drivers/default/prj.conf b/zephyr/test/drivers/default/prj.conf
index 0cfce532cd..bf94510c1d 100644
--- a/zephyr/test/drivers/default/prj.conf
+++ b/zephyr/test/drivers/default/prj.conf
@@ -7,7 +7,6 @@ CONFIG_PLATFORM_EC_CONSOLE_CMD_RTC=y
CONFIG_PLATFORM_EC_CONSOLE_CMD_RTC_ALARM=y
CONFIG_PLATFORM_EC_RTC=y
CONFIG_PLATFORM_EC_VOLUME_BUTTONS=y
-CONFIG_PLATFORM_EC_CONSOLE_CHANNEL=y
CONFIG_TASK_HOSTCMD_THREAD_MAIN=y
CONFIG_SYSTEM_FAKE=y