Skip to content

Commit c77d74f

Browse files
aescolarcarlescufi
authored andcommitted
Bluetooth: Classic: Shell: Use ZTESTABLE_STATIC instead of STATIC
Use the ZTESTABLE_STATIC macro to define symbols which need to be accessible from ztests, instead of redefining STATIC which causes trouble with some hals. Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
1 parent 2b51545 commit c77d74f

File tree

2 files changed

+10
-18
lines changed

2 files changed

+10
-18
lines changed

‎subsys/bluetooth/host/classic/shell/goep.c‎

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,7 @@
2727
#include "common/bt_shell_private.h"
2828

2929
#define GOEP_MOPL CONFIG_BT_GOEP_RFCOMM_MTU
30-
#ifdef CONFIG_ZTEST
31-
#define STATIC
32-
#else
33-
#define STATIC static
34-
#endif
30+
3531
NET_BUF_POOL_FIXED_DEFINE(tx_pool, CONFIG_BT_MAX_CONN, BT_RFCOMM_BUF_SIZE(GOEP_MOPL),
3632
CONFIG_BT_CONN_TX_USER_DATA_SIZE, NULL);
3733

@@ -45,17 +41,17 @@ struct bt_goep_app {
4541
struct net_buf *tx_buf;
4642
};
4743

48-
STATIC struct bt_goep_app goep_app;
44+
ZTESTABLE_STATIC struct bt_goep_app goep_app;
4945

5046
static struct bt_goep_transport_rfcomm_server rfcomm_server;
5147
static struct bt_goep_transport_l2cap_server l2cap_server;
5248

5349
#define TLV_COUNT 3
5450
#define TLV_BUFFER_SIZE 64
5551

56-
STATIC struct bt_obex_tlv tlvs[TLV_COUNT];
57-
STATIC uint8_t tlv_buffers[TLV_COUNT][TLV_BUFFER_SIZE];
58-
STATIC uint8_t tlv_count;
52+
ZTESTABLE_STATIC struct bt_obex_tlv tlvs[TLV_COUNT];
53+
ZTESTABLE_STATIC uint8_t tlv_buffers[TLV_COUNT][TLV_BUFFER_SIZE];
54+
ZTESTABLE_STATIC uint8_t tlv_count;
5955

6056
static struct bt_goep_app *goep_alloc(struct bt_conn *conn)
6157
{
@@ -184,7 +180,7 @@ static void goep_server_action(struct bt_obex_server *server, bool final, struct
184180
goep_parse_headers(buf);
185181
}
186182

187-
STATIC struct bt_obex_server_ops goep_server_ops = {
183+
ZTESTABLE_STATIC struct bt_obex_server_ops goep_server_ops = {
188184
.connect = goep_server_connect,
189185
.disconnect = goep_server_disconnect,
190186
.put = goep_server_put,
@@ -248,7 +244,7 @@ static void goep_client_action(struct bt_obex_client *client, uint8_t rsp_code,
248244
goep_parse_headers(buf);
249245
}
250246

251-
STATIC struct bt_obex_client_ops goep_client_ops = {
247+
ZTESTABLE_STATIC struct bt_obex_client_ops goep_client_ops = {
252248
.connect = goep_client_connect,
253249
.disconnect = goep_client_disconnect,
254250
.put = goep_client_put,

‎subsys/bluetooth/host/classic/shell/hfp.c‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,7 @@
2727
#include "common/bt_shell_private.h"
2828

2929
#define HELP_NONE "[none]"
30-
#ifdef CONFIG_ZTEST
31-
#define STATIC
32-
#else
33-
#define STATIC static
34-
#endif
30+
3531
extern struct bt_conn *default_conn;
3632

3733
#if defined(CONFIG_BT_HFP_HF)
@@ -316,7 +312,7 @@ void hf_query_call(struct bt_hfp_hf *hf, struct bt_hfp_hf_current_call *call)
316312
}
317313
#endif /* CONFIG_BT_HFP_HF_ECS */
318314

319-
STATIC struct bt_hfp_hf_cb hf_cb = {
315+
ZTESTABLE_STATIC struct bt_hfp_hf_cb hf_cb = {
320316
.connected = hf_connected,
321317
.disconnected = hf_disconnected,
322318
.sco_connected = hf_sco_connected,
@@ -1403,7 +1399,7 @@ void ag_hf_indicator_value(struct bt_hfp_ag *ag, enum hfp_ag_hf_indicators indic
14031399
bt_shell_print("indicator %d value %d", indicator, value);
14041400
}
14051401

1406-
STATIC struct bt_hfp_ag_cb ag_cb = {
1402+
ZTESTABLE_STATIC struct bt_hfp_ag_cb ag_cb = {
14071403
.connected = ag_connected,
14081404
.disconnected = ag_disconnected,
14091405
.sco_connected = ag_sco_connected,

0 commit comments

Comments
 (0)