summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Yilun Lin <yllin@chromium.org>2022-07-07 14:32:23 +0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-07-08 03:01:20 +0000
commit59ddcfc2cf71e0c0f72ce5db583f5536d1aa73c0 (patch)
treedc71c80a60d59cdd5124bf447e6d7207c17728a9
parentf3ee256dc0ca5b8c74b7dacad18c20e22fe180b4 (diff)
downloadchrome-ec-59ddcfc2cf71e0c0f72ce5db583f5536d1aa73c0.tar.gz
bc12: add comma separator in bc12 shim for a better format
Move the comma from header to the dts binding. BUG=none TEST=zmake --goma testall --clobber BRANCH=none Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Change-Id: If7cd0d3947cc73c9b2ef8ad378d58fce5e8fe833 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3750554 Commit-Queue: Eric Yilun Lin <yllin@google.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Auto-Submit: Eric Yilun Lin <yllin@google.com> Tested-by: Eric Yilun Lin <yllin@google.com>
-rw-r--r--zephyr/shim/include/usbc/bc12_pi3usb9201.h2
-rw-r--r--zephyr/shim/include/usbc/bc12_rt1739.h2
-rw-r--r--zephyr/shim/include/usbc/bc12_rt9490.h2
-rw-r--r--zephyr/shim/src/bc12.c18
4 files changed, 12 insertions, 12 deletions
diff --git a/zephyr/shim/include/usbc/bc12_pi3usb9201.h b/zephyr/shim/include/usbc/bc12_pi3usb9201.h
index 85b1c00443..552fe828b1 100644
--- a/zephyr/shim/include/usbc/bc12_pi3usb9201.h
+++ b/zephyr/shim/include/usbc/bc12_pi3usb9201.h
@@ -10,4 +10,4 @@
#define BC12_CHIP_PI3USB9201(id) \
{ \
.drv = &pi3usb9201_drv, \
- },
+ }
diff --git a/zephyr/shim/include/usbc/bc12_rt1739.h b/zephyr/shim/include/usbc/bc12_rt1739.h
index 15df73857a..efe6d42412 100644
--- a/zephyr/shim/include/usbc/bc12_rt1739.h
+++ b/zephyr/shim/include/usbc/bc12_rt1739.h
@@ -10,4 +10,4 @@
#define BC12_CHIP_RT1739(id) \
{ \
.drv = &rt1739_bc12_drv, \
- },
+ }
diff --git a/zephyr/shim/include/usbc/bc12_rt9490.h b/zephyr/shim/include/usbc/bc12_rt9490.h
index fe57e42524..acdcdd562c 100644
--- a/zephyr/shim/include/usbc/bc12_rt9490.h
+++ b/zephyr/shim/include/usbc/bc12_rt9490.h
@@ -10,4 +10,4 @@
#define BC12_CHIP_RT9490(id) \
{ \
.drv = &rt9490_bc12_drv, \
- },
+ }
diff --git a/zephyr/shim/src/bc12.c b/zephyr/shim/src/bc12.c
index 4f1fd2db01..19cabfc83e 100644
--- a/zephyr/shim/src/bc12.c
+++ b/zephyr/shim/src/bc12.c
@@ -16,15 +16,15 @@
#define BC12_CHIP(id, fn) [USBC_PORT(id)] = fn(id)
+#define MAYBE_EMPTY(compat, config) \
+ COND_CODE_1(DT_HAS_STATUS_OKAY(compat), \
+ (DT_FOREACH_STATUS_OKAY_VARGS(compat, BC12_CHIP, config)), \
+ (EMPTY))
+
/* Power Path Controller */
-struct bc12_config bc12_ports[CHARGE_PORT_COUNT] = {
- DT_FOREACH_STATUS_OKAY_VARGS(RT1739_BC12_COMPAT, BC12_CHIP,
- BC12_CHIP_RT1739)
- DT_FOREACH_STATUS_OKAY_VARGS(RT9490_BC12_COMPAT, BC12_CHIP,
- BC12_CHIP_RT9490)
- DT_FOREACH_STATUS_OKAY_VARGS(PI3USB9201_COMPAT,
- BC12_CHIP,
- BC12_CHIP_PI3USB9201)
-};
+struct bc12_config bc12_ports[CHARGE_PORT_COUNT] = { LIST_DROP_EMPTY(
+ MAYBE_EMPTY(RT1739_BC12_COMPAT, BC12_CHIP_RT1739),
+ MAYBE_EMPTY(RT9490_BC12_COMPAT, BC12_CHIP_RT9490),
+ MAYBE_EMPTY(PI3USB9201_COMPAT, BC12_CHIP_PI3USB9201)) };
#endif /* #if DT_HAS_COMPAT_STATUS_OKAY */