summaryrefslogtreecommitdiff
path: root/zephyr/test/drivers/default/src/bc12.c
diff options
context:
space:
mode:
authorAaron Massey <aaronmassey@google.com>2022-08-09 17:17:32 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-08-14 16:14:13 +0000
commitd84b01e8075947e37272c041ce4bbeb905babffd (patch)
tree8748ce26af15d46e1651525a4e299e4f3b46cb72 /zephyr/test/drivers/default/src/bc12.c
parentaad245d1600d2a934e476a4f211a2034e5f2d66e (diff)
downloadchrome-ec-d84b01e8075947e37272c041ce4bbeb905babffd.tar.gz
emul: Migrate from unnecessary i2c_emul changes
Cleanup existing usages and corresponding dependencies on modifying instances of struct i2c_emul so they do not serve as bad code examples for future emulator development. Remove reliance on setting these fields from emulators and tests alike. This includes migrating where we rely on i2c_emul internal fields to get a pointer to an emulator to using the EMUL_DT_GET macro. BRANCH=none BUG=b:241981636 TEST=twister -T ec/zephyr/test/ Signed-off-by: Aaron Massey <aaronmassey@google.com> Change-Id: I0ed864eee0795465ed4d54d498199b95f7fddc62 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3821052 Reviewed-by: Yuval Peress <peress@google.com> Tested-by: Yuval Peress <peress@google.com> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
Diffstat (limited to 'zephyr/test/drivers/default/src/bc12.c')
-rw-r--r--zephyr/test/drivers/default/src/bc12.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/zephyr/test/drivers/default/src/bc12.c b/zephyr/test/drivers/default/src/bc12.c
index 08ba790a04..6605fa77bc 100644
--- a/zephyr/test/drivers/default/src/bc12.c
+++ b/zephyr/test/drivers/default/src/bc12.c
@@ -21,9 +21,7 @@
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(test_drivers_bc12, LOG_LEVEL_DBG);
-#define EMUL_LABEL DT_NODELABEL(pi3usb9201_emul)
-
-#define PI3USB9201_ORD DT_DEP_ORD(EMUL_LABEL)
+#define EMUL_NODE DT_NODELABEL(pi3usb9201_emul)
/* Control_1 register bit definitions */
#define PI3USB9201_REG_CTRL_1_INT_MASK BIT(0)
@@ -96,7 +94,7 @@ static const struct bc12_status bc12_chg_limits[] = {
static void test_bc12_pi3usb9201_host_mode(void)
{
- const struct emul *emul = pi3usb9201_emul_get(PI3USB9201_ORD);
+ const struct emul *emul = EMUL_DT_GET(EMUL_NODE);
uint8_t a, b;
/*
@@ -143,7 +141,7 @@ test_bc12_pi3usb9201_client_mode(enum pi3usb9201_client_sts detect_result,
enum charge_supplier supplier,
int current_limit)
{
- const struct emul *emul = pi3usb9201_emul_get(PI3USB9201_ORD);
+ const struct emul *emul = EMUL_DT_GET(EMUL_NODE);
uint8_t a, b;
int port, voltage;
@@ -230,7 +228,7 @@ ZTEST_USER(bc12, test_bc12_pi3usb9201)
{
const struct device *batt_pres_dev =
DEVICE_DT_GET(DT_GPIO_CTLR(GPIO_BATT_PRES_ODL_PATH, gpios));
- const struct emul *emul = pi3usb9201_emul_get(PI3USB9201_ORD);
+ const struct emul *emul = EMUL_DT_GET(EMUL_NODE);
uint8_t a, b;
/* Pretend we have battery and AC so charging works normally. */