summaryrefslogtreecommitdiff
path: root/zephyr/test/drivers/common
diff options
context:
space:
mode:
authorKeith Short <keithshort@chromium.org>2022-08-24 15:13:58 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-08-26 20:17:30 +0000
commit1c40a85a0654beabcc52d442c890e2fb38118a69 (patch)
tree8089d138dd3dba90a5ad83a08724f5edbc650f34 /zephyr/test/drivers/common
parent6ba9883101af2d3ed37ec39edd5c355c706e9be1 (diff)
downloadchrome-ec-1c40a85a0654beabcc52d442c890e2fb38118a69.tar.gz
zephyr: Remove label usage from test utils
Replace emul_get_binding() calls with compile time EMUL_DT_GET() to eliminate references to the label devicetree property. BUG=b:239165779 BRANCH=none TEST=./twister --clobber Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I87253010b15a5b68a891e9d8247c889c3aebfeea Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3855421 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
Diffstat (limited to 'zephyr/test/drivers/common')
-rw-r--r--zephyr/test/drivers/common/include/test/drivers/utils.h12
-rw-r--r--zephyr/test/drivers/common/src/utils.c4
2 files changed, 7 insertions, 9 deletions
diff --git a/zephyr/test/drivers/common/include/test/drivers/utils.h b/zephyr/test/drivers/common/include/test/drivers/utils.h
index ce7ef5f9f6..f3a55dcc54 100644
--- a/zephyr/test/drivers/common/include/test/drivers/utils.h
+++ b/zephyr/test/drivers/common/include/test/drivers/utils.h
@@ -21,21 +21,19 @@
/**
* @brief Helper macro for EMUL_GET_USBC_BINDING. If @p usbc_id has the same
- * port number as @p port, then emul_get_binding for @p chip phandle is
+ * port number as @p port, then struct emul* for @p chip phandle is
* returned.
*
* @param usbc_id Named usbc port ID
* @param port Port number to match with named usbc port
* @param chip Name of chip phandle property
*/
-#define EMUL_GET_USBC_BINDING_IF_PORT_MATCH(usbc_id, port, chip) \
- COND_CODE_1(IS_EQ(USBC_PORT_NEW(usbc_id), port), \
- (emul_get_binding(DT_LABEL(DT_PHANDLE(usbc_id, chip)))), \
- ())
+#define EMUL_GET_USBC_BINDING_IF_PORT_MATCH(usbc_id, port, chip) \
+ COND_CODE_1(IS_EQ(USBC_PORT_NEW(usbc_id), port), \
+ (EMUL_DT_GET(DT_PHANDLE(usbc_id, chip))), ())
/**
- * @brief Get struct emul using emul_get_binding from phandle @p chip property
- * of USBC @p port
+ * @brief Get struct emul from phandle @p chip property of USBC @p port
*
* @param port Named usbc port number. The value has to be integer literal.
* @param chip Name of chip property that is phandle to required emulator.
diff --git a/zephyr/test/drivers/common/src/utils.c b/zephyr/test/drivers/common/src/utils.c
index bdca866a54..f559e8629a 100644
--- a/zephyr/test/drivers/common/src/utils.c
+++ b/zephyr/test/drivers/common/src/utils.c
@@ -153,8 +153,8 @@ void connect_sink_to_port(struct tcpci_partner_data *partner,
* function.
*/
/* Enforce that we only support the isl923x emulator for now */
- __ASSERT_NO_MSG(emul_get_binding(DT_LABEL(
- DT_NODELABEL(isl923x_emul))) == charger_emul);
+ __ASSERT_NO_MSG(EMUL_DT_GET(DT_NODELABEL(isl923x_emul)) ==
+ charger_emul);
isl923x_emul_set_adc_vbus(charger_emul, 0);
tcpci_emul_set_reg(tcpci_emul, TCPC_REG_POWER_STATUS,
TCPC_REG_POWER_STATUS_VBUS_DET);