Skip to content

Commit

Permalink
Bluetooth: audio: ascs: Remove redundant ase_cleanup function
Browse files Browse the repository at this point in the history
This removes redundant ase_cleanup function, as bt_ascs_release_ase
can be called instead.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
  • Loading branch information
MariuszSkamra committed Jul 6, 2023
1 parent 0e0eb5c commit 88e8107
Showing 1 changed file with 2 additions and 25 deletions.
27 changes: 2 additions & 25 deletions subsys/bluetooth/audio/ascs.c
Original file line number Diff line number Diff line change
Expand Up @@ -2885,37 +2885,14 @@ int bt_ascs_init(const struct bt_bap_unicast_server_cb *cb)
return 0;
}

static void ase_cleanup(struct bt_ascs_ase *ase)
{
struct bt_bap_ascs_rsp rsp;
struct bt_bap_stream *stream;
enum bt_bap_ep_state state;

state = ascs_ep_get_state(&ase->ep);
if (state == BT_BAP_EP_STATE_IDLE || state == BT_BAP_EP_STATE_RELEASING) {
return;
}

stream = ase->ep.stream;
__ASSERT(stream != NULL, "ep.stream is NULL");

if (unicast_server_cb != NULL && unicast_server_cb->release != NULL) {
unicast_server_cb->release(stream, &rsp);
}

ascs_ep_set_state(&ase->ep, BT_BAP_EP_STATE_RELEASING);
}

void bt_ascs_cleanup(void)
{
for (size_t i = 0; i < ARRAY_SIZE(ase_pool); i++) {
struct bt_ascs_ase *ase = &ase_pool[i];

if (ase->conn == NULL) {
continue;
if (ase->conn != NULL) {
bt_ascs_release_ase(&ase->ep);
}

ase_cleanup(ase);
}

if (unicast_server_cb != NULL) {
Expand Down

0 comments on commit 88e8107

Please sign in to comment.