Skip to content

Commit cfd3560

Browse files
gmarullcarlescufi
authored andcommitted
device: s/Z_DEVICE_DT_DEV_NAME/Z_DEVICE_DT_DEV_ID
Rename Z_DEVICE_DT_DEV_NAME to Z_DEVICE_DT_DEV_ID to make it more clear, as the macro is generating a token that identifies the created struct device. Signed-off-by: Gerard Marull-Paretas <[email protected]>
1 parent 7537388 commit cfd3560

File tree

8 files changed

+27
-27
lines changed

8 files changed

+27
-27
lines changed

drivers/wifi/esp_at/esp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1198,7 +1198,7 @@ static int esp_init(const struct device *dev)
11981198
k_thread_name_set(&esp_rx_thread, "esp_rx");
11991199

12001200
/* Retrieve associated network interface so asynchronous messages can be processed early */
1201-
data->net_iface = NET_IF_GET(Z_DEVICE_DT_DEV_NAME(DT_DRV_INST(0)), 0);
1201+
data->net_iface = NET_IF_GET(Z_DEVICE_DT_DEV_ID(DT_DRV_INST(0)), 0);
12021202

12031203
/* Reset the modem */
12041204
ret = esp_reset(dev);

include/zephyr/device.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ BUILD_ASSERT(sizeof(device_handle_t) == 2, "fix the linker scripts");
116116
* The ordinal used in this name can be mapped to the path by
117117
* examining zephyr/include/generated/devicetree_generated.h.
118118
*/
119-
#define Z_DEVICE_DT_DEV_NAME(node_id) _CONCAT(dts_ord_, DT_DEP_ORD(node_id))
119+
#define Z_DEVICE_DT_DEV_ID(node_id) _CONCAT(dts_ord_, DT_DEP_ORD(node_id))
120120

