diff --git a/samples/bluetooth/central/src/main.c b/samples/bluetooth/central/src/main.c index c2a164cccb..9124256048 100644 --- a/samples/bluetooth/central/src/main.c +++ b/samples/bluetooth/central/src/main.c @@ -116,9 +116,9 @@ static void disconnected(struct bt_conn *conn, uint8_t reason) start_scan(); } -static struct bt_conn_cb conn_callbacks = { - .connected = connected, - .disconnected = disconnected, +BT_CONN_CB_DEFINE(conn_callbacks) = { + .connected = connected, + .disconnected = disconnected, }; void main(void) @@ -133,7 +133,5 @@ void main(void) printk("Bluetooth initialized\n"); - bt_conn_cb_register(&conn_callbacks); - start_scan(); } diff --git a/samples/bluetooth/central_hr/src/main.c b/samples/bluetooth/central_hr/src/main.c index a1bb7dfa0e..271e6c4652 100644 --- a/samples/bluetooth/central_hr/src/main.c +++ b/samples/bluetooth/central_hr/src/main.c @@ -235,7 +235,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason) start_scan(); } -static struct bt_conn_cb conn_callbacks = { +BT_CONN_CB_DEFINE(conn_callbacks) = { .connected = connected, .disconnected = disconnected, }; @@ -252,7 +252,5 @@ void main(void) printk("Bluetooth initialized\n"); - bt_conn_cb_register(&conn_callbacks); - start_scan(); } diff --git a/samples/bluetooth/central_ht/src/main.c b/samples/bluetooth/central_ht/src/main.c index 3a514a4857..68c53d2ece 100644 --- a/samples/bluetooth/central_ht/src/main.c +++ b/samples/bluetooth/central_ht/src/main.c @@ -258,7 +258,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason) } } -static struct bt_conn_cb conn_callbacks = { +BT_CONN_CB_DEFINE(conn_callbacks) = { .connected = connected, .disconnected = disconnected, }; @@ -275,8 +275,6 @@ void main(void) printk("Bluetooth initialized\n"); - bt_conn_cb_register(&conn_callbacks); - err = scan_start(); if (err) { diff --git a/samples/bluetooth/central_iso/src/main.c b/samples/bluetooth/central_iso/src/main.c index 4ed5ab53e8..61e17f1153 100644 --- a/samples/bluetooth/central_iso/src/main.c +++ b/samples/bluetooth/central_iso/src/main.c @@ -222,7 +222,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason) start_scan(); } -static struct bt_conn_cb conn_callbacks = { +BT_CONN_CB_DEFINE(conn_callbacks) = { .connected = connected, .disconnected = disconnected, }; @@ -239,8 +239,6 @@ void main(void) printk("Bluetooth initialized\n"); - bt_conn_cb_register(&conn_callbacks); - iso_chan.ops = &iso_ops; iso_chan.qos = &iso_qos; diff --git a/samples/bluetooth/eddystone/src/main.c b/samples/bluetooth/eddystone/src/main.c index b0d4bf7d87..4f4b0dbaa1 100644 --- a/samples/bluetooth/eddystone/src/main.c +++ b/samples/bluetooth/eddystone/src/main.c @@ -676,7 +676,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason) } } -static struct bt_conn_cb conn_callbacks = { +BT_CONN_CB_DEFINE(conn_callbacks) = { .connected = connected, .disconnected = disconnected, }; @@ -685,7 +685,6 @@ void main(void) { int err; - bt_conn_cb_register(&conn_callbacks); k_work_init_delayable(&idle_work, idle_timeout); /* Initialize the Bluetooth Subsystem */ diff --git a/samples/bluetooth/hci_pwr_ctrl/src/main.c b/samples/bluetooth/hci_pwr_ctrl/src/main.c index e935b2d18b..83853caf38 100644 --- a/samples/bluetooth/hci_pwr_ctrl/src/main.c +++ b/samples/bluetooth/hci_pwr_ctrl/src/main.c @@ -190,7 +190,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason) } } -static struct bt_conn_cb conn_callbacks = { +BT_CONN_CB_DEFINE(conn_callbacks) = { .connected = connected, .disconnected = disconnected, }; @@ -295,8 +295,6 @@ void main(void) get_tx_power(BT_HCI_VS_LL_HANDLE_TYPE_ADV, 0, &txp_get); printk("-> default TXP = %d\n", txp_get); - bt_conn_cb_register(&conn_callbacks); - /* Wait for 5 seconds to give a chance users/testers * to check that default Tx power is indeed the one * selected in Kconfig. diff --git a/samples/bluetooth/peripheral/src/main.c b/samples/bluetooth/peripheral/src/main.c index 412dd4a949..35ed3ed52a 100644 --- a/samples/bluetooth/peripheral/src/main.c +++ b/samples/bluetooth/peripheral/src/main.c @@ -248,7 +248,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason) printk("Disconnected (reason 0x%02x)\n", reason); } -static struct bt_conn_cb conn_callbacks = { +BT_CONN_CB_DEFINE(conn_callbacks) = { .connected = connected, .disconnected = disconnected, }; @@ -339,7 +339,6 @@ void main(void) bt_ready(); bt_gatt_cb_register(&gatt_callbacks); - bt_conn_cb_register(&conn_callbacks); bt_conn_auth_cb_register(&auth_cb_display); vnd_ind_attr = bt_gatt_find_by_uuid(vnd_svc.attrs, vnd_svc.attr_count, diff --git a/samples/bluetooth/peripheral_csc/src/main.c b/samples/bluetooth/peripheral_csc/src/main.c index 40fcbc063b..83768bf44c 100644 --- a/samples/bluetooth/peripheral_csc/src/main.c +++ b/samples/bluetooth/peripheral_csc/src/main.c @@ -356,7 +356,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason) printk("Disconnected (reason 0x%02x)\n", reason); } -static struct bt_conn_cb conn_callbacks = { +BT_CONN_CB_DEFINE(conn_callbacks) = { .connected = connected, .disconnected = disconnected, }; @@ -408,8 +408,6 @@ void main(void) bt_ready(); - bt_conn_cb_register(&conn_callbacks); - while (1) { k_sleep(K_SECONDS(1)); diff --git a/samples/bluetooth/peripheral_dis/src/main.c b/samples/bluetooth/peripheral_dis/src/main.c index 733ef33617..3067851c54 100644 --- a/samples/bluetooth/peripheral_dis/src/main.c +++ b/samples/bluetooth/peripheral_dis/src/main.c @@ -40,7 +40,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason) printk("Disconnected (reason 0x%02x)\n", reason); } -static struct bt_conn_cb conn_callbacks = { +BT_CONN_CB_DEFINE(conn_callbacks) = { .connected = connected, .disconnected = disconnected, }; @@ -96,8 +96,6 @@ void main(void) printk("Bluetooth initialized\n"); - bt_conn_cb_register(&conn_callbacks); - err = bt_le_adv_start(BT_LE_ADV_CONN_NAME, ad, ARRAY_SIZE(ad), NULL, 0); if (err) { printk("Advertising failed to start (err %d)\n", err); diff --git a/samples/bluetooth/peripheral_esp/src/main.c b/samples/bluetooth/peripheral_esp/src/main.c index 0618da1fff..196ea58009 100644 --- a/samples/bluetooth/peripheral_esp/src/main.c +++ b/samples/bluetooth/peripheral_esp/src/main.c @@ -360,7 +360,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason) printk("Disconnected (reason 0x%02x)\n", reason); } -static struct bt_conn_cb conn_callbacks = { +BT_CONN_CB_DEFINE(conn_callbacks) = { .connected = connected, .disconnected = disconnected, }; @@ -429,7 +429,6 @@ void main(void) bt_ready(); - bt_conn_cb_register(&conn_callbacks); bt_conn_auth_cb_register(&auth_cb_display); while (1) { diff --git a/samples/bluetooth/peripheral_hids/src/main.c b/samples/bluetooth/peripheral_hids/src/main.c index eb28f88b3c..41c5dac3ee 100644 --- a/samples/bluetooth/peripheral_hids/src/main.c +++ b/samples/bluetooth/peripheral_hids/src/main.c @@ -73,7 +73,7 @@ static void security_changed(struct bt_conn *conn, bt_security_t level, } } -static struct bt_conn_cb conn_callbacks = { +BT_CONN_CB_DEFINE(conn_callbacks) = { .connected = connected, .disconnected = disconnected, .security_changed = security_changed, @@ -137,6 +137,5 @@ void main(void) return; } - bt_conn_cb_register(&conn_callbacks); bt_conn_auth_cb_register(&auth_cb_display); } diff --git a/samples/bluetooth/peripheral_hr/src/main.c b/samples/bluetooth/peripheral_hr/src/main.c index 05319a4920..13cf692db9 100644 --- a/samples/bluetooth/peripheral_hr/src/main.c +++ b/samples/bluetooth/peripheral_hr/src/main.c @@ -44,7 +44,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason) printk("Disconnected (reason 0x%02x)\n", reason); } -static struct bt_conn_cb conn_callbacks = { +BT_CONN_CB_DEFINE(conn_callbacks) = { .connected = connected, .disconnected = disconnected, }; @@ -115,7 +115,6 @@ void main(void) bt_ready(); - bt_conn_cb_register(&conn_callbacks); bt_conn_auth_cb_register(&auth_cb_display); /* Implement notification. At the moment there is no suitable way diff --git a/samples/bluetooth/peripheral_ht/src/main.c b/samples/bluetooth/peripheral_ht/src/main.c index baab2b3dae..eaa480f4b9 100644 --- a/samples/bluetooth/peripheral_ht/src/main.c +++ b/samples/bluetooth/peripheral_ht/src/main.c @@ -45,7 +45,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason) printk("Disconnected (reason 0x%02x)\n", reason); } -static struct bt_conn_cb conn_callbacks = { +BT_CONN_CB_DEFINE(conn_callbacks) = { .connected = connected, .disconnected = disconnected, }; @@ -105,7 +105,6 @@ void main(void) bt_ready(); - bt_conn_cb_register(&conn_callbacks); bt_conn_auth_cb_register(&auth_cb_display); /* Implement indicate. At the moment there is no suitable way diff --git a/samples/bluetooth/peripheral_iso/src/main.c b/samples/bluetooth/peripheral_iso/src/main.c index 787d3a4669..9db6a78bab 100644 --- a/samples/bluetooth/peripheral_iso/src/main.c +++ b/samples/bluetooth/peripheral_iso/src/main.c @@ -44,7 +44,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason) printk("Disconnected from %s (reason 0x%02x)\n", addr, reason); } -static struct bt_conn_cb conn_callbacks = { +BT_CONN_CB_DEFINE(conn_callbacks) = { .connected = connected, .disconnected = disconnected, }; @@ -156,8 +156,6 @@ void main(void) printk("Bluetooth initialized\n"); - bt_conn_cb_register(&conn_callbacks); - err = bt_iso_server_register(&iso_server); if (err) { printk("Unable to register ISO server (err %d)\n", err); diff --git a/samples/bluetooth/peripheral_ots/src/main.c b/samples/bluetooth/peripheral_ots/src/main.c index 3f5c4cb4bc..2216bdf02e 100644 --- a/samples/bluetooth/peripheral_ots/src/main.c +++ b/samples/bluetooth/peripheral_ots/src/main.c @@ -52,9 +52,9 @@ static void disconnected(struct bt_conn *conn, uint8_t reason) printk("Disconnected (reason %u)\n", reason); } -static struct bt_conn_cb conn_callbacks = { - .connected = connected, - .disconnected = disconnected, +BT_CONN_CB_DEFINE(conn_callbacks) = { + .connected = connected, + .disconnected = disconnected, }; static int ots_obj_created(struct bt_ots *ots, struct bt_conn *conn, @@ -266,8 +266,6 @@ void main(void) printk("Starting Bluetooth Peripheral OTS example\n"); - bt_conn_cb_register(&conn_callbacks); - err = bt_enable(NULL); if (err) { printk("Bluetooth init failed (err %d)\n", err); diff --git a/samples/bluetooth/peripheral_sc_only/src/main.c b/samples/bluetooth/peripheral_sc_only/src/main.c index 99b76ad212..831c9b2860 100644 --- a/samples/bluetooth/peripheral_sc_only/src/main.c +++ b/samples/bluetooth/peripheral_sc_only/src/main.c @@ -78,7 +78,7 @@ static void security_changed(struct bt_conn *conn, bt_security_t level, } } -static struct bt_conn_cb conn_callbacks = { +BT_CONN_CB_DEFINE(conn_callbacks) = { .connected = connected, .disconnected = disconnected, .identity_resolved = identity_resolved, @@ -136,7 +136,6 @@ void main(void) bt_conn_auth_cb_register(&auth_cb_display); - bt_conn_cb_register(&conn_callbacks); err = bt_le_adv_start(BT_LE_ADV_CONN_NAME, ad, ARRAY_SIZE(ad), NULL, 0); if (err) { diff --git a/samples/bluetooth/st_ble_sensor/src/main.c b/samples/bluetooth/st_ble_sensor/src/main.c index b28c395073..710b4bfbc5 100644 --- a/samples/bluetooth/st_ble_sensor/src/main.c +++ b/samples/bluetooth/st_ble_sensor/src/main.c @@ -173,7 +173,7 @@ static void disconnected(struct bt_conn *disconn, uint8_t reason) LOG_INF("Disconnected (reason %u)", reason); } -static struct bt_conn_cb conn_callbacks = { +BT_CONN_CB_DEFINE(conn_callbacks) = { .connected = connected, .disconnected = disconnected, }; @@ -191,7 +191,6 @@ void main(void) if (err) { return; } - bt_conn_cb_register(&conn_callbacks); /* Initialize the Bluetooth Subsystem */ err = bt_enable(bt_ready); diff --git a/samples/boards/bbc_microbit/pong/src/ble.c b/samples/boards/bbc_microbit/pong/src/ble.c index f336d86b02..fd6811a407 100644 --- a/samples/boards/bbc_microbit/pong/src/ble.c +++ b/samples/boards/bbc_microbit/pong/src/ble.c @@ -271,7 +271,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason) } } -static struct bt_conn_cb conn_callbacks = { +BT_CONN_CB_DEFINE(conn_callbacks) = { .connected = connected, .disconnected = disconnected, }; @@ -534,7 +534,5 @@ void ble_init(void) k_work_init_delayable(&ble_work, ble_timeout); - bt_conn_cb_register(&conn_callbacks); - local_attr = &pong_svc.attrs[1]; } diff --git a/samples/boards/reel_board/mesh_badge/src/main.c b/samples/boards/reel_board/mesh_badge/src/main.c index 949ad28d1a..0d1cf0d7ab 100644 --- a/samples/boards/reel_board/mesh_badge/src/main.c +++ b/samples/boards/reel_board/mesh_badge/src/main.c @@ -142,7 +142,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason) } } -static struct bt_conn_cb conn_cb = { +BT_CONN_CB_DEFINE(conn_cb) = { .connected = connected, .disconnected = disconnected, }; @@ -164,7 +164,6 @@ static void bt_ready(int err) printk("Mesh initialized\n"); - bt_conn_cb_register(&conn_cb); bt_conn_auth_cb_register(&auth_cb); if (IS_ENABLED(CONFIG_SETTINGS)) { diff --git a/samples/subsys/mgmt/mcumgr/smp_svr/src/bluetooth.c b/samples/subsys/mgmt/mcumgr/smp_svr/src/bluetooth.c index a7cc6bae06..f67f4c221c 100644 --- a/samples/subsys/mgmt/mcumgr/smp_svr/src/bluetooth.c +++ b/samples/subsys/mgmt/mcumgr/smp_svr/src/bluetooth.c @@ -53,7 +53,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason) k_work_submit(&advertise_work); } -static struct bt_conn_cb conn_callbacks = { +BT_CONN_CB_DEFINE(conn_callbacks) = { .connected = connected, .disconnected = disconnected, }; @@ -82,8 +82,6 @@ void start_smp_bluetooth(void) return; } - bt_conn_cb_register(&conn_callbacks); - /* Initialize the Bluetooth mcumgr transport. */ smp_bt_register(); } diff --git a/subsys/bluetooth/shell/bt.c b/subsys/bluetooth/shell/bt.c index e08fa8a7fa..2bf7926ee6 100644 --- a/subsys/bluetooth/shell/bt.c +++ b/subsys/bluetooth/shell/bt.c @@ -418,7 +418,7 @@ void le_phy_updated(struct bt_conn *conn, } #endif -static struct bt_conn_cb conn_callbacks = { +BT_CONN_CB_DEFINE(conn_callbacks) = { .connected = connected, .disconnected = disconnected, .le_param_req = le_param_req, @@ -576,8 +576,6 @@ static void bt_ready(int err) #if defined(CONFIG_BT_CONN) default_conn = NULL; - - bt_conn_cb_register(&conn_callbacks); #endif /* CONFIG_BT_CONN */ #if defined(CONFIG_BT_PER_ADV_SYNC) diff --git a/subsys/bluetooth/shell/l2cap.c b/subsys/bluetooth/shell/l2cap.c index 8792b8fbb1..90d98f72d1 100644 --- a/subsys/bluetooth/shell/l2cap.c +++ b/subsys/bluetooth/shell/l2cap.c @@ -184,7 +184,7 @@ static void l2cap_whitelist_remove(struct bt_conn *conn, uint8_t reason) } } -static struct bt_conn_cb l2cap_conn_callbacks = { +BT_CONN_CB_DEFINE(l2cap_conn_callbacks) = { .disconnected = l2cap_whitelist_remove, }; @@ -268,8 +268,6 @@ static int cmd_register(const struct shell *shell, size_t argc, char *argv[]) server.psm = 0U; return -ENOEXEC; } else { - bt_conn_cb_register(&l2cap_conn_callbacks); - shell_print(shell, "L2CAP psm %u sec_level %u registered", server.psm, server.sec_level); } diff --git a/subsys/net/l2/bluetooth/bluetooth.c b/subsys/net/l2/bluetooth/bluetooth.c index 9e3a7579ef..1633ebe2c0 100644 --- a/subsys/net/l2/bluetooth/bluetooth.c +++ b/subsys/net/l2/bluetooth/bluetooth.c @@ -603,7 +603,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason) default_conn = NULL; } -static struct bt_conn_cb conn_callbacks = { +BT_CONN_CB_DEFINE(conn_callbacks) = { .connected = connected, .disconnected = disconnected, }; @@ -615,9 +615,6 @@ static int net_bt_init(const struct device *dev) NET_DBG("dev %p driver_data %p", dev, dev->data); -#if defined(CONFIG_NET_L2_BT_MGMT) - bt_conn_cb_register(&conn_callbacks); -#endif err = bt_l2cap_server_register(&server); if (err) { return err; diff --git a/tests/bluetooth/bsim_bt/bsim_test_advx/src/main.c b/tests/bluetooth/bsim_bt/bsim_test_advx/src/main.c index aacbd4a6e7..4cfabaee11 100644 --- a/tests/bluetooth/bsim_bt/bsim_test_advx/src/main.c +++ b/tests/bluetooth/bsim_bt/bsim_test_advx/src/main.c @@ -125,7 +125,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason) is_disconnected = true; } -static struct bt_conn_cb conn_callbacks = { +BT_CONN_CB_DEFINE(conn_callbacks) = { .connected = connected, .disconnected = disconnected, }; @@ -180,10 +180,6 @@ static void test_advx_main(void) } printk("success.\n"); - printk("Connection callbacks register..."); - bt_conn_cb_register(&conn_callbacks); - printk("success.\n"); - printk("Connectable advertising..."); err = bt_le_adv_start(BT_LE_ADV_CONN_NAME, ad, ARRAY_SIZE(ad), NULL, 0); if (err) { @@ -1203,10 +1199,6 @@ static void test_scanx_main(void) bt_le_scan_cb_register(&scan_callbacks); printk("success.\n"); - printk("Connection callbacks register..."); - bt_conn_cb_register(&conn_callbacks); - printk("success.\n"); - printk("Periodic Advertising callbacks register..."); bt_le_per_adv_sync_cb_register(&sync_cb); printk("Success.\n"); diff --git a/tests/bluetooth/bsim_bt/bsim_test_app/src/test_connect1.c b/tests/bluetooth/bsim_bt/bsim_test_app/src/test_connect1.c index 1642867505..2ca032c3ad 100644 --- a/tests/bluetooth/bsim_bt/bsim_test_app/src/test_connect1.c +++ b/tests/bluetooth/bsim_bt/bsim_test_app/src/test_connect1.c @@ -361,7 +361,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason) } } -static struct bt_conn_cb conn_callbacks = { +BT_CONN_CB_DEFINE(conn_callbacks) = { .connected = connected, .disconnected = disconnected, .le_param_updated = params_updated, @@ -380,8 +380,6 @@ static void test_con1_main(void) printk("Bluetooth initialized\n"); - bt_conn_cb_register(&conn_callbacks); - err = bt_le_scan_start(BT_LE_SCAN_ACTIVE, device_found); if (err) { diff --git a/tests/bluetooth/bsim_bt/bsim_test_app/src/test_connect2.c b/tests/bluetooth/bsim_bt/bsim_test_app/src/test_connect2.c index c01e96e005..e2cc6621bd 100644 --- a/tests/bluetooth/bsim_bt/bsim_test_app/src/test_connect2.c +++ b/tests/bluetooth/bsim_bt/bsim_test_app/src/test_connect2.c @@ -97,7 +97,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason) } } -static struct bt_conn_cb conn_callbacks = { +BT_CONN_CB_DEFINE(conn_callbacks) = { .connected = connected, .disconnected = disconnected, }; @@ -156,8 +156,6 @@ static void test_con2_main(void) bt_ready(); - bt_conn_cb_register(&conn_callbacks); - /* Implement notification. At the moment there is no suitable way * of starting delayed work so we do it here */ diff --git a/tests/bluetooth/bsim_bt/bsim_test_audio/src/mics_client_test.c b/tests/bluetooth/bsim_bt/bsim_test_audio/src/mics_client_test.c index cd1ae5ed01..e0e4e8b314 100644 --- a/tests/bluetooth/bsim_bt/bsim_test_audio/src/mics_client_test.c +++ b/tests/bluetooth/bsim_bt/bsim_test_audio/src/mics_client_test.c @@ -15,7 +15,6 @@ #define VOCS_DESC_SIZE 64 #define AICS_DESC_SIZE 64 -static struct bt_conn_cb conn_callbacks; extern enum bst_result_t bst_result; static struct bt_mics *mics; @@ -222,7 +221,7 @@ static void bt_ready(int err) g_bt_init = true; } -static struct bt_conn_cb conn_callbacks = { +BT_CONN_CB_DEFINE(conn_callbacks) = { .connected = connected, .disconnected = disconnected, }; @@ -390,7 +389,6 @@ static void test_main(void) return; } - bt_conn_cb_register(&conn_callbacks); bt_mics_client_cb_register(&mics_cbs); WAIT_FOR(g_bt_init); diff --git a/tests/bluetooth/bsim_bt/bsim_test_audio/src/mics_test.c b/tests/bluetooth/bsim_bt/bsim_test_audio/src/mics_test.c index 6eae104466..7773c157a2 100644 --- a/tests/bluetooth/bsim_bt/bsim_test_audio/src/mics_test.c +++ b/tests/bluetooth/bsim_bt/bsim_test_audio/src/mics_test.c @@ -137,7 +137,7 @@ static void connected(struct bt_conn *conn, uint8_t err) g_is_connected = true; } -static struct bt_conn_cb conn_callbacks = { +BT_CONN_CB_DEFINE(conn_callbacks) = { .connected = connected, .disconnected = disconnected, }; @@ -427,8 +427,6 @@ static void test_main(void) return; } - bt_conn_cb_register(&conn_callbacks); - err = bt_mics_included_get(mics, &mics_included); if (err != 0) { FAIL("MICS get failed (err %d)\n", err); diff --git a/tests/bluetooth/bsim_bt/bsim_test_audio/src/vcs_client_test.c b/tests/bluetooth/bsim_bt/bsim_test_audio/src/vcs_client_test.c index 33ff2f84af..a7b03ca75f 100644 --- a/tests/bluetooth/bsim_bt/bsim_test_audio/src/vcs_client_test.c +++ b/tests/bluetooth/bsim_bt/bsim_test_audio/src/vcs_client_test.c @@ -295,7 +295,7 @@ static void bt_ready(int err) g_bt_init = true; } -static struct bt_conn_cb conn_callbacks = { +BT_CONN_CB_DEFINE(conn_callbacks) = { .connected = connected, .disconnected = disconnected, }; @@ -560,8 +560,6 @@ static void test_main(void) return; } - bt_conn_cb_register(&conn_callbacks); - err = bt_vcs_client_cb_register(&vcs_cbs); if (err) { FAIL("CB register failed (err %d)\n", err); diff --git a/tests/bluetooth/bsim_bt/bsim_test_audio/src/vcs_test.c b/tests/bluetooth/bsim_bt/bsim_test_audio/src/vcs_test.c index 00efad1124..bb8c41d95a 100644 --- a/tests/bluetooth/bsim_bt/bsim_test_audio/src/vcs_test.c +++ b/tests/bluetooth/bsim_bt/bsim_test_audio/src/vcs_test.c @@ -201,7 +201,7 @@ static void connected(struct bt_conn *conn, uint8_t err) g_is_connected = true; } -static struct bt_conn_cb conn_callbacks = { +BT_CONN_CB_DEFINE(conn_callbacks) = { .connected = connected, .disconnected = disconnected, }; @@ -675,8 +675,6 @@ static void test_main(void) return; } - bt_conn_cb_register(&conn_callbacks); - err = bt_vcs_included_get(vcs, &vcs_included); if (err) { FAIL("VCS included get failed (err %d)\n", err); diff --git a/tests/bluetooth/bsim_bt/edtt_ble_test_app/gatt_test_app/src/main.c b/tests/bluetooth/bsim_bt/edtt_ble_test_app/gatt_test_app/src/main.c index 8bdf9ce9e9..977fbf1c4d 100644 --- a/tests/bluetooth/bsim_bt/edtt_ble_test_app/gatt_test_app/src/main.c +++ b/tests/bluetooth/bsim_bt/edtt_ble_test_app/gatt_test_app/src/main.c @@ -70,7 +70,7 @@ static void security_changed(struct bt_conn *conn, bt_security_t level, printk("Security changed: %s level %u\n", addr, level); } -static struct bt_conn_cb conn_callbacks = { +BT_CONN_CB_DEFINE(conn_callbacks) = { .connected = connected, .disconnected = disconnected, .security_changed = security_changed, @@ -335,7 +335,6 @@ void main(void) return; } - bt_conn_cb_register(&conn_callbacks); bt_conn_auth_cb_register(&auth_cb_display); /**