diff options
author | Fabio Baltieri <fabiobaltieri@google.com> | 2022-08-30 15:04:56 +0000 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-09-09 09:22:22 +0000 |
commit | d39b2e7252894a0b0d867627a69518bd0a61ae96 (patch) | |
tree | f99fb04af464d3a50526122e0fd982d623f6db60 | |
parent | 22bf4291f700ee392d3fbb6ac0297c84ab1f4e8c (diff) | |
download | chrome-ec-d39b2e7252894a0b0d867627a69518bd0a61ae96.tar.gz |
zephyr: shim: use DT_FOREACH_CHILD_STATUS_OKAY_SEP where applicable
Use DT_FOREACH_CHILD_STATUS_OKAY_SEP for _COMMA lists where applicable.
This allows dropping some macros that were only being used to add a
comma to an existing macro.
BRANCH=none
BUG=none
TEST=zmake buildall
Cq-Depend: chromium:3866527
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Change-Id: Ie58ae12c01ef6afc193e0fb3c4b6cbd1a224518e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3864924
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
Reviewed-by: Tristan Honscheid <honscheid@google.com>
-rw-r--r-- | zephyr/shim/include/gpio/gpio_int.h | 10 | ||||
-rw-r--r-- | zephyr/shim/include/power/power.h | 6 | ||||
-rw-r--r-- | zephyr/shim/include/temp_sensor/temp_sensor.h | 8 | ||||
-rw-r--r-- | zephyr/shim/include/zephyr_adc.h | 8 | ||||
-rw-r--r-- | zephyr/shim/src/pwm_led.c | 5 |
5 files changed, 15 insertions, 22 deletions
diff --git a/zephyr/shim/include/gpio/gpio_int.h b/zephyr/shim/include/gpio/gpio_int.h index af5c9c4ace..4bb021d54d 100644 --- a/zephyr/shim/include/gpio/gpio_int.h +++ b/zephyr/shim/include/gpio/gpio_int.h @@ -33,17 +33,15 @@ /* * Create an enum list of the interrupts */ -#define GPIO_INT_ENUM_WITH_COMMA(id) GPIO_INT_ENUM(id), enum gpio_interrupts { #if DT_HAS_COMPAT_STATUS_OKAY(cros_ec_gpio_interrupts) - DT_FOREACH_CHILD(DT_COMPAT_GET_ANY_STATUS_OKAY(cros_ec_gpio_interrupts), - GPIO_INT_ENUM_WITH_COMMA) + DT_FOREACH_CHILD_SEP( + DT_COMPAT_GET_ANY_STATUS_OKAY(cros_ec_gpio_interrupts), + GPIO_INT_ENUM, (, )), #endif - GPIO_INT_COUNT + GPIO_INT_COUNT }; -#undef GPIO_INT_ENUM_WITH_COMMA - /* * Forward reference to avoiding exposing internal structure * defined in gpio_int.c diff --git a/zephyr/shim/include/power/power.h b/zephyr/shim/include/power/power.h index c9a7437d4c..be25c26d85 100644 --- a/zephyr/shim/include/power/power.h +++ b/zephyr/shim/include/power/power.h @@ -35,11 +35,11 @@ #define GEN_POWER_SIGNAL_ENUM_ENTRY(cid) \ DT_STRING_UPPER_TOKEN(cid, power_enum_name) -#define GEN_POWER_SIGNAL_ENUM_ENTRY_COMMA(cid) GEN_POWER_SIGNAL_ENUM_ENTRY(cid), enum power_signal { - DT_FOREACH_CHILD(POWER_SIGNAL_LIST_NODE, - GEN_POWER_SIGNAL_ENUM_ENTRY_COMMA) POWER_SIGNAL_COUNT + DT_FOREACH_CHILD_SEP(POWER_SIGNAL_LIST_NODE, + GEN_POWER_SIGNAL_ENUM_ENTRY, (, )), + POWER_SIGNAL_COUNT }; /* diff --git a/zephyr/shim/include/temp_sensor/temp_sensor.h b/zephyr/shim/include/temp_sensor/temp_sensor.h index 6f06ae5a44..2b3c08d448 100644 --- a/zephyr/shim/include/temp_sensor/temp_sensor.h +++ b/zephyr/shim/include/temp_sensor/temp_sensor.h @@ -12,7 +12,6 @@ #ifdef CONFIG_PLATFORM_EC_TEMP_SENSOR #define ZSHIM_TEMP_SENSOR_ID(node_id) DT_STRING_UPPER_TOKEN(node_id, enum_name) -#define TEMP_SENSOR_ID_WITH_COMMA(node_id) ZSHIM_TEMP_SENSOR_ID(node_id), #define HAS_POWER_GOOD_PIN(node_id) DT_NODE_HAS_PROP(node_id, power_good_pin) || #define ANY_INST_HAS_POWER_GOOD_PIN \ @@ -20,13 +19,12 @@ enum temp_sensor_id { #if DT_NODE_EXISTS(DT_PATH(named_temp_sensors)) - DT_FOREACH_CHILD(DT_PATH(named_temp_sensors), TEMP_SENSOR_ID_WITH_COMMA) + DT_FOREACH_CHILD_SEP(DT_PATH(named_temp_sensors), ZSHIM_TEMP_SENSOR_ID, + (, )), #endif /* named_temp_sensors */ - TEMP_SENSOR_COUNT + TEMP_SENSOR_COUNT }; -#undef TEMP_SENSOR_ID_WITH_COMMA - /* PCT2075 access array */ #define ZSHIM_PCT2075_SENSOR_ID(node_id) \ DT_STRING_UPPER_TOKEN(node_id, pct2075_name) diff --git a/zephyr/shim/include/zephyr_adc.h b/zephyr/shim/include/zephyr_adc.h index 8f9b1f85d5..e8cf8fb5ee 100644 --- a/zephyr/shim/include/zephyr_adc.h +++ b/zephyr/shim/include/zephyr_adc.h @@ -11,17 +11,15 @@ #ifdef CONFIG_ADC #define ZSHIM_ADC_ID(node_id) DT_STRING_UPPER_TOKEN(node_id, enum_name) -#define ADC_ID_WITH_COMMA(node_id) ZSHIM_ADC_ID(node_id), enum adc_channel { #if DT_NODE_EXISTS(DT_INST(0, named_adc_channels)) - DT_FOREACH_CHILD(DT_INST(0, named_adc_channels), ADC_ID_WITH_COMMA) + DT_FOREACH_CHILD_SEP(DT_INST(0, named_adc_channels), ZSHIM_ADC_ID, + (, )), #endif /* named_adc_channels */ - ADC_CH_COUNT + ADC_CH_COUNT }; -#undef ADC_ID_WITH_COMMA - struct adc_t { const char *name; const struct device *dev; diff --git a/zephyr/shim/src/pwm_led.c b/zephyr/shim/src/pwm_led.c index 9e213f94b3..335d0b007f 100644 --- a/zephyr/shim/src/pwm_led.c +++ b/zephyr/shim/src/pwm_led.c @@ -40,10 +40,9 @@ BUILD_ASSERT((PWM_LEDS_LEN > 0) && (PWM_LEDS_LEN <= 2), DT_INST_FOREACH_PROP_ELEM(0, leds, PWM_LEDS_BUILD_ASSERT) #define PWM_LED_NAME(node_id) DT_STRING_UPPER_TOKEN(node_id, ec_led_name) -#define PWM_LED_NAME_WITH_COMMA(node_id) PWM_LED_NAME(node_id), -const enum ec_led_id supported_led_ids[] = { DT_INST_FOREACH_CHILD( - 0, PWM_LED_NAME_WITH_COMMA) }; +const enum ec_led_id supported_led_ids[] = { DT_INST_FOREACH_CHILD_SEP( + 0, PWM_LED_NAME, (, )) }; const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids); BUILD_ASSERT(ARRAY_SIZE(supported_led_ids) == DT_INST_PROP_LEN(0, leds), |