Commit 50928fc5 authored by Pavel Vasilyev's avatar Pavel Vasilyev Committed by Benjamin Cabé
Browse files

bluetooth: host: remove bt_ prefix from internal functions

Remove the bt_ prefix from internal functions to avoid confusion when
reading code.

Signed-off-by: default avatarPavel Vasilyev <pavel.vasilyev@nordicsemi.no>
parent dfe05dd0
Loading
Loading
Loading
Loading
+2 −2
Changes for subsys/bluetooth/host/adv.c: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -888,7 +888,7 @@ static void le_adv_stop_free_conn(const struct bt_le_ext_adv *adv, uint8_t statu
	}
}

static int bt_le_adv_start_legacy(struct bt_le_ext_adv *adv,
static int adv_start_legacy(struct bt_le_ext_adv *adv,
			   const struct bt_le_adv_param *param,
			   const struct bt_data *ad, size_t ad_len,
			   const struct bt_data *sd, size_t sd_len)
@@ -1309,7 +1309,7 @@ int bt_le_adv_start(const struct bt_le_adv_param *param,
	    BT_DEV_FEAT_LE_EXT_ADV(bt_dev.le.features)) {
		err = bt_le_adv_start_ext(adv, param, ad, ad_len, sd, sd_len);
	} else {
		err = bt_le_adv_start_legacy(adv, param, ad, ad_len, sd, sd_len);
		err = adv_start_legacy(adv, param, ad, ad_len, sd, sd_len);
	}

	if (err) {
+24 −24
Changes for subsys/bluetooth/host/att.c: 24 added lines, 24 removed lines.
Original line number Diff line number Diff line
@@ -194,7 +194,7 @@ static k_tid_t att_handle_rsp_thread;

static struct bt_att_tx_meta_data tx_meta_data_storage[CONFIG_BT_ATT_TX_COUNT];

static struct bt_att_tx_meta_data *bt_att_get_tx_meta_data(const struct net_buf *buf);
static struct bt_att_tx_meta_data *att_get_tx_meta_data(const struct net_buf *buf);
static void att_on_sent_cb(struct bt_att_tx_meta_data *meta);

#if defined(CONFIG_BT_ATT_ERR_TO_STR)
@@ -255,7 +255,7 @@ const char *bt_att_err_to_str(uint8_t att_err)

static void att_tx_destroy(struct net_buf *buf)
{
	struct bt_att_tx_meta_data *p_meta = bt_att_get_tx_meta_data(buf);
	struct bt_att_tx_meta_data *p_meta = att_get_tx_meta_data(buf);
	struct bt_att_tx_meta_data meta;

	LOG_DBG("%p", buf);
@@ -289,7 +289,7 @@ NET_BUF_POOL_DEFINE(att_pool, CONFIG_BT_ATT_TX_COUNT,
		    BT_L2CAP_SDU_BUF_SIZE(BT_ATT_BUF_SIZE),
		    CONFIG_BT_CONN_TX_USER_DATA_SIZE, att_tx_destroy);

static struct bt_att_tx_meta_data *bt_att_get_tx_meta_data(const struct net_buf *buf)
static struct bt_att_tx_meta_data *att_get_tx_meta_data(const struct net_buf *buf)
{
	__ASSERT_NO_MSG(net_buf_pool_get(buf->pool_id) == &att_pool);

@@ -304,7 +304,7 @@ static int bt_att_chan_send(struct bt_att_chan *chan, struct net_buf *buf);
static void att_chan_mtu_updated(struct bt_att_chan *updated_chan);
static void bt_att_disconnected(struct bt_l2cap_chan *chan);

static struct net_buf *bt_att_create_rsp_pdu(struct bt_att_chan *chan, uint8_t op);
static struct net_buf *att_create_rsp_pdu(struct bt_att_chan *chan, uint8_t op);

static void att_disconnect(struct bt_att_chan *chan)
{
@@ -340,7 +340,7 @@ static int chan_send(struct bt_att_chan *chan, struct net_buf *buf)
	struct bt_att_hdr *hdr;
	struct net_buf_simple_state state;
	int err;
	struct bt_att_tx_meta_data *data = bt_att_get_tx_meta_data(buf);
	struct bt_att_tx_meta_data *data = att_get_tx_meta_data(buf);
	struct bt_att_chan *prev_chan = data->att_chan;

	hdr = (void *)buf->data;
@@ -461,7 +461,7 @@ static struct net_buf *get_first_buf_matching_chan(struct k_fifo *fifo, struct b
		k_fifo_init(&skipped);

		while ((buf = k_fifo_get(fifo, K_NO_WAIT))) {
			meta = bt_att_get_tx_meta_data(buf);
			meta = att_get_tx_meta_data(buf);
			if (!ret &&
			    att_chan_matches_chan_opt(chan, meta->chan_opt)) {
				ret = buf;
@@ -491,7 +491,7 @@ static struct bt_att_req *get_first_req_matching_chan(sys_slist_t *reqs, struct
		struct bt_att_tx_meta_data *meta = NULL;

		SYS_SLIST_FOR_EACH_NODE(reqs, curr) {
			meta = bt_att_get_tx_meta_data(ATT_REQ(curr)->buf);
			meta = att_get_tx_meta_data(ATT_REQ(curr)->buf);
			if (att_chan_matches_chan_opt(chan, meta->chan_opt)) {
				break;
			}
@@ -755,7 +755,7 @@ static struct net_buf *bt_att_chan_create_pdu(struct bt_att_chan *chan, uint8_t
	/* If we got a buf from `att_pool`, then the metadata slot at its index
	 * is officially ours to use.
	 */
	data = bt_att_get_tx_meta_data(buf);
	data = att_get_tx_meta_data(buf);

	if (IS_ENABLED(CONFIG_BT_EATT)) {
		net_buf_reserve(buf, BT_L2CAP_SDU_BUF_SIZE(0));
@@ -775,7 +775,7 @@ static int bt_att_chan_send(struct bt_att_chan *chan, struct net_buf *buf)
		((struct bt_att_hdr *)buf->data)->code);

	if (IS_ENABLED(CONFIG_BT_EATT) &&
	    !att_chan_matches_chan_opt(chan, bt_att_get_tx_meta_data(buf)->chan_opt)) {
	    !att_chan_matches_chan_opt(chan, att_get_tx_meta_data(buf)->chan_opt)) {
		return -EINVAL;
	}

@@ -867,7 +867,7 @@ static uint8_t att_mtu_req(struct bt_att_chan *chan, struct net_buf *buf)
		return BT_ATT_ERR_INVALID_PDU;
	}

	pdu = bt_att_create_rsp_pdu(chan, BT_ATT_OP_MTU_RSP);
	pdu = att_create_rsp_pdu(chan, BT_ATT_OP_MTU_RSP);
	if (!pdu) {
		return BT_ATT_ERR_UNLIKELY;
	}
@@ -1107,7 +1107,7 @@ static uint8_t att_find_info_rsp(struct bt_att_chan *chan, uint16_t start_handle

	(void)memset(&data, 0, sizeof(data));

	data.buf = bt_att_create_rsp_pdu(chan, BT_ATT_OP_FIND_INFO_RSP);
	data.buf = att_create_rsp_pdu(chan, BT_ATT_OP_FIND_INFO_RSP);
	if (!data.buf) {
		return BT_ATT_ERR_INSUFFICIENT_RESOURCES;
	}
@@ -1261,7 +1261,7 @@ static uint8_t att_find_type_rsp(struct bt_att_chan *chan, uint16_t start_handle

	(void)memset(&data, 0, sizeof(data));

	data.buf = bt_att_create_rsp_pdu(chan, BT_ATT_OP_FIND_TYPE_RSP);
	data.buf = att_create_rsp_pdu(chan, BT_ATT_OP_FIND_TYPE_RSP);
	if (!data.buf) {
		return BT_ATT_ERR_INSUFFICIENT_RESOURCES;
	}
@@ -1511,7 +1511,7 @@ static uint8_t att_read_type_rsp(struct bt_att_chan *chan, struct bt_uuid *uuid,

	(void)memset(&data, 0, sizeof(data));

	data.buf = bt_att_create_rsp_pdu(chan, BT_ATT_OP_READ_TYPE_RSP);
	data.buf = att_create_rsp_pdu(chan, BT_ATT_OP_READ_TYPE_RSP);
	if (!data.buf) {
		return BT_ATT_ERR_INSUFFICIENT_RESOURCES;
	}
@@ -1663,7 +1663,7 @@ static uint8_t att_read_rsp(struct bt_att_chan *chan, uint8_t op, uint8_t rsp,

	(void)memset(&data, 0, sizeof(data));

	data.buf = bt_att_create_rsp_pdu(chan, rsp);
	data.buf = att_create_rsp_pdu(chan, rsp);
	if (!data.buf) {
		return BT_ATT_ERR_INSUFFICIENT_RESOURCES;
	}
@@ -1736,7 +1736,7 @@ static uint8_t att_read_mult_req(struct bt_att_chan *chan, struct net_buf *buf)

	(void)memset(&data, 0, sizeof(data));

	data.buf = bt_att_create_rsp_pdu(chan, BT_ATT_OP_READ_MULT_RSP);
	data.buf = att_create_rsp_pdu(chan, BT_ATT_OP_READ_MULT_RSP);
	if (!data.buf) {
		return BT_ATT_ERR_INSUFFICIENT_RESOURCES;
	}
@@ -1840,7 +1840,7 @@ static uint8_t att_read_mult_vl_req(struct bt_att_chan *chan, struct net_buf *bu

	(void)memset(&data, 0, sizeof(data));

	data.buf = bt_att_create_rsp_pdu(chan, BT_ATT_OP_READ_MULT_VL_RSP);
	data.buf = att_create_rsp_pdu(chan, BT_ATT_OP_READ_MULT_VL_RSP);
	if (!data.buf) {
		return BT_ATT_ERR_INSUFFICIENT_RESOURCES;
	}
@@ -1962,7 +1962,7 @@ static uint8_t att_read_group_rsp(struct bt_att_chan *chan, struct bt_uuid *uuid

	(void)memset(&data, 0, sizeof(data));

	data.buf = bt_att_create_rsp_pdu(chan, BT_ATT_OP_READ_GROUP_RSP);
	data.buf = att_create_rsp_pdu(chan, BT_ATT_OP_READ_GROUP_RSP);
	if (!data.buf) {
		return BT_ATT_ERR_INSUFFICIENT_RESOURCES;
	}
@@ -2276,7 +2276,7 @@ static uint8_t att_prep_write_rsp(struct bt_att_chan *chan, uint16_t handle,
	net_buf_slist_put(&chan->att->prep_queue, data.buf);

	/* Generate response */
	data.buf = bt_att_create_rsp_pdu(chan, BT_ATT_OP_PREPARE_WRITE_RSP);
	data.buf = att_create_rsp_pdu(chan, BT_ATT_OP_PREPARE_WRITE_RSP);
	if (!data.buf) {
		return BT_ATT_ERR_INSUFFICIENT_RESOURCES;
	}
@@ -2423,7 +2423,7 @@ static uint8_t att_exec_write_rsp(struct bt_att_chan *chan, uint8_t flags)
	}

	/* Generate response */
	buf = bt_att_create_rsp_pdu(chan, BT_ATT_OP_EXEC_WRITE_RSP);
	buf = att_create_rsp_pdu(chan, BT_ATT_OP_EXEC_WRITE_RSP);
	if (!buf) {
		return BT_ATT_ERR_UNLIKELY;
	}
@@ -3064,7 +3064,7 @@ struct net_buf *bt_att_create_pdu(struct bt_conn *conn, uint8_t op, size_t len)
	return NULL;
}

static struct net_buf *bt_att_create_rsp_pdu(struct bt_att_chan *chan, uint8_t op)
static struct net_buf *att_create_rsp_pdu(struct bt_att_chan *chan, uint8_t op)
{
	size_t headroom;
	struct bt_att_hdr *hdr;
@@ -3085,7 +3085,7 @@ static struct net_buf *bt_att_create_rsp_pdu(struct bt_att_chan *chan, uint8_t o

	net_buf_reserve(buf, headroom);

	data = bt_att_get_tx_meta_data(buf);
	data = att_get_tx_meta_data(buf);
	data->att_chan = chan;

	hdr = net_buf_add(buf, sizeof(*hdr));
@@ -4133,7 +4133,7 @@ bool bt_att_out_of_sync_sent_on_fixed(struct bt_conn *conn)
void bt_att_set_tx_meta_data(struct net_buf *buf, bt_gatt_complete_func_t func, void *user_data,
			     enum bt_att_chan_opt chan_opt)
{
	struct bt_att_tx_meta_data *data = bt_att_get_tx_meta_data(buf);
	struct bt_att_tx_meta_data *data = att_get_tx_meta_data(buf);

	data->func = func;
	data->user_data = user_data;
@@ -4143,7 +4143,7 @@ void bt_att_set_tx_meta_data(struct net_buf *buf, bt_gatt_complete_func_t func,

void bt_att_increment_tx_meta_data_attr_count(struct net_buf *buf, uint16_t attr_count)
{
	struct bt_att_tx_meta_data *data = bt_att_get_tx_meta_data(buf);
	struct bt_att_tx_meta_data *data = att_get_tx_meta_data(buf);

	data->attr_count += attr_count;
}
@@ -4151,7 +4151,7 @@ void bt_att_increment_tx_meta_data_attr_count(struct net_buf *buf, uint16_t attr
bool bt_att_tx_meta_data_match(const struct net_buf *buf, bt_gatt_complete_func_t func,
			       const void *user_data, enum bt_att_chan_opt chan_opt)
{
	const struct bt_att_tx_meta_data *meta = bt_att_get_tx_meta_data(buf);
	const struct bt_att_tx_meta_data *meta = att_get_tx_meta_data(buf);

	return ((meta->func == func) &&
		(meta->user_data == user_data) &&
+7 −7
Changes for subsys/bluetooth/host/gatt.c: 7 added lines, 7 removed lines.
Original line number Diff line number Diff line
@@ -1118,9 +1118,9 @@ static bool is_host_managed_ccc(const struct bt_gatt_attr *attr)
}

#if defined(CONFIG_BT_SETTINGS)
static int bt_gatt_store_ccc(uint8_t id, const bt_addr_le_t *addr);
static int gatt_store_ccc(uint8_t id, const bt_addr_le_t *addr);
#else
static int bt_gatt_store_ccc(uint8_t id, const bt_addr_le_t *addr)
static int gatt_store_ccc(uint8_t id, const bt_addr_le_t *addr)
{
	/* This function shall never be used without CONFIG_BT_SETTINGS. */
	__ASSERT_NO_MSG(false);
@@ -1178,7 +1178,7 @@ static void bt_gatt_identity_resolved(struct bt_conn *conn, const bt_addr_le_t *

	/* Store the ccc */
	if (is_bonded) {
		bt_gatt_store_ccc(conn->id, &conn->le.dst);
		gatt_store_ccc(conn->id, &conn->le.dst);
	}

	/* Update the cf addresses and store it if we get a match */
@@ -1196,7 +1196,7 @@ static void bt_gatt_pairing_complete(struct bt_conn *conn, bool bonded)
{
	if (bonded) {
		/* Store the ccc and cf data */
		bt_gatt_store_ccc(conn->id, &(conn->le.dst));
		gatt_store_ccc(conn->id, &(conn->le.dst));
		bt_gatt_store_cf(conn->id, &conn->le.dst);
	}
}
@@ -1511,7 +1511,7 @@ static void gatt_store_ccc_cf(uint8_t id, const bt_addr_le_t *peer_addr)
		if (!IS_ENABLED(CONFIG_BT_SETTINGS_CCC_STORE_ON_WRITE) ||
		    (IS_ENABLED(CONFIG_BT_SETTINGS_CCC_STORE_ON_WRITE) && el &&
		     atomic_test_and_clear_bit(el->flags, DELAYED_STORE_CCC))) {
			bt_gatt_store_ccc(id, peer_addr);
			gatt_store_ccc(id, peer_addr);
		}

		if (!IS_ENABLED(CONFIG_BT_SETTINGS_CF_STORE_ON_WRITE) ||
@@ -1696,7 +1696,7 @@ static void gatt_unregister_ccc(struct bt_gatt_ccc_managed_user_data *ccc)

			if (IS_ENABLED(CONFIG_BT_SETTINGS) && store &&
			    bt_le_bond_exists(cfg->id, &cfg->peer)) {
				bt_gatt_store_ccc(cfg->id, &cfg->peer);
				gatt_store_ccc(cfg->id, &cfg->peer);
			}

			clear_ccc_cfg(cfg);
@@ -6166,7 +6166,7 @@ static uint8_t ccc_save(const struct bt_gatt_attr *attr, uint16_t handle,
	return BT_GATT_ITER_CONTINUE;
}

static int bt_gatt_store_ccc(uint8_t id, const bt_addr_le_t *addr)
static int gatt_store_ccc(uint8_t id, const bt_addr_le_t *addr)
{
	struct ccc_save save;
	size_t len;
+25 −27
Changes for subsys/bluetooth/host/l2cap.c: 25 added lines, 27 removed lines.
Original line number Diff line number Diff line
@@ -200,11 +200,10 @@ const char *bt_l2cap_chan_state_str(bt_l2cap_chan_state_t state)

#if defined(CONFIG_BT_L2CAP_DYNAMIC_CHANNEL)
#if defined(CONFIG_BT_L2CAP_LOG_LEVEL_DBG)
#define bt_l2cap_chan_set_state(_chan, _state) \
	bt_l2cap_chan_set_state_debug(_chan, _state, __func__, __LINE__)
#define l2cap_chan_set_state(_chan, _state) \
	l2cap_chan_set_state_debug(_chan, _state, __func__, __LINE__)

static void bt_l2cap_chan_set_state_debug(struct bt_l2cap_chan *chan,
				   bt_l2cap_chan_state_t state,
static void l2cap_chan_set_state_debug(struct bt_l2cap_chan *chan, bt_l2cap_chan_state_t state,
				       const char *func, int line)
{
	struct bt_l2cap_le_chan *le_chan = BT_L2CAP_LE_CHAN(chan);
@@ -247,8 +246,7 @@ static void bt_l2cap_chan_set_state_debug(struct bt_l2cap_chan *chan,
	le_chan->state = state;
}
#else
static void bt_l2cap_chan_set_state(struct bt_l2cap_chan *chan,
			     bt_l2cap_chan_state_t state)
static void l2cap_chan_set_state(struct bt_l2cap_chan *chan, bt_l2cap_chan_state_t state)
{
	BT_L2CAP_LE_CHAN(chan)->state = state;
}
@@ -257,7 +255,7 @@ static void bt_l2cap_chan_set_state(struct bt_l2cap_chan *chan,

static void cancel_data_ready(struct bt_l2cap_le_chan *lechan);
static bool chan_has_data(struct bt_l2cap_le_chan *lechan);
static void bt_l2cap_chan_del(struct bt_l2cap_chan *chan)
static void l2cap_chan_del(struct bt_l2cap_chan *chan)
{
	const struct bt_l2cap_chan_ops *ops = chan->ops;
	struct bt_l2cap_le_chan *le_chan = BT_L2CAP_LE_CHAN(chan);
@@ -287,7 +285,7 @@ static void bt_l2cap_chan_del(struct bt_l2cap_chan *chan)
destroy:
#if defined(CONFIG_BT_L2CAP_DYNAMIC_CHANNEL)
	/* Reset internal members of common channel */
	bt_l2cap_chan_set_state(chan, BT_L2CAP_DISCONNECTED);
	l2cap_chan_set_state(chan, BT_L2CAP_DISCONNECTED);
	BT_L2CAP_LE_CHAN(chan)->psm = 0U;
#endif
	if (chan->destroy) {
@@ -308,11 +306,11 @@ static void l2cap_rtx_timeout(struct k_work *work)
	LOG_ERR("chan %p timeout", chan);

	bt_l2cap_chan_remove(conn, &chan->chan);
	bt_l2cap_chan_del(&chan->chan);
	l2cap_chan_del(&chan->chan);

	/* Remove other channels if pending on the same ident */
	while ((chan = l2cap_remove_ident(conn, chan->ident, chan->pending_req))) {
		bt_l2cap_chan_del(&chan->chan);
		l2cap_chan_del(&chan->chan);
	}
}

@@ -392,7 +390,7 @@ static bool l2cap_chan_add(struct bt_conn *conn, struct bt_l2cap_chan *chan,
	if (L2CAP_LE_CID_IS_DYN(le_chan->rx.cid)) {
		k_work_init(&le_chan->rx_work, l2cap_rx_process);
		k_fifo_init(&le_chan->rx_queue);
		bt_l2cap_chan_set_state(chan, BT_L2CAP_CONNECTING);
		l2cap_chan_set_state(chan, BT_L2CAP_CONNECTING);
	}
#endif /* CONFIG_BT_L2CAP_DYNAMIC_CHANNEL */

@@ -454,7 +452,7 @@ void bt_l2cap_disconnected(struct bt_conn *conn)
	}

	SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&conn->channels, chan, next, node) {
		bt_l2cap_chan_del(chan);
		l2cap_chan_del(chan);
	}
}

@@ -662,7 +660,7 @@ static void l2cap_le_encrypt_change(struct bt_l2cap_chan *chan, uint8_t status)
	return;
fail:
	bt_l2cap_chan_remove(chan->conn, chan);
	bt_l2cap_chan_del(chan);
	l2cap_chan_del(chan);
}
#endif /* CONFIG_BT_L2CAP_DYNAMIC_CHANNEL */

@@ -1450,7 +1448,7 @@ static uint16_t l2cap_chan_accept(struct bt_conn *conn,
	le_chan->psm = server->psm;

	/* Update state */
	bt_l2cap_chan_set_state(*chan, BT_L2CAP_CONNECTED);
	l2cap_chan_set_state(*chan, BT_L2CAP_CONNECTED);

	return BT_L2CAP_LE_SUCCESS;
}
@@ -1900,7 +1898,7 @@ static void le_disconn_req(struct bt_l2cap *l2cap, uint8_t ident,
	rsp->dcid = sys_cpu_to_le16(chan->rx.cid);
	rsp->scid = sys_cpu_to_le16(chan->tx.cid);

	bt_l2cap_chan_del(&chan->chan);
	l2cap_chan_del(&chan->chan);

	l2cap_send_sig(conn, buf);
}
@@ -1993,7 +1991,7 @@ static void le_ecred_conn_rsp(struct bt_l2cap *l2cap, uint8_t ident,
				return;
			}
			bt_l2cap_chan_remove(conn, &chan->chan);
			bt_l2cap_chan_del(&chan->chan);
			l2cap_chan_del(&chan->chan);
		}
		break;
	case BT_L2CAP_LE_SUCCESS:
@@ -2012,7 +2010,7 @@ static void le_ecred_conn_rsp(struct bt_l2cap *l2cap, uint8_t ident,
			if (buf->len < sizeof(dcid)) {
				LOG_ERR("Fewer dcid values than expected");
				bt_l2cap_chan_remove(conn, &chan->chan);
				bt_l2cap_chan_del(&chan->chan);
				l2cap_chan_del(&chan->chan);
				continue;
			}

@@ -2027,7 +2025,7 @@ static void le_ecred_conn_rsp(struct bt_l2cap *l2cap, uint8_t ident,
			 */
			if (dcid == 0U) {
				bt_l2cap_chan_remove(conn, &chan->chan);
				bt_l2cap_chan_del(&chan->chan);
				l2cap_chan_del(&chan->chan);
				continue;
			} else if (!L2CAP_LE_CID_IS_DYN(dcid) ||
				   !IN_RANGE(mtu, BT_L2CAP_ECRED_MIN_MTU, BT_L2CAP_MAX_MTU) ||
@@ -2051,7 +2049,7 @@ static void le_ecred_conn_rsp(struct bt_l2cap *l2cap, uint8_t ident,
				 * not used.
				 */
				bt_l2cap_chan_remove(conn, &chan->chan);
				bt_l2cap_chan_del(&chan->chan);
				l2cap_chan_del(&chan->chan);
				bt_l2cap_chan_disconnect(c);
				continue;
			}
@@ -2065,7 +2063,7 @@ static void le_ecred_conn_rsp(struct bt_l2cap *l2cap, uint8_t ident,
			chan->tx.mps = mps;

			/* Update state */
			bt_l2cap_chan_set_state(&chan->chan,
			l2cap_chan_set_state(&chan->chan,
						BT_L2CAP_CONNECTED);

			if (chan->chan.ops->connected) {
@@ -2081,7 +2079,7 @@ static void le_ecred_conn_rsp(struct bt_l2cap *l2cap, uint8_t ident,
	case BT_L2CAP_LE_ERR_PSM_NOT_SUPP:
	default:
		while ((chan = l2cap_remove_ident(conn, ident, BT_L2CAP_ECRED_CONN_REQ))) {
			bt_l2cap_chan_del(&chan->chan);
			l2cap_chan_del(&chan->chan);
		}
		break;
	}
@@ -2157,7 +2155,7 @@ static void le_conn_rsp(struct bt_l2cap *l2cap, uint8_t ident,
		chan->tx.mps = mps;

		/* Update state */
		bt_l2cap_chan_set_state(&chan->chan, BT_L2CAP_CONNECTED);
		l2cap_chan_set_state(&chan->chan, BT_L2CAP_CONNECTED);

		if (chan->chan.ops->connected) {
			chan->chan.ops->connected(&chan->chan);
@@ -2176,7 +2174,7 @@ static void le_conn_rsp(struct bt_l2cap *l2cap, uint8_t ident,
		bt_l2cap_chan_remove(conn, &chan->chan);
		__fallthrough;
	default:
		bt_l2cap_chan_del(&chan->chan);
		l2cap_chan_del(&chan->chan);
	}
}

@@ -2213,7 +2211,7 @@ static void le_disconn_rsp(struct bt_l2cap *l2cap, uint8_t ident,
		return;
	}

	bt_l2cap_chan_del(&chan->chan);
	l2cap_chan_del(&chan->chan);
}

static void le_credits(struct bt_l2cap *l2cap, uint8_t ident,
@@ -2273,7 +2271,7 @@ static void reject_cmd(struct bt_l2cap *l2cap, uint8_t ident,
	struct bt_l2cap_le_chan *chan;

	while ((chan = l2cap_remove_ident(conn, ident, ANY_OPCODE))) {
		bt_l2cap_chan_del(&chan->chan);
		l2cap_chan_del(&chan->chan);
	}
}
#endif /* CONFIG_BT_L2CAP_DYNAMIC_CHANNEL */
@@ -2987,7 +2985,7 @@ static int l2cap_le_connect(struct bt_conn *conn, struct bt_l2cap_le_chan *ch,

fail:
	bt_l2cap_chan_remove(conn, &ch->chan);
	bt_l2cap_chan_del(&ch->chan);
	l2cap_chan_del(&ch->chan);
	return err;
}

@@ -3310,7 +3308,7 @@ int bt_l2cap_chan_disconnect(struct bt_l2cap_chan *chan)
	req->scid = sys_cpu_to_le16(le_chan->rx.cid);

	l2cap_chan_send_req(chan, buf, L2CAP_DISC_TIMEOUT);
	bt_l2cap_chan_set_state(chan, BT_L2CAP_DISCONNECTING);
	l2cap_chan_set_state(chan, BT_L2CAP_DISCONNECTING);

	return 0;
}