121121
/**
122122
* @brief Create a device object and set it up for boot time initialization.
@@ -223,11 +223,11 @@ BUILD_ASSERT(sizeof(device_handle_t) == 2, "fix the linker scripts");
223223
*/
224224
#define DEVICE_DT_DEFINE(node_id, init_fn, pm, data, config, level, prio, api, \
225225
...) \
226-
Z_DEVICE_STATE_DEFINE(Z_DEVICE_DT_DEV_NAME(node_id)); \
227-
Z_DEVICE_DEFINE(node_id, Z_DEVICE_DT_DEV_NAME(node_id), \
226+
Z_DEVICE_STATE_DEFINE(Z_DEVICE_DT_DEV_ID(node_id)); \
227+
Z_DEVICE_DEFINE(node_id, Z_DEVICE_DT_DEV_ID(node_id), \
228228
DEVICE_DT_NAME(node_id), init_fn, pm, data, config, \
229229
level, prio, api, \
230-
&Z_DEVICE_STATE_NAME(Z_DEVICE_DT_DEV_NAME(node_id)), \
230+
&Z_DEVICE_STATE_NAME(Z_DEVICE_DT_DEV_ID(node_id)), \
231231
__VA_ARGS__)
232232

233233
/**
@@ -257,7 +257,7 @@ BUILD_ASSERT(sizeof(device_handle_t) == 2, "fix the linker scripts");
257257
*
258258
* @return The name of the device object as a C identifier
259259
*/
260-
#define DEVICE_DT_NAME_GET(node_id) DEVICE_NAME_GET(Z_DEVICE_DT_DEV_NAME(node_id))
260+
#define DEVICE_DT_NAME_GET(node_id) DEVICE_NAME_GET(Z_DEVICE_DT_DEV_ID(node_id))
261261

262262
/**
263263
* @brief Get a <tt>const struct device*</tt> from a devicetree node

include/zephyr/drivers/can.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -604,13 +604,13 @@ struct can_device_state {
604604
*/
605605
#define CAN_DEVICE_DT_DEFINE(node_id, init_fn, pm, data, config, level, \
606606
prio, api, ...) \
607-
Z_CAN_DEVICE_STATE_DEFINE(Z_DEVICE_DT_DEV_NAME(node_id)); \
608-
Z_CAN_INIT_FN(Z_DEVICE_DT_DEV_NAME(node_id), init_fn) \
609-
Z_DEVICE_DEFINE(node_id, Z_DEVICE_DT_DEV_NAME(node_id), \
607+
Z_CAN_DEVICE_STATE_DEFINE(Z_DEVICE_DT_DEV_ID(node_id)); \
608+
Z_CAN_INIT_FN(Z_DEVICE_DT_DEV_ID(node_id), init_fn) \
609+
Z_DEVICE_DEFINE(node_id, Z_DEVICE_DT_DEV_ID(node_id), \
610610
DEVICE_DT_NAME(node_id), \
611-
&UTIL_CAT(Z_DEVICE_DT_DEV_NAME(node_id), _init), \
611+
&UTIL_CAT(Z_DEVICE_DT_DEV_ID(node_id), _init), \
612612
pm, data, config, level, prio, api, \
613-
&(Z_DEVICE_STATE_NAME(Z_DEVICE_DT_DEV_NAME(node_id)).devstate), \
613+
&(Z_DEVICE_STATE_NAME(Z_DEVICE_DT_DEV_ID(node_id)).devstate), \
614614
__VA_ARGS__)
615615

616616
#else /* CONFIG_CAN_STATS */

include/zephyr/drivers/gpio/gpio_mmio32.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ int gpio_mmio32_init(const struct device *dev);
4242
*
4343
*/
4444
#define GPIO_MMIO32_INIT(node_id, _address, _mask) \
45-
static struct gpio_mmio32_context _CONCAT(Z_DEVICE_DT_DEV_NAME(node_id), _ctx); \
45+
static struct gpio_mmio32_context _CONCAT(Z_DEVICE_DT_DEV_ID(node_id), _ctx); \
4646
\
47-
static const struct gpio_mmio32_config _CONCAT(Z_DEVICE_DT_DEV_NAME(node_id), _cfg) = { \
47+
static const struct gpio_mmio32_config _CONCAT(Z_DEVICE_DT_DEV_ID(node_id), _cfg) = { \
4848
.common = { \
4949
.port_pin_mask = _mask, \
5050
}, \
@@ -55,8 +55,8 @@ static const struct gpio_mmio32_config _CONCAT(Z_DEVICE_DT_DEV_NAME(node_id), _c
5555
DEVICE_DT_DEFINE(node_id, \
5656
&gpio_mmio32_init, \
5757
NULL, \
58-
&_CONCAT(Z_DEVICE_DT_DEV_NAME(node_id), _ctx), \
59-
&_CONCAT(Z_DEVICE_DT_DEV_NAME(node_id), _cfg), \
58+
&_CONCAT(Z_DEVICE_DT_DEV_ID(node_id), _ctx), \
59+
&_CONCAT(Z_DEVICE_DT_DEV_ID(node_id), _cfg), \
6060
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \
6161
&gpio_mmio32_api)
6262

include/zephyr/drivers/i2c.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -509,13 +509,13 @@ static inline void i2c_xfer_stats(const struct device *dev, struct i2c_msg *msgs
509509
*/
510510
#define I2C_DEVICE_DT_DEFINE(node_id, init_fn, pm, data, config, level, \
511511
prio, api, ...) \
512-
Z_I2C_DEVICE_STATE_DEFINE(Z_DEVICE_DT_DEV_NAME(node_id)); \
513-
Z_I2C_INIT_FN(Z_DEVICE_DT_DEV_NAME(node_id), init_fn) \
514-
Z_DEVICE_DEFINE(node_id, Z_DEVICE_DT_DEV_NAME(node_id), \
512+
Z_I2C_DEVICE_STATE_DEFINE(Z_DEVICE_DT_DEV_ID(node_id)); \
513+
Z_I2C_INIT_FN(Z_DEVICE_DT_DEV_ID(node_id), init_fn) \
514+
Z_DEVICE_DEFINE(node_id, Z_DEVICE_DT_DEV_ID(node_id), \
515515
DEVICE_DT_NAME(node_id), \
516-
&UTIL_CAT(Z_DEVICE_DT_DEV_NAME(node_id), _init), \
516+
&UTIL_CAT(Z_DEVICE_DT_DEV_ID(node_id), _init), \
517517
pm_device, data, config, level, prio, api, \
518-
&(Z_DEVICE_STATE_NAME(Z_DEVICE_DT_DEV_NAME(node_id)).devstate), \
518+
&(Z_DEVICE_STATE_NAME(Z_DEVICE_DT_DEV_ID(node_id)).devstate), \
519519
__VA_ARGS__)
520520

521521
#else /* CONFIG_I2C_STATS */

include/zephyr/net/ethernet.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,7 @@ static inline bool net_eth_get_vlan_status(struct net_if *iface)
893893
*/
894894
#define ETH_NET_DEVICE_DT_DEFINE(node_id, init_fn, pm, data, config, \
895895
prio, api, mtu) \
896-
Z_ETH_NET_DEVICE_INIT(node_id, Z_DEVICE_DT_DEV_NAME(node_id), \
896+
Z_ETH_NET_DEVICE_INIT(node_id, Z_DEVICE_DT_DEV_ID(node_id), \
897897
DEVICE_DT_NAME(node_id), init_fn, pm, \
898898
data, config, prio, api, mtu)
899899

include/zephyr/net/net_if.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2367,7 +2367,7 @@ struct net_if_api {
23672367
*/
23682368
#define NET_DEVICE_DT_DEFINE(node_id, init_fn, pm, data, \
23692369
config, prio, api, l2, l2_ctx_type, mtu) \
2370-
Z_NET_DEVICE_INIT(node_id, Z_DEVICE_DT_DEV_NAME(node_id), \
2370+
Z_NET_DEVICE_INIT(node_id, Z_DEVICE_DT_DEV_ID(node_id), \
23712371
DEVICE_DT_NAME(node_id), init_fn, pm, data, \
23722372
config, prio, api, l2, l2_ctx_type, mtu)
23732373

@@ -2448,7 +2448,7 @@ struct net_if_api {
24482448
data, config, prio, api, l2, \
24492449
l2_ctx_type, mtu) \
24502450
Z_NET_DEVICE_INIT_INSTANCE(node_id, \
2451-
Z_DEVICE_DT_DEV_NAME(node_id), \
2451+
Z_DEVICE_DT_DEV_ID(node_id), \
24522452
DEVICE_DT_NAME(node_id), instance, \
24532453
init_fn, pm, data, config, prio, \
24542454
api, l2, l2_ctx_type, mtu)
@@ -2518,7 +2518,7 @@ struct net_if_api {
25182518
*/
25192519
#define NET_DEVICE_DT_OFFLOAD_DEFINE(node_id, init_fn, pm, data, \
25202520
config, prio, api, mtu) \
2521-
Z_NET_DEVICE_OFFLOAD_INIT(node_id, Z_DEVICE_DT_DEV_NAME(node_id), \
2521+
Z_NET_DEVICE_OFFLOAD_INIT(node_id, Z_DEVICE_DT_DEV_ID(node_id), \
25222522
DEVICE_DT_NAME(node_id), init_fn, pm, \
25232523
data, config, prio, api, mtu)
25242524

include/zephyr/pm/device.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ struct pm_device {
260260
* @see #PM_DEVICE_DT_INST_DEFINE, #PM_DEVICE_DEFINE
261261
*/
262262
#define PM_DEVICE_DT_DEFINE(node_id, pm_action_cb) \
263-
Z_PM_DEVICE_DEFINE(node_id, Z_DEVICE_DT_DEV_NAME(node_id), \
263+
Z_PM_DEVICE_DEFINE(node_id, Z_DEVICE_DT_DEV_ID(node_id), \
264264
pm_action_cb)
265265

266266
/**
@@ -275,7 +275,7 @@ struct pm_device {
275275
*/
276276
#define PM_DEVICE_DT_INST_DEFINE(idx, pm_action_cb) \
277277
Z_PM_DEVICE_DEFINE(DT_DRV_INST(idx), \
278-
Z_DEVICE_DT_DEV_NAME(DT_DRV_INST(idx)), \
278+
Z_DEVICE_DT_DEV_ID(DT_DRV_INST(idx)), \
279279
pm_action_cb)
280280

281281
/**
@@ -298,7 +298,7 @@ struct pm_device {
298298
* @kconfig{CONFIG_PM_DEVICE} is disabled).
299299
*/
300300
#define PM_DEVICE_DT_GET(node_id) \
301-
PM_DEVICE_GET(Z_DEVICE_DT_DEV_NAME(node_id))
301+
PM_DEVICE_GET(Z_DEVICE_DT_DEV_ID(node_id))
302302

303303
/**
304304
* @brief Obtain a reference to the device PM resources for the given instance.

0 commit comments

Comments
 (0)