all: Deprecate UTIL_LISTIFY and replace with LISTIFY

UTIL_LISTIFY is deprecated. Replacing it with LISTIFY.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
Krzysztof Chruscinski 2022-02-28 14:06:36 +01:00 committed by Carles Cufí
parent 9b30b959d5
commit 47ae656cc1
42 changed files with 206 additions and 232 deletions

View file

@ -23,7 +23,7 @@ struct irq_parent_offset {
#define INIT_IRQ_PARENT_OFFSET(i, o) { \
.irq = i, \
.offset = o, \
},
}
#define IRQ_INDEX_TO_OFFSET(i, base) (base + i * CONFIG_MAX_IRQ_PER_AGGREGATOR)
@ -33,7 +33,7 @@ struct irq_parent_offset {
INIT_IRQ_PARENT_OFFSET(CONFIG_2ND_LVL_INTR_0##i##_OFFSET, \
IRQ_INDEX_TO_OFFSET(i, base))
static struct irq_parent_offset lvl2_irq_list[CONFIG_NUM_2ND_LEVEL_AGGREGATORS]
= { UTIL_LISTIFY(CONFIG_NUM_2ND_LEVEL_AGGREGATORS, CAT_2ND_LVL_LIST,
= { LISTIFY(CONFIG_NUM_2ND_LEVEL_AGGREGATORS, CAT_2ND_LVL_LIST, (,),
CONFIG_2ND_LVL_ISR_TBL_OFFSET) };
#endif/* CONFIG_2ND_LEVEL_INTERRUPTS */
@ -44,7 +44,7 @@ static struct irq_parent_offset lvl2_irq_list[CONFIG_NUM_2ND_LEVEL_AGGREGATORS]
INIT_IRQ_PARENT_OFFSET(CONFIG_3RD_LVL_INTR_0##i##_OFFSET, \
IRQ_INDEX_TO_OFFSET(i, base))
static struct irq_parent_offset lvl3_irq_list[CONFIG_NUM_3RD_LEVEL_AGGREGATORS]
= { UTIL_LISTIFY(CONFIG_NUM_3RD_LEVEL_AGGREGATORS, CAT_3RD_LVL_LIST,
= { LISTIFY(CONFIG_NUM_3RD_LEVEL_AGGREGATORS, CAT_3RD_LVL_LIST, (,),
CONFIG_3RD_LVL_ISR_TBL_OFFSET) };
#endif /* CONFIG_3RD_LEVEL_INTERRUPTS */

View file

@ -331,11 +331,11 @@ static const struct adc_driver_api mcp320x_adc_api = {
*/
#define MCP3208_DEVICE(n) MCP320X_DEVICE(3208, n, 8)
#define CALL_WITH_ARG(arg, expr) expr(arg);
#define CALL_WITH_ARG(arg, expr) expr(arg)
#define INST_DT_MCP320X_FOREACH(t, inst_expr) \
UTIL_LISTIFY(DT_NUM_INST_STATUS_OKAY(microchip_mcp##t), \
CALL_WITH_ARG, inst_expr)
#define INST_DT_MCP320X_FOREACH(t, inst_expr) \
LISTIFY(DT_NUM_INST_STATUS_OKAY(microchip_mcp##t), \
CALL_WITH_ARG, (;), inst_expr)
INST_DT_MCP320X_FOREACH(3204, MCP3204_DEVICE);
INST_DT_MCP320X_FOREACH(3208, MCP3208_DEVICE);

View file

@ -69,9 +69,9 @@ struct uart_mux {
static struct uart_mux uart_mux_##x __used \
__attribute__((__section__(".uart_mux.data"))) = { \
.rx_ringbuf = &uart_rx_ringbuf_##x, \
};
}
UTIL_LISTIFY(CONFIG_UART_MUX_REAL_DEVICE_COUNT, DEFINE_UART_MUX, _)
LISTIFY(CONFIG_UART_MUX_REAL_DEVICE_COUNT, DEFINE_UART_MUX, (;), _)
extern struct uart_mux __uart_mux_start[];
extern struct uart_mux __uart_mux_end[];
@ -869,7 +869,7 @@ void uart_mux_foreach(uart_mux_cb_t cb, void *user_data)
#define DEFINE_UART_MUX_CFG_DATA(x, _) \
struct uart_mux_cfg_data uart_mux_config_##x = { \
};
}
#define DEFINE_UART_MUX_DEV_DATA(x, _) \
RING_BUF_DECLARE(tx_ringbuf_##x, CONFIG_UART_MUX_RINGBUF_SIZE); \
@ -877,7 +877,7 @@ void uart_mux_foreach(uart_mux_cb_t cb, void *user_data)
static struct uart_mux_dev_data uart_mux_dev_data_##x = { \
.tx_ringbuf = &tx_ringbuf_##x, \
.rx_ringbuf = &rx_ringbuf_##x, \
};
}
#define DEFINE_UART_MUX_DEVICE(x, _) \
DEVICE_DEFINE(uart_mux_##x, \
@ -888,11 +888,11 @@ void uart_mux_foreach(uart_mux_cb_t cb, void *user_data)
&uart_mux_config_##x, \
POST_KERNEL, \
CONFIG_CONSOLE_INIT_PRIORITY, \
&uart_mux_driver_api);
&uart_mux_driver_api)
UTIL_LISTIFY(CONFIG_UART_MUX_DEVICE_COUNT, DEFINE_UART_MUX_CFG_DATA, _)
UTIL_LISTIFY(CONFIG_UART_MUX_DEVICE_COUNT, DEFINE_UART_MUX_DEV_DATA, _)
UTIL_LISTIFY(CONFIG_UART_MUX_DEVICE_COUNT, DEFINE_UART_MUX_DEVICE, _)
LISTIFY(CONFIG_UART_MUX_DEVICE_COUNT, DEFINE_UART_MUX_CFG_DATA, (;), _)
LISTIFY(CONFIG_UART_MUX_DEVICE_COUNT, DEFINE_UART_MUX_DEV_DATA, (;), _)
LISTIFY(CONFIG_UART_MUX_DEVICE_COUNT, DEFINE_UART_MUX_DEVICE, (;), _)
static int init_uart_mux(const struct device *dev)
{

View file

@ -406,8 +406,8 @@ static const struct dac_driver_api dacx0508_driver_api = {
#define CALL_WITH_ARG(arg, expr) expr(arg)
#define INST_DT_DACX0508_FOREACH(t, inst_expr) \
UTIL_LISTIFY(DT_NUM_INST_STATUS_OKAY(ti_dac##t), \
CALL_WITH_ARG, inst_expr)
LISTIFY(DT_NUM_INST_STATUS_OKAY(ti_dac##t), \
CALL_WITH_ARG, (), inst_expr)
INST_DT_DACX0508_FOREACH(60508, DAC60508_DEVICE);
INST_DT_DACX0508_FOREACH(70508, DAC70508_DEVICE);

View file

@ -267,8 +267,8 @@ static const struct dac_driver_api dacx3608_driver_api = {
#define CALL_WITH_ARG(arg, expr) expr(arg)
#define INST_DT_DACX3608_FOREACH(t, inst_expr) \
UTIL_LISTIFY(DT_NUM_INST_STATUS_OKAY(ti_dac##t), \
CALL_WITH_ARG, inst_expr)
LISTIFY(DT_NUM_INST_STATUS_OKAY(ti_dac##t), \
CALL_WITH_ARG, (), inst_expr)
INST_DT_DACX3608_FOREACH(43608, DAC43608_DEVICE);
INST_DT_DACX3608_FOREACH(53608, DAC53608_DEVICE);

View file

@ -447,10 +447,10 @@ static const struct display_driver_api ili9xxx_api = {
DEVICE_DT_DEFINE(INST_DT_ILI9XXX(n, t), ili9xxx_init, \
NULL, &ili9xxx_data_##n, \
&ili9xxx_config_##n, POST_KERNEL, \
CONFIG_DISPLAY_INIT_PRIORITY, &ili9xxx_api);
CONFIG_DISPLAY_INIT_PRIORITY, &ili9xxx_api)
#define DT_INST_FOREACH_ILI9XXX_STATUS_OKAY(t) \
UTIL_LISTIFY(DT_NUM_INST_STATUS_OKAY(ilitek_ili##t), ILI9XXX_INIT, t)
LISTIFY(DT_NUM_INST_STATUS_OKAY(ilitek_ili##t), ILI9XXX_INIT, (;), t)
#ifdef CONFIG_ILI9340
#include "display_ili9340.h"

View file

@ -535,8 +535,8 @@ static struct display_drv_data instance_data = {
((DT_GPIO_FLAGS_BY_IDX(node_id, pha, idx) & GPIO_ACTIVE_LOW) ? \
ACTIVE_LOW_MASK : 0)),
#define ADD_FF(i, _) 0xFF,
#define FILL_ROW_WITH_FF(node_id, pha, idx) UTIL_LISTIFY(COL_COUNT, ADD_FF)
#define ADD_FF(i, _) 0xFF
#define FILL_ROW_WITH_FF(node_id, pha, idx) LISTIFY(COL_COUNT, ADD_FF, (,)),
#define GET_PIXEL_ORDINAL(node_id, pha, idx) \
[GET_DT_ROW_IDX(idx) * COL_COUNT + \
GET_DT_COL_IDX(idx)] = idx,

View file

@ -53,33 +53,33 @@ struct dmamux_stm32_config {
};
/*
* UTIL_LISTIFY is used to generate arrays with function pointers to check
* LISTIFY is used to generate arrays with function pointers to check
* and clear interrupt flags using LL functions
*/
#define DMAMUX_CHANNEL(i, _) LL_DMAMUX_CHANNEL_ ## i,
#define IS_ACTIVE_FLAG_SOX(i, _) LL_DMAMUX_IsActiveFlag_SO ## i,
#define CLEAR_FLAG_SOX(i, _) LL_DMAMUX_ClearFlag_SO ## i,
#define IS_ACTIVE_FLAG_RGOX(i, _) LL_DMAMUX_IsActiveFlag_RGO ## i,
#define CLEAR_FLAG_RGOX(i, _) LL_DMAMUX_ClearFlag_RGO ## i,
#define DMAMUX_CHANNEL(i, _) LL_DMAMUX_CHANNEL_ ## i
#define IS_ACTIVE_FLAG_SOX(i, _) LL_DMAMUX_IsActiveFlag_SO ## i
#define CLEAR_FLAG_SOX(i, _) LL_DMAMUX_ClearFlag_SO ## i
#define IS_ACTIVE_FLAG_RGOX(i, _) LL_DMAMUX_IsActiveFlag_RGO ## i
#define CLEAR_FLAG_RGOX(i, _) LL_DMAMUX_ClearFlag_RGO ## i
uint32_t table_ll_channel[] = {
UTIL_LISTIFY(DT_INST_PROP(0, dma_channels), DMAMUX_CHANNEL)
LISTIFY(DT_INST_PROP(0, dma_channels), DMAMUX_CHANNEL, (,))
};
uint32_t (*func_ll_is_active_so[])(DMAMUX_Channel_TypeDef *DMAMUXx) = {
UTIL_LISTIFY(DT_INST_PROP(0, dma_channels), IS_ACTIVE_FLAG_SOX)
LISTIFY(DT_INST_PROP(0, dma_channels), IS_ACTIVE_FLAG_SOX, (,))
};
void (*func_ll_clear_so[])(DMAMUX_Channel_TypeDef *DMAMUXx) = {
UTIL_LISTIFY(DT_INST_PROP(0, dma_channels), CLEAR_FLAG_SOX)
LISTIFY(DT_INST_PROP(0, dma_channels), CLEAR_FLAG_SOX, (,))
};
uint32_t (*func_ll_is_active_rgo[])(DMAMUX_Channel_TypeDef *DMAMUXx) = {
UTIL_LISTIFY(DT_INST_PROP(0, dma_generators), IS_ACTIVE_FLAG_RGOX)
LISTIFY(DT_INST_PROP(0, dma_generators), IS_ACTIVE_FLAG_RGOX, (,))
};
void (*func_ll_clear_rgo[])(DMAMUX_Channel_TypeDef *DMAMUXx) = {
UTIL_LISTIFY(DT_INST_PROP(0, dma_generators), CLEAR_FLAG_RGOX)
LISTIFY(DT_INST_PROP(0, dma_generators), CLEAR_FLAG_RGOX, (,))
};
int dmamux_stm32_configure(const struct device *dev, uint32_t id,
@ -279,14 +279,14 @@ static const struct dma_driver_api dma_funcs = {
* future extension.
*/
#define INIT_DMAMUX_0_CHANNEL(x, ...) \
{ .dev_dma = DEV_DMA_BINDING(x), .dma_id = DMA_CHANNEL(x), },
{ .dev_dma = DEV_DMA_BINDING(x), .dma_id = DMA_CHANNEL(x), }
#define INIT_DMAMUX_1_CHANNEL(x, ...) \
{ .dev_dma = 0, .dma_id = 0, },
{ .dev_dma = 0, .dma_id = 0, }
#define DMAMUX_CHANNELS_INIT_0(count) \
UTIL_LISTIFY(count, INIT_DMAMUX_0_CHANNEL)
LISTIFY(count, INIT_DMAMUX_0_CHANNEL, (,))
#define DMAMUX_CHANNELS_INIT_1(count) \
UTIL_LISTIFY(count, INIT_DMAMUX_1_CHANNEL)
LISTIFY(count, INIT_DMAMUX_1_CHANNEL, (,))
#define DMAMUX_CLOCK_INIT(index) \

View file

@ -660,8 +660,8 @@ static const struct eeprom_driver_api eeprom_at2x_api = {
#define CALL_WITH_ARG(arg, expr) expr(arg);
#define INST_DT_AT2X_FOREACH(t, inst_expr) \
UTIL_LISTIFY(DT_NUM_INST_STATUS_OKAY(atmel_at##t), \
CALL_WITH_ARG, inst_expr)
LISTIFY(DT_NUM_INST_STATUS_OKAY(atmel_at##t), \
CALL_WITH_ARG, (), inst_expr)
#ifdef CONFIG_EEPROM_AT24
INST_DT_AT2X_FOREACH(24, EEPROM_AT24_DEVICE);

View file

@ -71,9 +71,9 @@ struct eth_context {
#define DEFINE_RX_THREAD(x, _) \
K_KERNEL_STACK_DEFINE(rx_thread_stack_##x, \
CONFIG_ARCH_POSIX_RECOMMENDED_STACK_SIZE);\
static struct k_thread rx_thread_data_##x;
static struct k_thread rx_thread_data_##x
UTIL_LISTIFY(CONFIG_ETH_NATIVE_POSIX_INTERFACE_COUNT, DEFINE_RX_THREAD, _)
LISTIFY(CONFIG_ETH_NATIVE_POSIX_INTERFACE_COUNT, DEFINE_RX_THREAD, (;), _);
#if defined(CONFIG_NET_GPTP)
static bool need_timestamping(struct gptp_hdr *hdr)
@ -632,9 +632,9 @@ static const struct ethernet_api eth_if_api = {
.rx_thread = &rx_thread_data_##x, \
.rx_stack = rx_thread_stack_##x, \
.rx_stack_size = K_KERNEL_STACK_SIZEOF(rx_thread_stack_##x), \
};
}
UTIL_LISTIFY(CONFIG_ETH_NATIVE_POSIX_INTERFACE_COUNT, DEFINE_ETH_DEV_DATA, _)
LISTIFY(CONFIG_ETH_NATIVE_POSIX_INTERFACE_COUNT, DEFINE_ETH_DEV_DATA, (;), _);
#define DEFINE_ETH_DEVICE(x, _) \
ETH_NET_DEVICE_INIT(eth_native_posix_##x, \
@ -644,9 +644,9 @@ UTIL_LISTIFY(CONFIG_ETH_NATIVE_POSIX_INTERFACE_COUNT, DEFINE_ETH_DEV_DATA, _)
NULL, \
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \
&eth_if_api, \
NET_ETH_MTU);
NET_ETH_MTU)
UTIL_LISTIFY(CONFIG_ETH_NATIVE_POSIX_INTERFACE_COUNT, DEFINE_ETH_DEVICE, _)
LISTIFY(CONFIG_ETH_NATIVE_POSIX_INTERFACE_COUNT, DEFINE_ETH_DEVICE, (;), _);
#if defined(CONFIG_ETH_NATIVE_POSIX_PTP_CLOCK)
@ -661,9 +661,9 @@ struct ptp_context {
};
#define DEFINE_PTP_DEV_DATA(x, _) \
static struct ptp_context ptp_context_##x;
static struct ptp_context ptp_context_##x
UTIL_LISTIFY(CONFIG_ETH_NATIVE_POSIX_INTERFACE_COUNT, DEFINE_PTP_DEV_DATA, _)
LISTIFY(CONFIG_ETH_NATIVE_POSIX_INTERFACE_COUNT, DEFINE_PTP_DEV_DATA, (;), _);
static int ptp_clock_set_native_posix(const struct device *clk,
struct net_ptp_time *tm)
@ -732,7 +732,7 @@ static const struct ptp_clock_driver_api api = {
return 0; \
}
UTIL_LISTIFY(CONFIG_ETH_NATIVE_POSIX_INTERFACE_COUNT, PTP_INIT_FUNC, _)
LISTIFY(CONFIG_ETH_NATIVE_POSIX_INTERFACE_COUNT, PTP_INIT_FUNC, (), _)
#define DEFINE_PTP_DEVICE(x, _) \
DEVICE_DEFINE(eth_native_posix_ptp_clock_##x, \
@ -743,8 +743,8 @@ UTIL_LISTIFY(CONFIG_ETH_NATIVE_POSIX_INTERFACE_COUNT, PTP_INIT_FUNC, _)
NULL, \
POST_KERNEL, \
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \
&api);
&api)
UTIL_LISTIFY(CONFIG_ETH_NATIVE_POSIX_INTERFACE_COUNT, DEFINE_PTP_DEVICE, _)
LISTIFY(CONFIG_ETH_NATIVE_POSIX_INTERFACE_COUNT, DEFINE_PTP_DEVICE, (;), _);
#endif /* CONFIG_ETH_NATIVE_POSIX_PTP_CLOCK */

View file

@ -72,7 +72,7 @@
} while (0)
#if (CONFIG_FLASH_SIMULATOR_STAT_PAGE_COUNT > STATS_PAGE_COUNT_THRESHOLD)
/* Limitation above is caused by used UTIL_REPEAT */
/* Limitation above is caused by used LISTIFY */
/* Using FLASH_SIMULATOR_FLASH_PAGE_COUNT allows to avoid terrible */
/* error logg at the output and work with the stats module partially */
#define FLASH_SIMULATOR_FLASH_PAGE_COUNT STATS_PAGE_COUNT_THRESHOLD
@ -93,9 +93,9 @@ STATS_SECT_ENTRY32(flash_erase_calls) /* calls to flash_erase() */
STATS_SECT_ENTRY32(flash_erase_time_us) /* time spent in flash_erase() */
/* -- per-unit statistics -- */
/* erase cycle count for unit */
UTIL_EVAL(UTIL_REPEAT(FLASH_SIMULATOR_FLASH_PAGE_COUNT, STATS_SECT_EC))
LISTIFY(FLASH_SIMULATOR_FLASH_PAGE_COUNT, STATS_SECT_EC, ())
/* number of read operations on worn out erase units */
UTIL_EVAL(UTIL_REPEAT(FLASH_SIMULATOR_FLASH_PAGE_COUNT, STATS_SECT_DIRTYR))
LISTIFY(FLASH_SIMULATOR_FLASH_PAGE_COUNT, STATS_SECT_DIRTYR, ())
STATS_SECT_END;
STATS_SECT_DECL(flash_sim_stats) flash_sim_stats;
@ -109,8 +109,8 @@ STATS_NAME(flash_sim_stats, flash_write_calls)
STATS_NAME(flash_sim_stats, flash_write_time_us)
STATS_NAME(flash_sim_stats, flash_erase_calls)
STATS_NAME(flash_sim_stats, flash_erase_time_us)
UTIL_EVAL(UTIL_REPEAT(FLASH_SIMULATOR_FLASH_PAGE_COUNT, STATS_NAME_EC))
UTIL_EVAL(UTIL_REPEAT(FLASH_SIMULATOR_FLASH_PAGE_COUNT, STATS_NAME_DIRTYR))
LISTIFY(FLASH_SIMULATOR_FLASH_PAGE_COUNT, STATS_NAME_EC, ())
LISTIFY(FLASH_SIMULATOR_FLASH_PAGE_COUNT, STATS_NAME_DIRTYR, ())
STATS_NAME_END(flash_sim_stats);
/* simulator dynamic thresholds */

View file

@ -231,9 +231,9 @@ DEVICE_DEFINE(vipm_nrf_##_idx, "IPM_"#_idx, \
&vipm_nrf_##_idx##_driver_api)
#define VIPM_DEVICE(_idx, _) \
IF_ENABLED(CONFIG_IPM_MSG_CH_##_idx##_ENABLE, (VIPM_DEVICE_1(_idx);))
IF_ENABLED(CONFIG_IPM_MSG_CH_##_idx##_ENABLE, (VIPM_DEVICE_1(_idx)))
UTIL_LISTIFY(NRFX_IPC_ID_MAX_VALUE, VIPM_DEVICE, _);
LISTIFY(NRFX_IPC_ID_MAX_VALUE, VIPM_DEVICE, (;), _);
#endif

View file

@ -145,10 +145,10 @@ extern DioIrqHandler *DioIrq[];
DT_INST_PROP_LEN(inst, dio_gpios)
#define SX127X_DIO_GPIO_ELEM(idx, inst) \
GPIO_DT_SPEC_INST_GET_BY_IDX(inst, dio_gpios, idx),
GPIO_DT_SPEC_INST_GET_BY_IDX(inst, dio_gpios, idx)
#define SX127X_DIO_GPIO_INIT(n) \
UTIL_LISTIFY(SX127X_DIO_GPIO_LEN(n), SX127X_DIO_GPIO_ELEM, n)
LISTIFY(SX127X_DIO_GPIO_LEN(n), SX127X_DIO_GPIO_ELEM, (,), n)
static const struct gpio_dt_spec sx127x_dios[] = { SX127X_DIO_GPIO_INIT(0) };

View file

@ -539,9 +539,9 @@ ssize_t bt_gatt_attr_read_service(struct bt_conn *conn,
BT_GATT_SERVICE(attr_##_name)
#define _BT_GATT_ATTRS_ARRAY_DEFINE(n, _instances, _attrs_def) \
static struct bt_gatt_attr attrs_##n[] = _attrs_def(_instances[n]);
static struct bt_gatt_attr attrs_##n[] = _attrs_def(_instances[n])
#define _BT_GATT_SERVICE_ARRAY_ITEM(_n, _) BT_GATT_SERVICE(attrs_##_n),
#define _BT_GATT_SERVICE_ARRAY_ITEM(_n, _) BT_GATT_SERVICE(attrs_##_n)
/** @def BT_GATT_SERVICE_INSTANCE_DEFINE
* @brief Statically define service structure array.
@ -562,11 +562,10 @@ ssize_t bt_gatt_attr_read_service(struct bt_conn *conn,
_name, _instances, _instance_num, _attrs_def) \
BUILD_ASSERT(ARRAY_SIZE(_instances) == _instance_num, \
"The number of array elements does not match its size"); \
UTIL_EVAL(UTIL_REPEAT( \
_instance_num, _BT_GATT_ATTRS_ARRAY_DEFINE, _instances, \
_attrs_def)) \
LISTIFY(_instance_num, _BT_GATT_ATTRS_ARRAY_DEFINE, (;), \
_instances, _attrs_def); \
static struct bt_gatt_service _name[] = { \
UTIL_LISTIFY(_instance_num, _BT_GATT_SERVICE_ARRAY_ITEM) \
LISTIFY(_instance_num, _BT_GATT_SERVICE_ARRAY_ITEM, (,)) \
}
/** @def BT_GATT_SERVICE

View file

@ -15,14 +15,14 @@
#include <bluetooth/mesh/msg.h>
/* Internal macros used to initialize array members */
#define BT_MESH_KEY_UNUSED_ELT_(IDX, _) BT_MESH_KEY_UNUSED,
#define BT_MESH_ADDR_UNASSIGNED_ELT_(IDX, _) BT_MESH_ADDR_UNASSIGNED,
#define BT_MESH_KEY_UNUSED_ELT_(IDX, _) BT_MESH_KEY_UNUSED
#define BT_MESH_ADDR_UNASSIGNED_ELT_(IDX, _) BT_MESH_ADDR_UNASSIGNED
#define BT_MESH_MODEL_KEYS_UNUSED \
{ UTIL_LISTIFY(CONFIG_BT_MESH_MODEL_KEY_COUNT, \
BT_MESH_KEY_UNUSED_ELT_) }
#define BT_MESH_MODEL_GROUPS_UNASSIGNED \
{ UTIL_LISTIFY(CONFIG_BT_MESH_MODEL_GROUP_COUNT, \
BT_MESH_ADDR_UNASSIGNED_ELT_) }
{ LISTIFY(CONFIG_BT_MESH_MODEL_KEY_COUNT, \
BT_MESH_KEY_UNUSED_ELT_, (,)) }
#define BT_MESH_MODEL_GROUPS_UNASSIGNED \
{ LISTIFY(CONFIG_BT_MESH_MODEL_GROUP_COUNT, \
BT_MESH_ADDR_UNASSIGNED_ELT_, (,)) }
/**
* @brief Access layer

View file

@ -142,7 +142,7 @@ struct pinctrl_dev_config {
COND_CODE_1(Z_PINCTRL_SKIP_STATE(state_idx, node_id), (), \
(static const pinctrl_soc_pin_t \
Z_PINCTRL_STATE_PINS_NAME(state_idx, node_id)[] = \
Z_PINCTRL_STATE_PINS_INIT(node_id, pinctrl_ ## state_idx);))
Z_PINCTRL_STATE_PINS_INIT(node_id, pinctrl_ ## state_idx)))
/**
* @brief Helper macro to initialize a pin control state.
@ -157,7 +157,7 @@ struct pinctrl_dev_config {
.pins = Z_PINCTRL_STATE_PINS_NAME(state_idx, node_id), \
.pin_cnt = ARRAY_SIZE(Z_PINCTRL_STATE_PINS_NAME(state_idx, \
node_id)) \
},))
}))
/**
* @brief Define all the states for the given node identifier.
@ -167,8 +167,8 @@ struct pinctrl_dev_config {
#define Z_PINCTRL_STATES_DEFINE(node_id) \
static const struct pinctrl_state \
Z_PINCTRL_STATES_NAME(node_id)[] = { \
UTIL_LISTIFY(DT_NUM_PINCTRL_STATES(node_id), \
Z_PINCTRL_STATE_INIT, node_id) \
LISTIFY(DT_NUM_PINCTRL_STATES(node_id), \
Z_PINCTRL_STATE_INIT, (,), node_id) \
};
#ifdef CONFIG_PINCTRL_STORE_REG
@ -235,8 +235,8 @@ struct pinctrl_dev_config {
* @param node_id Node identifier.
*/
#define PINCTRL_DT_DEFINE(node_id) \
UTIL_LISTIFY(DT_NUM_PINCTRL_STATES(node_id), \
Z_PINCTRL_STATE_PINS_DEFINE, node_id) \
LISTIFY(DT_NUM_PINCTRL_STATES(node_id), \
Z_PINCTRL_STATE_PINS_DEFINE, (;), node_id); \
Z_PINCTRL_STATES_DEFINE(node_id) \
Z_PINCTRL_DEV_CONFIG_CONST Z_PINCTRL_DEV_CONFIG_STATIC \
struct pinctrl_dev_config Z_PINCTRL_DEV_CONFIG_NAME(node_id) = \

View file

@ -166,7 +166,7 @@ struct pm_state_info {
* @param node_id A node identifier with compatible zephyr,power-state
*/
#define Z_PM_STATE_INFO_FROM_DT_CPU(i, node_id) \
PM_STATE_INFO_DT_INIT(DT_PHANDLE_BY_IDX(node_id, cpu_power_states, i)),
PM_STATE_INFO_DT_INIT(DT_PHANDLE_BY_IDX(node_id, cpu_power_states, i))
/**
* @brief Helper macro to initialize an entry of a struct pm_state array when
@ -176,7 +176,7 @@ struct pm_state_info {
* @param node_id A node identifier with compatible zephyr,power-state
*/
#define Z_PM_STATE_FROM_DT_CPU(i, node_id) \
PM_STATE_DT_INIT(DT_PHANDLE_BY_IDX(node_id, cpu_power_states, i)),
PM_STATE_DT_INIT(DT_PHANDLE_BY_IDX(node_id, cpu_power_states, i))
/** @endcond */
@ -258,8 +258,8 @@ struct pm_state_info {
*/
#define PM_STATE_INFO_LIST_FROM_DT_CPU(node_id) \
{ \
UTIL_LISTIFY(DT_NUM_CPU_POWER_STATES(node_id), \
Z_PM_STATE_INFO_FROM_DT_CPU, node_id) \
LISTIFY(DT_NUM_CPU_POWER_STATES(node_id), \
Z_PM_STATE_INFO_FROM_DT_CPU, (,), node_id) \
}
/**
@ -306,8 +306,8 @@ struct pm_state_info {
*/
#define PM_STATE_LIST_FROM_DT_CPU(node_id) \
{ \
UTIL_LISTIFY(DT_NUM_CPU_POWER_STATES(node_id), \
Z_PM_STATE_FROM_DT_CPU, node_id) \
LISTIFY(DT_NUM_CPU_POWER_STATES(node_id), \
Z_PM_STATE_FROM_DT_CPU, (,), node_id) \
}

View file

@ -363,7 +363,7 @@ extern "C" {
#define LISTIFY(LEN, F, sep, ...) UTIL_CAT(Z_UTIL_LISTIFY_, LEN)(F, sep, __VA_ARGS__)
/**
* @brief Generates a sequence of code.
* @brief Generates a sequence of code. Deprecated, use @ref LISTIFY.
*
* @deprecated Use @ref LISTIFY instead.
*
@ -387,7 +387,7 @@ extern "C" {
* @note Calling UTIL_LISTIFY with undefined arguments has undefined
* behavior.
*/
#define UTIL_LISTIFY(LEN, F, ...) LISTIFY(LEN, F, (), __VA_ARGS__)
#define UTIL_LISTIFY(LEN, F, ...) LISTIFY(LEN, F, (), __VA_ARGS__) __DEPRECATED_MACRO
/**
* @brief Call a macro @p F on each provided argument with a given

View file

@ -83,12 +83,12 @@
ATMEL_SAM_DT_NUM_PINS(DT_DRV_INST(inst))
/* internal macro to structure things for use with UTIL_LISTIFY */
#define ATMEL_SAM_DT_PIN_ELEM(idx, node_id) ATMEL_SAM_DT_PIN(node_id, idx),
#define ATMEL_SAM_DT_PIN_ELEM(idx, node_id) ATMEL_SAM_DT_PIN(node_id, idx)
/* Construct an array intializer for soc_gpio_pin for a device instance */
#define ATMEL_SAM_DT_PINS(node_id) \
{ UTIL_LISTIFY(ATMEL_SAM_DT_NUM_PINS(node_id), \
ATMEL_SAM_DT_PIN_ELEM, node_id) \
{ LISTIFY(ATMEL_SAM_DT_NUM_PINS(node_id), \
ATMEL_SAM_DT_PIN_ELEM, (,), node_id) \
}
#define ATMEL_SAM_DT_INST_PINS(inst) \

View file

@ -90,12 +90,12 @@
ATMEL_SAM0_DT_NUM_PINS(DT_DRV_INST(inst))
/* internal macro to structure things for use with UTIL_LISTIFY */
#define ATMEL_SAM0_DT_PIN_ELEM(idx, node_id) ATMEL_SAM0_DT_PORT(node_id, idx),
#define ATMEL_SAM0_DT_PIN_ELEM(idx, node_id) ATMEL_SAM0_DT_PORT(node_id, idx)
/* Construct an array intializer for soc_port_pin for a device instance */
#define ATMEL_SAM0_DT_PINS(node_id) \
{ UTIL_LISTIFY(ATMEL_SAM0_DT_NUM_PINS(node_id), \
ATMEL_SAM0_DT_PIN_ELEM, node_id) \
{ LISTIFY(ATMEL_SAM0_DT_NUM_PINS(node_id), \
ATMEL_SAM0_DT_PIN_ELEM, (,), node_id) \
}
#define ATMEL_SAM0_DT_INST_PINS(inst) \

View file

@ -150,12 +150,12 @@
#define CY_PSOC6_DT_INST_NUM_PINS(inst) DT_INST_NUM_PINCTRLS_BY_IDX(inst, 0)
/* internal macro to structure things for use with UTIL_LISTIFY */
#define CY_PSOC6_PIN_ELEM(idx, inst) CY_PSOC6_DT_INST_PIN(inst, idx),
#define CY_PSOC6_PIN_ELEM(idx, inst) CY_PSOC6_DT_INST_PIN(inst, idx)
/* Construct an array intializer for soc_gpio_pin for a device instance */
#define CY_PSOC6_DT_INST_PINS(inst) \
{ UTIL_LISTIFY(CY_PSOC6_DT_INST_NUM_PINS(inst), \
CY_PSOC6_PIN_ELEM, inst) \
{ LISTIFY(CY_PSOC6_DT_INST_NUM_PINS(inst), \
CY_PSOC6_PIN_ELEM, (,), inst) \
}
#endif /* _CYPRESS_PSOC6_SOC_DT_H_ */

View file

@ -78,7 +78,7 @@
.bus = DT_CLOCKS_CELL_BY_IDX(DT_DRV_INST(inst), i, bus), \
.ctrl = DT_CLOCKS_CELL_BY_IDX(DT_DRV_INST(inst), i, ctl), \
.bit = DT_CLOCKS_CELL_BY_IDX(DT_DRV_INST(inst), i, bit), \
},
}
/**
* @brief Length of 'clocks' property which type is 'phandle-array'
@ -119,10 +119,10 @@
* @param inst instance number for compatible defined in DT_DRV_COMPAT.
* @return an array of npcx_clk_cfg items.
*/
#define NPCX_DT_CLK_CFG_ITEMS_LIST(inst) { \
UTIL_LISTIFY(NPCX_DT_CLK_CFG_ITEMS_LEN(inst), \
NPCX_DT_CLK_CFG_ITEMS_FUNC, \
inst) \
#define NPCX_DT_CLK_CFG_ITEMS_LIST(inst) { \
LISTIFY(NPCX_DT_CLK_CFG_ITEMS_LEN(inst), \
NPCX_DT_CLK_CFG_ITEMS_FUNC, (,), \
inst) \
}
/**
@ -137,7 +137,7 @@
.group = DT_PHA(DT_INST_PINCTRL_0(inst, i), alts, group), \
.bit = DT_PHA(DT_INST_PINCTRL_0(inst, i), alts, bit), \
.inverted = DT_PHA(DT_INST_PINCTRL_0(inst, i), alts, inv), \
},
}
/**
* @brief Macro function to construct npcx_alt item in UTIL_LISTIFY extension.
@ -166,10 +166,10 @@
* @param inst instance number for compatible defined in DT_DRV_COMPAT.
* @return an array of npcx_alt items.
*/
#define NPCX_DT_ALT_ITEMS_LIST(inst) { \
UTIL_LISTIFY(DT_INST_NUM_PINCTRLS_BY_IDX(inst, 0), \
NPCX_DT_ALT_ITEMS_FUNC, \
inst) \
#define NPCX_DT_ALT_ITEMS_LIST(inst) { \
LISTIFY(DT_INST_NUM_PINCTRLS_BY_IDX(inst, 0), \
NPCX_DT_ALT_ITEMS_FUNC, (,), \
inst) \
}
/**
@ -225,7 +225,7 @@
alts, bit), \
.inverted = DT_PHA(NPCX_DT_IO_PHANDLE_FROM_PINCTRL(io_comp, inst, i),\
alts, inv), \
},
}
/**
* @brief Length of npcx_alt structures in 'pinctrl-0' property of specific
@ -274,10 +274,10 @@
* @param inst instance number for compatible defined in io_comp.
* @return an array of npcx_alt items.
*/
#define NPCX_DT_IO_ALT_ITEMS_LIST(io_comp, inst) { \
UTIL_LISTIFY(NPCX_DT_IO_ALT_ITEMS_LEN(io_comp, inst), \
NPCX_DT_IO_ALT_ITEMS_FUNC, \
inst, io_comp) \
#define NPCX_DT_IO_ALT_ITEMS_LIST(io_comp, inst) { \
LISTIFY(NPCX_DT_IO_ALT_ITEMS_LEN(io_comp, inst), \
NPCX_DT_IO_ALT_ITEMS_FUNC, (,), \
inst, io_comp) \
}
/**
@ -331,7 +331,7 @@
.group = DT_PHA(NPCX_DT_PHANDLE_FROM_WUI_MAPS(inst, i), miwus, \
group), \
.bit = DT_PHA(NPCX_DT_PHANDLE_FROM_WUI_MAPS(inst, i), miwus, bit), \
},
}
/**
* @brief Length of npcx_wui structures in 'wui-maps' property
@ -375,10 +375,10 @@
* @param inst instance number for compatible defined in DT_DRV_COMPAT.
* @return an array of npcx_wui items.
*/
#define NPCX_DT_WUI_ITEMS_LIST(inst) { \
UTIL_LISTIFY(NPCX_DT_WUI_ITEMS_LEN(inst), \
NPCX_DT_WUI_ITEMS_FUNC, \
inst) \
#define NPCX_DT_WUI_ITEMS_LIST(inst) { \
LISTIFY(NPCX_DT_WUI_ITEMS_LEN(inst), \
NPCX_DT_WUI_ITEMS_FUNC, (,), \
inst) \
}
/**
@ -532,7 +532,7 @@
lvols, ctrl), \
.bit = DT_PHA(NPCX_DT_PHANDLE_FROM_LVOL_IO_PADS(i), \
lvols, bit), \
},
}
/**
* @brief Macro function to construct a list of npcx_lvol items by UTIL_LISTIFY
@ -552,9 +552,9 @@
*
* @return an array of npcx_lvol items which configure low-voltage support
*/
#define NPCX_DT_IO_LVOL_ITEMS_DEF_LIST { \
UTIL_LISTIFY(NPCX_DT_LVOL_ITEMS_LEN, \
NPCX_DT_LVOL_ITEMS_BY_IDX, _) \
#define NPCX_DT_IO_LVOL_ITEMS_DEF_LIST { \
LISTIFY(NPCX_DT_LVOL_ITEMS_LEN, \
NPCX_DT_LVOL_ITEMS_BY_IDX, (,), _) \
}
/**
@ -645,7 +645,7 @@
.offset = DT_PROP(NPCX_DT_PHANDLE_FROM_PSL_IN_NODE(i), offset),\
.pinctrl = NPCX_DT_PSL_IN_ALT_CONF_BY_IDX(i) \
.polarity = NPCX_DT_PSL_IN_POL_CONF_BY_IDX(i) \
},
}
/**
* @brief Macro function to construct a list of npcx_psl_in items by
@ -666,9 +666,9 @@
*
* @return an array of npcx_psl_in items which configures PSL input pads
*/
#define NPCX_DT_PSL_IN_ITEMS_LIST { \
UTIL_LISTIFY(NPCX_DT_PSL_IN_ITEMS_LEN, \
NPCX_DT_PSL_IN_ITEMS_BY_IDX, _) \
#define NPCX_DT_PSL_IN_ITEMS_LIST { \
LISTIFY(NPCX_DT_PSL_IN_ITEMS_LEN, \
NPCX_DT_PSL_IN_ITEMS_BY_IDX, (,), _) \
}
/**

View file

@ -210,7 +210,7 @@
{ \
ST_STM32_DT_INST_PINMUX(inst, x, i), \
ST_STM32_DT_INST_PINCFG(inst, x, i) \
},
}
/**
* @brief Internal: Contruct a soc_gpio_pinctrl element index i of
@ -225,7 +225,7 @@
{ \
ST_STM32_DT_PINMUX(name, x, i), \
ST_STM32_DT_PINCFG(name, x, i) \
},
}
/**
* @brief Internal: Return the number of elements of a pinctrl-x property
@ -267,10 +267,10 @@
*/
#define ST_STM32_DT_INST_PINCTRL(inst, x) \
{ COND_CODE_1(DT_INST_PINCTRL_HAS_IDX(inst, x), \
(UTIL_LISTIFY(ST_STM32_DT_INST_NUM_PINS(inst, x), \
ST_STM32_DT_INST_PIN_ELEM, \
x, \
inst)), \
(LISTIFY(ST_STM32_DT_INST_NUM_PINS(inst, x), \
ST_STM32_DT_INST_PIN_ELEM, (,), \
x, \
inst)), \
()) \
}
@ -288,10 +288,10 @@
*/
#define ST_STM32_DT_PINCTRL(name, x) \
{ COND_CODE_1(DT_PINCTRL_HAS_IDX(DT_NODELABEL(name), x), \
(UTIL_LISTIFY(ST_STM32_DT_NUM_PINS(name, x), \
ST_STM32_DT_PIN_ELEM, \
x, \
name)), \
(LISTIFY(ST_STM32_DT_NUM_PINS(name, x), \
ST_STM32_DT_PIN_ELEM, (,), \
x, \
name)), \
()) \
}

View file

@ -26,7 +26,7 @@
.pinctrls = IT8XXX2_DEV_PINMUX(idx, inst), \
.pin = IT8XXX2_DEV_PIN(idx, inst), \
.alt_fun = IT8XXX2_DEV_ALT_FUNC(idx, inst), \
},
}
/**
* @brief Macro function to construct a list of it8xxx2 alt items with
@ -35,10 +35,10 @@
* @param inst instance number for compatible defined in DT_DRV_COMPAT.
* @return an array of it8xxx2 alt items.
*/
#define IT8XXX2_DT_ALT_ITEMS_LIST(inst) { \
UTIL_LISTIFY(DT_INST_NUM_PINCTRLS_BY_IDX(inst, 0), \
IT8XXX2_DT_ALT_ITEMS_FUNC, \
inst) \
#define IT8XXX2_DT_ALT_ITEMS_LIST(inst) { \
LISTIFY(DT_INST_NUM_PINCTRLS_BY_IDX(inst, 0), \
IT8XXX2_DT_ALT_ITEMS_FUNC, (,), \
inst) \
}
#endif /* _ITE_IT8XXX2_SOC_DT_H_ */

View file

@ -86,7 +86,7 @@ static ssize_t write_mute(struct bt_conn *conn, const struct bt_gatt_attr *attr,
#define DUMMY_INCLUDE(i, _) BT_GATT_INCLUDE_SERVICE(NULL),
#define AICS_INCLUDES(cnt) UTIL_LISTIFY(cnt, DUMMY_INCLUDE)
#define AICS_INCLUDES(cnt) LISTIFY(cnt, DUMMY_INCLUDE, ())
#define BT_MICS_SERVICE_DEFINITION \
BT_GATT_PRIMARY_SERVICE(BT_UUID_MICS), \

View file

@ -242,8 +242,8 @@ static ssize_t read_flags(struct bt_conn *conn, const struct bt_gatt_attr *attr,
}
#define DUMMY_INCLUDE(i, _) BT_GATT_INCLUDE_SERVICE(NULL),
#define VOCS_INCLUDES(cnt) UTIL_LISTIFY(cnt, DUMMY_INCLUDE)
#define AICS_INCLUDES(cnt) UTIL_LISTIFY(cnt, DUMMY_INCLUDE)
#define VOCS_INCLUDES(cnt) LISTIFY(cnt, DUMMY_INCLUDE, ())
#define AICS_INCLUDES(cnt) LISTIFY(cnt, DUMMY_INCLUDE, ())
#define BT_VCS_SERVICE_DEFINITION \
BT_GATT_PRIMARY_SERVICE(BT_UUID_VCS), \

View file

@ -254,7 +254,7 @@ struct lll_event {
uint8_t is_aborted:1;
};
#define DEFINE_NODE_RX_USER_TYPE(i, _) NODE_RX_TYPE_##i,
#define DEFINE_NODE_RX_USER_TYPE(i, _) NODE_RX_TYPE_##i
enum node_rx_type {
/* Unused */
@ -307,7 +307,7 @@ enum node_rx_type {
#if defined(CONFIG_BT_CTLR_USER_EXT)
/* No entries shall be added after the NODE_RX_TYPE_USER_START/END */
NODE_RX_TYPE_USER_START,
UTIL_LISTIFY(CONFIG_BT_CTLR_USER_EVT_RANGE, DEFINE_NODE_RX_USER_TYPE, _)
LISTIFY(CONFIG_BT_CTLR_USER_EVT_RANGE, DEFINE_NODE_RX_USER_TYPE, (,), _),
NODE_RX_TYPE_USER_END,
#endif /* CONFIG_BT_CTLR_USER_EXT */
};

View file

@ -55,13 +55,13 @@ static struct modbus_serial_config modbus_serial_cfg[] = {
.iface_name = "RAW_"#x, \
.raw_tx_cb = NULL, \
.mode = MODBUS_MODE_RAW, \
},
}
static struct modbus_context mb_ctx_tbl[] = {
DT_INST_FOREACH_STATUS_OKAY(MODBUS_DT_GET_DEV)
#ifdef CONFIG_MODBUS_RAW_ADU
UTIL_LISTIFY(CONFIG_MODBUS_NUMOF_RAW_ADU, DEFINE_MODBUS_RAW_ADU, _)
LISTIFY(CONFIG_MODBUS_NUMOF_RAW_ADU, DEFINE_MODBUS_RAW_ADU, (,), _)
#endif
};

View file

@ -111,7 +111,7 @@ int net_rx_priority2tc(enum net_priority prio)
#define BASE_PRIO_TX (CONFIG_NET_TC_TX_COUNT - 1)
#endif
#define PRIO_TX(i, _) (BASE_PRIO_TX - i),
#define PRIO_TX(i, _) (BASE_PRIO_TX - i)
#if IS_ENABLED(CONFIG_NET_TC_THREAD_COOPERATIVE)
#define BASE_PRIO_RX (CONFIG_NET_TC_NUM_PRIORITIES - 1)
@ -119,7 +119,7 @@ int net_rx_priority2tc(enum net_priority prio)
#define BASE_PRIO_RX (CONFIG_NET_TC_RX_COUNT - 1)
#endif
#define PRIO_RX(i, _) (BASE_PRIO_RX - i),
#define PRIO_RX(i, _) (BASE_PRIO_RX - i)
#if NET_TC_TX_COUNT > 0
/* Convert traffic class to thread priority */
@ -158,7 +158,7 @@ static uint8_t tx_tc2thread(uint8_t tc)
* priority.
*/
static const uint8_t thread_priorities[] = {
UTIL_LISTIFY(NET_TC_TX_COUNT, PRIO_TX)
LISTIFY(NET_TC_TX_COUNT, PRIO_TX, (,))
};
BUILD_ASSERT(NET_TC_TX_COUNT <= CONFIG_NUM_COOP_PRIORITIES,
@ -175,7 +175,7 @@ static uint8_t tx_tc2thread(uint8_t tc)
static uint8_t rx_tc2thread(uint8_t tc)
{
static const uint8_t thread_priorities[] = {
UTIL_LISTIFY(NET_TC_RX_COUNT, PRIO_RX)
LISTIFY(NET_TC_RX_COUNT, PRIO_RX, (,))
};
BUILD_ASSERT(NET_TC_RX_COUNT <= CONFIG_NUM_COOP_PRIORITIES,

View file

@ -560,13 +560,13 @@ static const struct virtual_interface_api ipip_iface_api = {
#define NET_IPIP_DATA(x, _) \
static struct ipip_context ipip_context_data_##x = { \
};
}
#define NET_IPIP_INTERFACE_INIT(x, _) \
NET_VIRTUAL_INTERFACE_INIT(ipip##x, "IP_TUNNEL" #x, ipip_init, \
NULL, &ipip_context_data_##x, NULL, \
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \
&ipip_iface_api, IPIPV4_MTU);
&ipip_iface_api, IPIPV4_MTU)
UTIL_LISTIFY(CONFIG_NET_L2_IPIP_TUNNEL_COUNT, NET_IPIP_DATA, _)
UTIL_LISTIFY(CONFIG_NET_L2_IPIP_TUNNEL_COUNT, NET_IPIP_INTERFACE_INIT, _)
LISTIFY(CONFIG_NET_L2_IPIP_TUNNEL_COUNT, NET_IPIP_DATA, (;), _);
LISTIFY(CONFIG_NET_L2_IPIP_TUNNEL_COUNT, NET_IPIP_INTERFACE_INIT, (;), _);

View file

@ -691,7 +691,7 @@ static const struct net_capture_interface_api capture_interface_api = {
};
#define DEFINE_NET_CAPTURE_DEV_DATA(x, _) \
static struct net_capture capture_dev_data_##x;
static struct net_capture capture_dev_data_##x
#define DEFINE_NET_CAPTURE_DEVICE(x, _) \
DEVICE_DEFINE(net_capture_##x, \
@ -702,7 +702,7 @@ static const struct net_capture_interface_api capture_interface_api = {
NULL, \
POST_KERNEL, \
CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \
&capture_interface_api);
&capture_interface_api)
UTIL_LISTIFY(CONFIG_NET_CAPTURE_DEVICE_COUNT, DEFINE_NET_CAPTURE_DEV_DATA, _)
UTIL_LISTIFY(CONFIG_NET_CAPTURE_DEVICE_COUNT, DEFINE_NET_CAPTURE_DEVICE, _)
LISTIFY(CONFIG_NET_CAPTURE_DEVICE_COUNT, DEFINE_NET_CAPTURE_DEV_DATA, (;), _);
LISTIFY(CONFIG_NET_CAPTURE_DEVICE_COUNT, DEFINE_NET_CAPTURE_DEVICE, (;), _);

View file

@ -30,9 +30,9 @@ static sys_slist_t pm_notifiers = SYS_SLIST_STATIC_INIT(&pm_notifiers);
* ACTIVE_STATE is 0
*/
#define CPU_PM_STATE_INIT(_, __) \
{ .state = PM_STATE_ACTIVE },
{ .state = PM_STATE_ACTIVE }
static struct pm_state_info z_cpus_pm_state[] = {
UTIL_LISTIFY(CONFIG_MP_NUM_CPUS, CPU_PM_STATE_INIT)
LISTIFY(CONFIG_MP_NUM_CPUS, CPU_PM_STATE_INIT, (,))
};
/* bitmask to check if a power state was forced. */

View file

@ -23,7 +23,7 @@ BUILD_ASSERT(DT_NODE_EXISTS(DT_PATH(cpus)),
min_residency_us, 0U) >= \
DT_PROP_BY_PHANDLE_IDX_OR(node_id, cpu_power_states, i, \
exit_latency_us, 0U), \
"Found CPU power state with min_residency < exit_latency");
"Found CPU power state with min_residency < exit_latency")
/**
* @brief Check CPU power states consistency
@ -33,8 +33,8 @@ BUILD_ASSERT(DT_NODE_EXISTS(DT_PATH(cpus)),
* @param node_id A CPU node identifier.
*/
#define CHECK_POWER_STATES_CONSISTENCY(node_id) \
UTIL_LISTIFY(DT_NUM_CPU_POWER_STATES(node_id), \
CHECK_POWER_STATE_CONSISTENCY, node_id) \
LISTIFY(DT_NUM_CPU_POWER_STATES(node_id), \
CHECK_POWER_STATE_CONSISTENCY, (;), node_id); \
/* Check that all power states are consistent */
DT_FOREACH_CHILD(DT_PATH(cpus), CHECK_POWER_STATES_CONSISTENCY)

View file

@ -41,10 +41,10 @@ static k_timeout_t init_backoff[CONFIG_ZTRESS_MAX_THREADS];
K_THREAD_STACK_ARRAY_DEFINE(stacks, CONFIG_ZTRESS_MAX_THREADS, CONFIG_ZTRESS_STACK_SIZE);
static k_tid_t idle_tid;
#define THREAD_NAME(i, _) STRINGIFY(ztress_##i),
#define THREAD_NAME(i, _) STRINGIFY(ztress_##i)
static const char * const thread_names[] = {
UTIL_LISTIFY(CONFIG_ZTRESS_MAX_THREADS, THREAD_NAME, _)
LISTIFY(CONFIG_ZTRESS_MAX_THREADS, THREAD_NAME, (,))
};
struct ztress_runtime {

View file

@ -968,6 +968,6 @@ void usb_audio_register(const struct device *dev,
DEFINE_AUDIO_DESCRIPTOR_BIDIR(dev, i, dev##_ID(i)); \
DEFINE_AUDIO_DEVICE(dev, i);)
UTIL_LISTIFY(HEADPHONES_DEVICE_COUNT, HEADPHONES_DEVICE, HP)
UTIL_LISTIFY(MICROPHONE_DEVICE_COUNT, MICROPHONE_DEVICE, MIC)
UTIL_LISTIFY(HEADSET_DEVICE_COUNT, HEADSET_DEVICE, HS)
LISTIFY(HEADPHONES_DEVICE_COUNT, HEADPHONES_DEVICE, (), HP)
LISTIFY(MICROPHONE_DEVICE_COUNT, MICROPHONE_DEVICE, (), MIC)
LISTIFY(HEADSET_DEVICE_COUNT, HEADSET_DEVICE, (), HS)

View file

@ -117,7 +117,7 @@ struct usb_hid_config {
INITIALIZER_IF_EP(AUTO_EP_OUT, \
USB_DC_EP_INTERRUPT, \
CONFIG_HID_INTERRUPT_EP_MPS), \
};
}
#else
#define DEFINE_HID_DESCR(x, _) \
USBD_CLASS_DESCR_DEFINE(primary, x) \
@ -129,7 +129,7 @@ struct usb_hid_config {
INITIALIZER_IF_EP(AUTO_EP_IN, \
USB_DC_EP_INTERRUPT, \
CONFIG_HID_INTERRUPT_EP_MPS), \
};
}
#endif
struct hid_device_info {
@ -599,12 +599,12 @@ static void hid_int_out(uint8_t ep, enum usb_dc_ep_cb_status_code ep_status)
static struct usb_ep_cfg_data hid_ep_data_##x[] = { \
INITIALIZER_EP_DATA(hid_int_in, AUTO_EP_IN), \
INITIALIZER_EP_DATA(hid_int_out, AUTO_EP_OUT), \
};
}
#else
#define DEFINE_HID_EP(x, _) \
static struct usb_ep_cfg_data hid_ep_data_##x[] = { \
INITIALIZER_EP_DATA(hid_int_in, AUTO_EP_IN), \
};
}
#endif
static void hid_interface_config(struct usb_desc_header *head,
@ -634,7 +634,7 @@ static void hid_interface_config(struct usb_desc_header *head,
}, \
.num_endpoints = ARRAY_SIZE(hid_ep_data_##x), \
.endpoint = hid_ep_data_##x, \
};
}
int usb_hid_set_proto_code(const struct device *dev, uint8_t proto_code)
{
@ -722,7 +722,7 @@ static int usb_hid_device_init(const struct device *dev)
}
#define DEFINE_HID_DEV_DATA(x, _) \
struct hid_device_info usb_hid_dev_data_##x;
struct hid_device_info usb_hid_dev_data_##x
#define DEFINE_HID_DEVICE(x, _) \
DEVICE_DEFINE(usb_hid_device_##x, \
@ -732,10 +732,10 @@ static int usb_hid_device_init(const struct device *dev)
&usb_hid_dev_data_##x, \
&hid_config_##x, POST_KERNEL, \
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \
&hid_api);
&hid_api)
UTIL_LISTIFY(CONFIG_USB_HID_DEVICE_COUNT, DEFINE_HID_DESCR, _)
UTIL_LISTIFY(CONFIG_USB_HID_DEVICE_COUNT, DEFINE_HID_EP, _)
UTIL_LISTIFY(CONFIG_USB_HID_DEVICE_COUNT, DEFINE_HID_CFG_DATA, _)
UTIL_LISTIFY(CONFIG_USB_HID_DEVICE_COUNT, DEFINE_HID_DEV_DATA, _)
UTIL_LISTIFY(CONFIG_USB_HID_DEVICE_COUNT, DEFINE_HID_DEVICE, _)
LISTIFY(CONFIG_USB_HID_DEVICE_COUNT, DEFINE_HID_DESCR, (;), _);
LISTIFY(CONFIG_USB_HID_DEVICE_COUNT, DEFINE_HID_EP, (;), _);
LISTIFY(CONFIG_USB_HID_DEVICE_COUNT, DEFINE_HID_CFG_DATA, (;), _);
LISTIFY(CONFIG_USB_HID_DEVICE_COUNT, DEFINE_HID_DEV_DATA, (;), _);
LISTIFY(CONFIG_USB_HID_DEVICE_COUNT, DEFINE_HID_DEVICE, (;), _);

View file

@ -19,9 +19,9 @@ static uint16_t chrc_handle;
static uint16_t long_chrc_handle;
static struct bt_uuid *test_svc_uuid = TEST_SERVICE_UUID;
#define ARRAY_ITEM(i, _) i,
static uint8_t chrc_data[] = { UTIL_LISTIFY(CHRC_SIZE, ARRAY_ITEM) }; /* 1, 2, 3 ... */
static uint8_t long_chrc_data[] = { UTIL_LISTIFY(LONG_CHRC_SIZE, ARRAY_ITEM) }; /* 1, 2, 3 ... */
#define ARRAY_ITEM(i, _) i
static uint8_t chrc_data[] = { LISTIFY(CHRC_SIZE, ARRAY_ITEM, (,)) }; /* 1, 2, 3 ... */
static uint8_t long_chrc_data[] = { LISTIFY(LONG_CHRC_SIZE, ARRAY_ITEM, (,)) }; /* 1, 2, 3 ... */
static void connected(struct bt_conn *conn, uint8_t err)
{

View file

@ -29,12 +29,12 @@ void *exp_user_data = (void *)199;
struct counter_alarm_cfg alarm_cfg;
struct counter_alarm_cfg alarm_cfg2;
#define INST_DT_COMPAT_LABEL(n, compat) DT_LABEL(DT_INST(n, compat)),
#define INST_DT_COMPAT_LABEL(n, compat) DT_LABEL(DT_INST(n, compat))
/* Generate a list of LABELs for all instances of the "compat" */
#define LABELS_FOR_DT_COMPAT(compat) \
COND_CODE_1(DT_HAS_COMPAT_STATUS_OKAY(compat), \
(UTIL_LISTIFY(DT_NUM_INST_STATUS_OKAY(compat), \
INST_DT_COMPAT_LABEL, compat)), ())
(LISTIFY(DT_NUM_INST_STATUS_OKAY(compat), \
INST_DT_COMPAT_LABEL, (,), compat),), ())
static const char * const devices[] = {
#ifdef CONFIG_COUNTER_TIMER0

View file

@ -560,14 +560,14 @@ struct gpios_struct {
/* Helper macro that UTIL_LISTIFY can use and produces an element with comma */
#define DT_PROP_ELEM_BY_PHANDLE(idx, node_id, ph_prop, prop) \
DT_PROP_BY_PHANDLE_IDX(node_id, ph_prop, idx, prop),
DT_PROP_BY_PHANDLE_IDX(node_id, ph_prop, idx, prop)
#define DT_PHANDLE_LISTIFY(node_id, ph_prop, prop) \
{ \
UTIL_LISTIFY(DT_PROP_LEN(node_id, ph_prop), \
DT_PROP_ELEM_BY_PHANDLE, \
node_id, \
ph_prop, \
label) \
LISTIFY(DT_PROP_LEN(node_id, ph_prop), \
DT_PROP_ELEM_BY_PHANDLE, (,), \
node_id, \
ph_prop, \
label) \
}
/* Helper macro that UTIL_LISTIFY can use and produces an element with comma */
@ -576,10 +576,10 @@ struct gpios_struct {
DT_PROP(DT_PHANDLE_BY_IDX(node_id, prop, idx), label), \
DT_PHA_BY_IDX(node_id, prop, idx, pin),\
DT_PHA_BY_IDX(node_id, prop, idx, flags),\
},
}
#define DT_GPIO_LISTIFY(node_id, prop) \
{ UTIL_LISTIFY(DT_PROP_LEN(node_id, prop), DT_GPIO_ELEM, \
node_id, prop) }
{ LISTIFY(DT_PROP_LEN(node_id, prop), DT_GPIO_ELEM, (,), \
node_id, prop) }
#undef DT_DRV_COMPAT
#define DT_DRV_COMPAT vnd_phandle_holder

View file

@ -97,8 +97,8 @@ struct backend_cb backend_ctrl_blk;
int _cnt = 0; \
test_helpers_log_setup(); \
while (!test_helpers_log_dropped_pending()) { \
LOG_ERR("test" UTIL_LISTIFY(nargs, TEST_FORMAT_SPEC) \
UTIL_LISTIFY(nargs, TEST_VALUE)); \
LOG_ERR("test" LISTIFY(nargs, TEST_FORMAT_SPEC, ()) \
LISTIFY(nargs, TEST_VALUE, ())); \
_cnt++; \
} \
_cnt--; \
@ -135,8 +135,8 @@ void test_log_capacity(void)
test_helpers_log_setup(); \
uint32_t cyc = test_helpers_cycle_get(); \
for (int i = 0; i < _msg_cnt; i++) { \
LOG_ERR("test" UTIL_LISTIFY(nargs, TEST_FORMAT_SPEC) \
UTIL_LISTIFY(nargs, TEST_VALUE)); \
LOG_ERR("test" LISTIFY(nargs, TEST_FORMAT_SPEC, ()) \
LISTIFY(nargs, TEST_VALUE, ())); \
} \
cyc = test_helpers_cycle_get() - cyc; \
inc_time += cyc; \
@ -175,8 +175,8 @@ void test_log_message_store_time_no_overwrite(void)
TEST_LOG_CAPACITY(nargs, _dummy, 0); \
uint32_t cyc = test_helpers_cycle_get(); \
for (int i = 0; i < _msg_cnt; i++) { \
LOG_ERR("test" UTIL_LISTIFY(nargs, TEST_FORMAT_SPEC) \
UTIL_LISTIFY(nargs, TEST_VALUE)); \
LOG_ERR("test" LISTIFY(nargs, TEST_FORMAT_SPEC, ()) \
LISTIFY(nargs, TEST_VALUE, ())); \
} \
cyc = test_helpers_cycle_get() - cyc; \
inc_time += cyc; \

View file

@ -78,7 +78,7 @@ struct usb_test_config {
.if0_in2_ep = INITIALIZER_IF_EP(AUTO_EP_IN, \
USB_DC_EP_BULK, \
TEST_BULK_EP_MPS), \
};
}
#define INITIALIZER_EP_DATA(cb, addr) \
{ \
@ -91,7 +91,7 @@ struct usb_test_config {
INITIALIZER_EP_DATA(NULL, AUTO_EP_OUT), \
INITIALIZER_EP_DATA(NULL, AUTO_EP_IN), \
INITIALIZER_EP_DATA(NULL, AUTO_EP_IN), \
};
}
#define DEFINE_TEST_CFG_DATA(x, _) \
USBD_DEFINE_CFG_DATA(test_config_##x) = { \
@ -106,7 +106,7 @@ struct usb_test_config {
}, \
.num_endpoints = ARRAY_SIZE(ep_cfg_##x), \
.endpoint = ep_cfg_##x, \
};
}
#define NUM_INSTANCES 2
@ -120,9 +120,9 @@ static void interface_config(struct usb_desc_header *head,
if_desc->bInterfaceNumber = iface_num;
}
UTIL_LISTIFY(NUM_INSTANCES, DEFINE_TEST_DESC, _)
UTIL_LISTIFY(NUM_INSTANCES, DEFINE_TEST_EP_CFG, _)
UTIL_LISTIFY(NUM_INSTANCES, DEFINE_TEST_CFG_DATA, _)
LISTIFY(NUM_INSTANCES, DEFINE_TEST_DESC, (;), _);
LISTIFY(NUM_INSTANCES, DEFINE_TEST_EP_CFG, (;), _);
LISTIFY(NUM_INSTANCES, DEFINE_TEST_CFG_DATA, (;), _);
static struct usb_cfg_data *usb_get_cfg_data(struct usb_if_descriptor *iface)
{

View file

@ -162,30 +162,6 @@ skipped:
#undef test_IF_ENABLED_FLAG_B
}
void test_UTIL_LISTIFY(void)
{
int i = 0;
#define INC(x, n, m) \
do { \
i += (x + n + m);\
} while (0);
#define DEFINE(x, y) int a##x = x * y;
#define MARK_UNUSED(x, _) ARG_UNUSED(a##x);
UTIL_LISTIFY(4, DEFINE, 2)
UTIL_LISTIFY(4, MARK_UNUSED, _)
UTIL_LISTIFY(4, INC, 1, 2)
zassert_equal(i, 0 + 1 + 2 + 3 + 4 * (1 + 2), NULL);
zassert_equal(a0, 0, NULL);
zassert_equal(a1, 2, NULL);
zassert_equal(a2, 4, NULL);
zassert_equal(a3, 6, NULL);
}
void test_LISTIFY(void)
{
int ab0 = 1;
@ -473,7 +449,6 @@ void test_cc(void)
ztest_unit_test(test_UTIL_OR),
ztest_unit_test(test_UTIL_AND),
ztest_unit_test(test_IF_ENABLED),
ztest_unit_test(test_UTIL_LISTIFY),
ztest_unit_test(test_LISTIFY),
ztest_unit_test(test_MACRO_MAP_CAT),
ztest_unit_test(test_z_max_z_min_z_clamp),