Linux bluetooth development
 help / color / mirror / Atom feed
From: "Ziyang Xuan (William)" <william.xuanziyang@huawei.com>
To: Vlad Pruteanu <vlad.pruteanu@nxp.com>, <linux-bluetooth@vger.kernel.org>
Cc: <claudia.rosu@nxp.com>, <mihai-octavian.urzica@nxp.com>,
	<silviu.barbulescu@nxp.com>, <iulia.tanasescu@nxp.com>,
	<andrei.istodorescu@nxp.com>
Subject: Re: [PATCH BlueZ v2 1/1] bap: Use defer setup when syncing to a BIS source
Date: Mon, 11 Sep 2023 15:04:53 +0800	[thread overview]
Message-ID: <9971ad4e-e07d-9d63-2bb0-ec9ae4e0db5c@huawei.com> (raw)
In-Reply-To: <20230911061624.30600-2-vlad.pruteanu@nxp.com>

> This commit uses the newly added bt_io_bcast_accept function from
> btio.c to implement the defer setup for the BIS sync process.
> Now, information from the BIG Info advertising report can be
> used when sending the BIG Create Sync command.
> ---
>  profiles/audio/bap.c | 18 +++++++++++++++++-
>  1 file changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
> index ee90426b9..8a2da24dd 100644
> --- a/profiles/audio/bap.c
> +++ b/profiles/audio/bap.c
> @@ -840,6 +840,22 @@ drop:
>  
>  }
>  
> +static void iso_pa_sync_confirm_cb(GIOChannel *io, void *user_data)
> +{
> +	GError *err = NULL;
> +
> +	if (!bt_io_bcast_accept(io, iso_bcast_confirm_cb,
> +				user_data, NULL, &err)) {
> +		error("bt_io_bcast_accept: %s", err->message);
> +		g_error_free(err);
> +		goto drop;
> +	}
> +	return;
> +
> +drop:
> +	g_io_channel_shutdown(io, TRUE, NULL);
> +}
Maybe we do not need goto. It's can be more concise as following:

static void iso_pa_sync_confirm_cb(GIOChannel *io, void *user_data)
{
	GError *err = NULL;

	if (!bt_io_bcast_accept(io, iso_bcast_confirm_cb,
				user_data, NULL, &err)) {
		error("bt_io_bcast_accept: %s", err->message);
		g_error_free(err);
		g_io_channel_shutdown(io, TRUE, NULL);
	}
}

or

static void iso_pa_sync_confirm_cb(GIOChannel *io, void *user_data)
{
	GError *err = NULL;

	if (bt_io_bcast_accept(io, iso_bcast_confirm_cb,
				user_data, NULL, &err)) {
		return;
	}

	error("bt_io_bcast_accept: %s", err->message);
	g_error_free(err);
	g_io_channel_shutdown(io, TRUE, NULL);
}


William Xuan
> +
>  static bool match_data_bap_data(const void *data, const void *match_data)
>  {
>  	const struct bap_data *bdata = data;
> @@ -1587,7 +1603,7 @@ static void bap_listen_io_broadcast(struct bap_data *data, struct bap_ep *ep,
>  	if (bt_bap_stream_get_io(stream) || data->listen_io)
>  		return;
>  
> -	io = bt_io_listen(iso_bcast_confirm_cb, NULL, ep->data, NULL, &err,
> +	io = bt_io_listen(NULL, iso_pa_sync_confirm_cb, ep->data, NULL, &err,
>  			BT_IO_OPT_SOURCE_BDADDR,
>  			btd_adapter_get_address(ep->data->adapter),
>  			BT_IO_OPT_DEST_BDADDR,
> 

  reply	other threads:[~2023-09-11  7:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-11  6:16 [PATCH BlueZ v2 0/1] bap: Use defer setup when syncing to a BIS source Vlad Pruteanu
2023-09-11  6:16 ` [PATCH BlueZ v2 1/1] " Vlad Pruteanu
2023-09-11  7:04   ` Ziyang Xuan (William) [this message]
2023-09-11  8:39     ` Vlad Pruteanu
2023-09-11  7:40   ` bluez.test.bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9971ad4e-e07d-9d63-2bb0-ec9ae4e0db5c@huawei.com \
    --to=william.xuanziyang@huawei.com \
    --cc=andrei.istodorescu@nxp.com \
    --cc=claudia.rosu@nxp.com \
    --cc=iulia.tanasescu@nxp.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=mihai-octavian.urzica@nxp.com \
    --cc=silviu.barbulescu@nxp.com \
    --cc=vlad.pruteanu@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox