All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Hedberg <johan.hedberg@gmail.com>
To: "João Paulo Rechi Vita" <jprvita@openbossa.org>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH BlueZ v6 03/11] core: Mutually exclude concurrent connections
Date: Thu, 20 Sep 2012 14:43:23 +0300	[thread overview]
Message-ID: <20120920114323.GA11861@x220> (raw)
In-Reply-To: <1347370387-17670-3-git-send-email-jprvita@openbossa.org>

Hi,

On Tue, Sep 11, 2012, João Paulo Rechi Vita wrote:
> Since controllers don't support more than one ongoing connection
> procedure at the same time, new connection attempts needs to yield if
> there is an ongoing connection procedure already.
> ---
>  src/adapter.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++--------
>  src/device.c  |  6 +++---
>  src/device.h  |  2 +-
>  3 files changed, 57 insertions(+), 12 deletions(-)

Couple of coding style things I'd like to get fixed in this one. Patches
1/11 and 2/11 have been already applied though so no need to resend
them.

> +	if (g_slist_length(adapter->connect_list))
> +		mgmt_start_discovery(adapter->dev_id);

Since you're not testing for a boolean I'd rather have a clear > 0 here.

>  	const char *path = adapter->path;
> +	guint connect_list_size;

Call this conn_list_len (to make it shorter and to match what the
function you get this value from is called)

> +	if (!adapter_has_discov_sessions(adapter) && !connect_list_size)
>  		return;

Again since conn_list_len is not a boolean I'd rather have a clear == 0.

> -	DBG("hci%u restarting discovery, disc_sessions %u", adapter->dev_id,
> -					g_slist_length(adapter->disc_sessions));
> +	DBG("hci%u restarting discovery: disc_sessions %u, connect_list size "
> +		"%u", adapter->dev_id, g_slist_length(adapter->disc_sessions),

Splitting strings like this is something that we really should try to
avoid. If you do the variable rename as I suggested you can get this on
the same line.

> +static gboolean clean_connecting_state(GIOChannel *io, GIOCondition cond, gpointer user_data)

Looks like a too long line to me.

> +	if (adapter->waiting_to_connect == 0 &&
> +					g_slist_length(adapter->connect_list))
> +		mgmt_start_discovery(adapter->dev_id);

Again > 0 here (which is especially strange that you didn't do it from
the start as in the first test you do use == 0).

> +	btd_device_unref(device);
> +	return FALSE;
> +}

Empty line before the return statement please.

> +	btd_device_unref(device);
>  	return FALSE;
>  }

Same here.

As a general note (not relating specifically to this patch) I'd like to
see a clearer split and naming of LE/GATT-specific functionality and
variables (function names, struct btd_adapter/device member naming &
grouping, etc.). Right now these seem to be sprinkled all over the place
which can be confusing for someone looking at the code from a
BR/EDR-only or LE-only perspective.

Johan

  reply	other threads:[~2012-09-20 11:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-11 13:32 [PATCH BlueZ v6 01/11] core: Control connections based on adapter state João Paulo Rechi Vita
2012-09-11 13:32 ` [PATCH BlueZ v6 02/11] core: Use adapter connect list for LE connections João Paulo Rechi Vita
2012-09-11 13:32 ` [PATCH BlueZ v6 03/11] core: Mutually exclude concurrent connections João Paulo Rechi Vita
2012-09-20 11:43   ` Johan Hedberg [this message]
2012-09-25 17:37     ` Joao Paulo Rechi Vita
2012-09-11 13:33 ` [PATCH BlueZ v6 04/11] mgmt: Add LE scanning callback João Paulo Rechi Vita
2012-09-11 13:33 ` [PATCH BlueZ v6 05/11] core: Replace interleaved by LE scanning João Paulo Rechi Vita
2012-09-11 13:33 ` [PATCH BlueZ v6 06/11] core: Start LE scanning when a device requests João Paulo Rechi Vita
2012-09-11 13:33 ` [PATCH BlueZ v6 07/11] core: Queue discovery if scanning is active João Paulo Rechi Vita
2012-09-11 13:33 ` [PATCH BlueZ v6 08/11] core: Disable unnecessary auto connections João Paulo Rechi Vita
2012-09-11 13:33 ` [PATCH BlueZ v6 09/11] core: Re-connect for ECONNRESET or ECONNABORTED João Paulo Rechi Vita
2012-09-11 13:33 ` [PATCH BlueZ v6 10/11] mgmt: Add address type to bonding debug message João Paulo Rechi Vita
2012-09-11 13:33 ` [PATCH BlueZ v6 11/11] core: Suspend scanning before connect on pairing João Paulo Rechi Vita

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=20120920114323.GA11861@x220 \
    --to=johan.hedberg@gmail.com \
    --cc=jprvita@openbossa.org \
    --cc=linux-bluetooth@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.