linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hedberg <johan.hedberg@gmail.com>
To: Anderson Lizardo <anderson.lizardo@openbossa.org>
Cc: linux-bluetooth@vger.kernel.org,
	Bruna Moreira <bruna.moreira@openbossa.org>
Subject: Re: [PATCH 3/7] Refactoring adapter_update_found_devices() function
Date: Thu, 11 Nov 2010 12:01:58 +0200	[thread overview]
Message-ID: <20101111100158.GE4132@jh-x301> (raw)
In-Reply-To: <1289411487-6113-3-git-send-email-anderson.lizardo@openbossa.org>

Hi,

On Wed, Nov 10, 2010, Anderson Lizardo wrote:
> +void adapter_update_found_devices(struct btd_adapter *adapter, bdaddr_t *bdaddr,
> +				int8_t rssi, uint32_t class, const char *name,
> +				const char *alias, gboolean legacy,
> +				name_status_t name_status, uint8_t *eir_data)
> +{
> +	struct remote_dev_info *dev;
> +
> +	if (!update_found_devices(adapter, bdaddr, rssi, &dev)) {
> +		dev->class = class;
> +		if (name)
> +			dev->name = g_strdup(name);
> +		if (alias)
> +			dev->alias = g_strdup(alias);
> +		dev->legacy = legacy;
> +		dev->name_status = name_status;
> +	} else if (dev->rssi == rssi)
> +		return;

I find the name and signature of update_found_devices() a little bit
unintuitive which makes following the code that uses it a bit hard.
Additionally it seems you're not using the rssi anymore within the
update_found_devices function so there's no point in passing the rssi to
it. To make the code more readable, could you change the function so
that its usage would look something like:

	struct remote_dev_info *dev;
	gboolean new_dev;

	dev = get_found_dev(adapter, bdaddr, &new_dev);

	if (new_dev) {
		<set the fields for the new device>
	} else if (dev->rssi == rssi)
		return;

	dev->rssi = rssi;
	...

Since the rest of the patches seem to depend on this one I'll stop the
review here and wait until you fix the issues I've mentioned so far.

Johan

  reply	other threads:[~2010-11-11 10:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-10 17:51 [PATCH 1/7] Fix invalid memory access when EIR field length is zero Anderson Lizardo
2010-11-10 17:51 ` [PATCH 2/7] Refactor get_eir_uuids() to get EIR data length parameter Anderson Lizardo
2010-11-11  9:42   ` Johan Hedberg
2010-11-10 17:51 ` [PATCH 3/7] Refactoring adapter_update_found_devices() function Anderson Lizardo
2010-11-11 10:01   ` Johan Hedberg [this message]
2010-11-10 17:51 ` [PATCH 4/7] Initial advertising data parsing implementation Anderson Lizardo
2010-11-10 17:51 ` [PATCH 5/7] Advertising data: extract local name Anderson Lizardo
2010-11-10 17:51 ` [PATCH 6/7] Extract service UUIDs from advertising data Anderson Lizardo
2010-11-10 17:51 ` [PATCH 7/7] Emit "DeviceFound" signal for LE devices Anderson Lizardo
2010-11-11  9:35 ` [PATCH 1/7] Fix invalid memory access when EIR field length is zero Johan Hedberg

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=20101111100158.GE4132@jh-x301 \
    --to=johan.hedberg@gmail.com \
    --cc=anderson.lizardo@openbossa.org \
    --cc=bruna.moreira@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).