Skip to content

Commit fa57ff1

Browse files
committed
tests: Switching NET_DEVICE_<INIT/DT_DEFINE>... macros to new ones
Switching to NET_DEVICE_INSTANCE, NET_DEVICE_INSTANCE_FROM_DT_INST, NET_DEVICE_INSTANCE_MULTI, NET_DEVICE_INSTANCE_MULT_FROM_DT_INST, NET_DEVICE_OFFLOAD_INSTANCE and NET_DEVICE_OFFLOAD_INSTANCE_FROM_DT_INST. Thus removing prio and name parameters on all. Signed-off-by: Tomasz Bursztyka <[email protected]>
1 parent 11a3899 commit fa57ff1

File tree

41 files changed

+85
-193
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+85
-193
lines changed

tests/net/6lo/src/main.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,7 @@ static struct dummy_api net_6lo_if_api = {
275275
.send = tester_send,
276276
};
277277

278-
NET_DEVICE_INIT(net_6lo_test, "net_6lo_test",
279-
net_6lo_dev_init, NULL, NULL, NULL,
280-
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
278+
NET_DEVICE_INSTANCE(net_6lo_test, net_6lo_dev_init, NULL, NULL, NULL,
281279
&net_6lo_if_api, DUMMY_L2, NET_L2_GET_CTX_TYPE(DUMMY_L2), 127);
282280

283281
static bool compare_ipv6_hdr(struct net_pkt *pkt, struct net_6lo_data *data)

tests/net/all/src/main.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,13 @@ static struct offload_context {
3131
};
3232

3333
/* Create blank dummy and offloaded net devices */
34-
NET_DEVICE_INIT(dummy_dev, "dummy_dev",
34+
NET_DEVICE_INSTANCE(dummy_dev, NULL, NULL,
3535
NULL, NULL,
36-
NULL, NULL,
37-
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
3836
&dummy_dev_api,
3937
DUMMY_L2, NET_L2_GET_CTX_TYPE(DUMMY_L2), 0);
4038

41-
NET_DEVICE_OFFLOAD_INIT(net_offload, "net_offload",
42-
NULL, NULL,
39+
NET_DEVICE_OFFLOAD_INSTANCE(net_offload, NULL, NULL,
4340
&offload_context_data, NULL,
44-
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
4541
&offload_dev_api, 0);
4642

4743
ZTEST(net_compile_all_test, test_ok)

tests/net/arp/src/main.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,10 +300,8 @@ static const struct dummy_api net_arp_if_api = {
300300
#define _ETH_L2_CTX_TYPE NET_L2_GET_CTX_TYPE(DUMMY_L2)
301301
#endif
302302

303-
NET_DEVICE_INIT(net_arp_test, "net_arp_test",
304-
net_arp_dev_init, NULL,
303+
NET_DEVICE_INSTANCE(net_arp_test, net_arp_dev_init, NULL,
305304
&net_arp_context_data, NULL,
306-
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
307305
&net_arp_if_api, _ETH_L2_LAYER, _ETH_L2_CTX_TYPE, 127);
308306

309307
static void arp_cb(struct arp_entry *entry, void *user_data)

tests/net/conn_mgr_conn/src/test_ifaces.c

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,70 +32,58 @@ static struct dummy_api test_iface_api = {
3232
* iface a1 and a2 share L2 connectivity implementation a
3333
* iface b uses connectivity implementation b
3434
*/
35-
NET_DEVICE_INIT(test_iface_a1,
36-
"test_iface_a1",
35+
NET_DEVICE_INSTANCE(test_iface_a1,
3736
NULL,
3837
NULL,
3938
NULL,
4039
NULL,
41-
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
4240
&test_iface_api,
4341
DUMMY_L2,
4442
NET_L2_GET_CTX_TYPE(DUMMY_L2),
4543
127);
46-
NET_DEVICE_INIT(test_iface_a2,
47-
"test_iface_a2",
44+
NET_DEVICE_INSTANCE(test_iface_a2,
4845
NULL,
4946
NULL,
5047
NULL,
5148
NULL,
52-
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
5349
&test_iface_api,
5450
DUMMY_L2,
5551
NET_L2_GET_CTX_TYPE(DUMMY_L2),
5652
127);
57-
NET_DEVICE_INIT(test_iface_b,
58-
"test_iface_b",
53+
NET_DEVICE_INSTANCE(test_iface_b,
5954
NULL,
6055
NULL,
6156
NULL,
6257
NULL,
63-
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
6458
&test_iface_api,
6559
DUMMY_L2,
6660
NET_L2_GET_CTX_TYPE(DUMMY_L2),
6761
127);
6862

6963
/* Create an ifaces with NULL implementation, NULL init, and no connectivity at all */
70-
NET_DEVICE_INIT(test_iface_null,
71-
"test_iface_null",
64+
NET_DEVICE_INSTANCE(test_iface_null,
7265
NULL,
7366
NULL,
7467
NULL,
7568
NULL,
76-
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
7769
&test_iface_api,
7870
DUMMY_L2,
7971
NET_L2_GET_CTX_TYPE(DUMMY_L2),
8072
127);
81-
NET_DEVICE_INIT(test_iface_ni,
82-
"test_iface_ni",
73+
NET_DEVICE_INSTANCE(test_iface_ni,
8374
NULL,
8475
NULL,
8576
NULL,
8677
NULL,
87-
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
8878
&test_iface_api,
8979
DUMMY_L2,
9080
NET_L2_GET_CTX_TYPE(DUMMY_L2),
9181
127);
92-
NET_DEVICE_INIT(test_iface_none,
93-
"test_iface_none",
82+
NET_DEVICE_INSTANCE(test_iface_none,
9483
NULL,
9584
NULL,
9685
NULL,
9786
NULL,
98-
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
9987
&test_iface_api,
10088
DUMMY_L2,
10189
NET_L2_GET_CTX_TYPE(DUMMY_L2),

tests/net/conn_mgr_monitor/src/test_ifaces.c

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,49 +46,41 @@ static struct ethernet_api dummy_eth_api = {
4646
.iface_api.init = test_iface_init,
4747
};
4848

49-
NET_DEVICE_INIT(test_if_simple_a,
50-
"test_if_simple_a",
49+
NET_DEVICE_INSTANCE(test_if_simple_a,
5150
test_iface_netdev_init,
5251
NULL,
5352
NULL,
5453
NULL,
55-
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
5654
&test_iface_api,
5755
DUMMY_L2,
5856
NET_L2_GET_CTX_TYPE(DUMMY_L2),
5957
127);
6058

61-
NET_DEVICE_INIT(test_if_simple_b,
62-
"test_if_simple_b",
59+
NET_DEVICE_INSTANCE(test_if_simple_b,
6360
test_iface_netdev_init,
6461
NULL,
6562
NULL,
6663
NULL,
67-
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
6864
&test_iface_api,
6965
DUMMY_L2,
7066
NET_L2_GET_CTX_TYPE(DUMMY_L2),
7167
127);
7268

73-
NET_DEVICE_INIT(test_if_connected_a,
74-
"test_if_connected_a",
69+
NET_DEVICE_INSTANCE(test_if_connected_a,
7570
test_iface_netdev_init,
7671
NULL,
7772
NULL,
7873
NULL,
79-
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
8074
&test_iface_api,
8175
DUMMY_L2,
8276
NET_L2_GET_CTX_TYPE(DUMMY_L2),
8377
127);
8478

85-
NET_DEVICE_INIT(test_if_connected_b,
86-
"test_if_connected_b",
79+
NET_DEVICE_INSTANCE(test_if_connected_b,
8780
test_iface_netdev_init,
8881
NULL,
8982
NULL,
9083
NULL,
91-
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
9284
&test_iface_api,
9385
DUMMY_L2,
9486
NET_L2_GET_CTX_TYPE(DUMMY_L2),
@@ -97,13 +89,11 @@ NET_DEVICE_INIT(test_if_connected_b,
9789
/* A dummy ETHERNET_L2 iface so that we can test L2 ignore.
9890
* This iface is not properly defined, do not attempt to use it.
9991
*/
100-
NET_DEVICE_INIT(test_if_dummy_eth,
101-
"test_if_dummy_eth",
92+
NET_DEVICE_INSTANCE(test_if_dummy_eth,
10293
test_iface_netdev_init,
10394
NULL,
10495
NULL,
10596
NULL,
106-
CONFIG_ETH_INIT_PRIORITY,
10797
&dummy_eth_api,
10898
ETHERNET_L2,
10999
NET_L2_GET_CTX_TYPE(ETHERNET_L2),

tests/net/context/src/main.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,10 +1078,8 @@ static struct dummy_api net_context_if_api = {
10781078
#define _ETH_L2_LAYER DUMMY_L2
10791079
#define _ETH_L2_CTX_TYPE NET_L2_GET_CTX_TYPE(DUMMY_L2)
10801080

1081-
NET_DEVICE_INIT(net_context_test, "net_context_test",
1082-
net_context_dev_init, NULL,
1081+
NET_DEVICE_INSTANCE(net_context_test, net_context_dev_init, NULL,
10831082
&net_context_data, NULL,
1084-
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
10851083
&net_context_if_api, _ETH_L2_LAYER,
10861084
_ETH_L2_CTX_TYPE, 127);
10871085

tests/net/dhcpv4/client/src/main.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -455,10 +455,8 @@ static struct dummy_api net_dhcpv4_if_api = {
455455
.send = tester_send,
456456
};
457457

458-
NET_DEVICE_INIT(net_dhcpv4_test, "net_dhcpv4_test",
459-
net_dhcpv4_dev_init, NULL,
458+
NET_DEVICE_INSTANCE(net_dhcpv4_test, net_dhcpv4_dev_init, NULL,
460459
&net_dhcpv4_context_data, NULL,
461-
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
462460
&net_dhcpv4_if_api, DUMMY_L2,
463461
NET_L2_GET_CTX_TYPE(DUMMY_L2), 127);
464462

tests/net/dhcpv4/server/src/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ static struct dummy_api server_if_api = {
128128
.send = server_send,
129129
};
130130

131-
NET_DEVICE_INIT(server_iface, "server_iface", NULL, NULL, NULL, NULL,
132-
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &server_if_api,
131+
NET_DEVICE_INSTANCE(server_iface, NULL, NULL, NULL, NULL,
132+
&server_if_api,
133133
DUMMY_L2, NET_L2_GET_CTX_TYPE(DUMMY_L2), NET_IPV4_MTU);
134134

135135
static const uint8_t cookie[4] = { 0x63, 0x82, 0x53, 0x63 };

tests/net/dhcpv6/src/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ static struct dummy_api test_if_api = {
7373
.send = test_send,
7474
};
7575

76-
NET_DEVICE_INIT(test_dhcpv6, "test_dhcpv6", NULL, NULL, &test_ctx, NULL,
77-
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &test_if_api,
76+
NET_DEVICE_INSTANCE(test_dhcpv6, NULL, NULL, &test_ctx, NULL,
77+
&test_if_api,
7878
DUMMY_L2, NET_L2_GET_CTX_TYPE(DUMMY_L2), NET_IPV6_MTU);
7979

8080
static void set_dhcpv6_test_fn(test_dhcpv6_pkt_fn_t test_fn)

tests/net/hostname/src/main.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,12 @@ static struct ethernet_api net_iface_api = {
139139
#define _ETH_L2_LAYER ETHERNET_L2
140140
#define _ETH_L2_CTX_TYPE NET_L2_GET_CTX_TYPE(ETHERNET_L2)
141141

142-
NET_DEVICE_INIT_INSTANCE(net_iface1_test,
143-
"iface1",
142+
NET_DEVICE_INSTANCE_MULTI(net_iface1_test,
144143
iface1,
145144
NULL,
146145
NULL,
147146
&net_iface1_data,
148147
NULL,
149-
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
150148
&net_iface_api,
151149
_ETH_L2_LAYER,
152150
_ETH_L2_CTX_TYPE,

0 commit comments

Comments
 (0)