Skip to content

Commit 596cd64

Browse files
maass-hamburgkartben
authored andcommitted
drivers: ethernet: use DT_INST_PROP_OR for local-mac-address
use DT_INST_PROP_OR for local-mac-address, so that it is not required to be set in dt, as there are other ways to se the mac address. Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
1 parent 5f83aea commit 596cd64

File tree

6 files changed

+7
-6
lines changed

6 files changed

+7
-6
lines changed

drivers/ethernet/dwc_xgmac/eth_dwc_xgmac.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1699,7 +1699,7 @@ static const struct ethernet_api eth_dwc_xgmac_apis = {
16991699
/* Device run-time data declaration macro */
17001700
#define ETH_DWC_XGMAC_DEV_DATA(port) \
17011701
static struct eth_dwc_xgmac_dev_data eth_dwc_xgmac##port##_dev_data = { \
1702-
.mac_addr = DT_INST_PROP(port, local_mac_address), \
1702+
.mac_addr = DT_INST_PROP_OR(port, local_mac_address, {0}), \
17031703
.link_speed = DT_INST_PROP(port, max_speed), \
17041704
.enable_full_duplex = DT_INST_PROP(port, full_duplex_mode_en), \
17051705
.dma_rx_desc = &eth_dwc_xgmac##port##_rx_desc[0u][0u], \

drivers/ethernet/eth_lan865x.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ static const struct ethernet_api lan865x_api_func = {
472472
struct oa_tc6 oa_tc6_##inst = { \
473473
.cps = 64, .protected = 0, .spi = &lan865x_config_##inst.spi}; \
474474
static struct lan865x_data lan865x_data_##inst = { \
475-
.mac_address = DT_INST_PROP(inst, local_mac_address), \
475+
.mac_address = DT_INST_PROP_OR(inst, local_mac_address, {0}), \
476476
.tx_rx_sem = Z_SEM_INITIALIZER((lan865x_data_##inst).tx_rx_sem, 1, 1), \
477477
.int_sem = Z_SEM_INITIALIZER((lan865x_data_##inst).int_sem, 0, 1), \
478478
.tc6 = &oa_tc6_##inst}; \

drivers/ethernet/eth_lan9250.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ static int lan9250_init(const struct device *dev)
702702

703703
#define LAN9250_DEFINE(inst) \
704704
static struct lan9250_runtime lan9250_##inst##_runtime = { \
705-
.mac_address = DT_INST_PROP(inst, local_mac_address), \
705+
.mac_address = DT_INST_PROP_OR(inst, local_mac_address, {0}), \
706706
.tx_rx_sem = Z_SEM_INITIALIZER(lan9250_##inst##_runtime.tx_rx_sem, 1, UINT_MAX), \
707707
.int_sem = Z_SEM_INITIALIZER(lan9250_##inst##_runtime.int_sem, 0, UINT_MAX), \
708708
}; \

drivers/ethernet/eth_litex_liteeth.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,8 @@ static const struct ethernet_api eth_api = {
331331
} \
332332
\
333333
static struct eth_litex_dev_data eth_data##n = { \
334-
.mac_addr = DT_INST_PROP(n, local_mac_address)}; \
334+
.mac_addr = DT_INST_PROP_OR(n, local_mac_address, {0}), \
335+
}; \
335336
\
336337
static const struct eth_litex_config eth_config##n = { \
337338
.phy_dev = DEVICE_DT_GET_OR_NULL(DT_INST_PHANDLE(n, phy_handle)), \

drivers/ethernet/eth_xilinx_axienet.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ static const struct ethernet_api xilinx_axienet_api = {
586586
} \
587587
\
588588
static struct xilinx_axienet_data data_##inst = { \
589-
.mac_addr = DT_INST_PROP(inst, local_mac_address), \
589+
.mac_addr = DT_INST_PROP_OR(inst, local_mac_address, {0}), \
590590
.dma_is_configured_rx = false, \
591591
.dma_is_configured_tx = false}; \
592592
static const struct xilinx_axienet_config config_##inst = { \

drivers/ethernet/eth_xlnx_gem_priv.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ static const struct eth_xlnx_gem_dev_cfg eth_xlnx_gem##port##_dev_cfg = {\
476476
/* Device run-time data declaration macro */
477477
#define ETH_XLNX_GEM_DEV_DATA(port) \
478478
static struct eth_xlnx_gem_dev_data eth_xlnx_gem##port##_dev_data = {\
479-
.mac_addr = DT_INST_PROP(port, local_mac_address),\
479+
.mac_addr = DT_INST_PROP_OR(port, local_mac_address, {0}),\
480480
.started = 0,\
481481
.eff_link_speed = LINK_DOWN,\
482482
.phy_addr = 0,\

0 commit comments

Comments
 (0)