linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hedberg <johan.hedberg@gmail.com>
To: "Frédéric Danis" <frederic.danis@linux.intel.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH v13 02/14] audio: Move telephony drivers to D-Bus interface
Date: Wed, 18 Jul 2012 14:51:01 +0300	[thread overview]
Message-ID: <20120718115101.GA15775@x220.ger.corp.intel.com> (raw)
In-Reply-To: <1342532440-730-3-git-send-email-frederic.danis@linux.intel.com>

Hi Frédéric,

On Tue, Jul 17, 2012, Frédéric Danis wrote:
> @@ -1397,42 +817,26 @@ void headset_connect_cb(GIOChannel *chan, GError *err, gpointer user_data)
>  	else
>  		hs->auto_dc = FALSE;
>  
> -	g_io_add_watch(chan, G_IO_IN | G_IO_ERR | G_IO_HUP| G_IO_NVAL,
> -			(GIOFunc) rfcomm_io_cb, dev);
> +	agent = telephony_agent_by_uuid(device_get_adapter(dev->btd_dev),
> +						hs->connecting_uuid);
> +	slc = telephony_device_connecting(chan, dev->btd_dev, dev, agent);

> +		if (dev->headset->slc)  {
> +			telephony_device_disconnect(dev->headset->slc->slc);
> +			dev->headset->slc->slc = NULL;

headset->slc->slc?

You better rethink the naming of some of these variables.

> +#include "btio.h"
> +#include "log.h"
> +#include "device.h"
> +#include "error.h"
> +#include "glib-helper.h"
> +#include "sdp-client.h"
> +#include "headset.h"
> +#include "telephony.h"
> +#include "dbus-common.h"
> +#include "../src/adapter.h"
> +#include "../src/device.h"

Please sort the includes so that high-level ones come first (i.e.
btio/*.h src/*.h etc). It'll save you from some trouble later and it's
also consistent with how we've tried to keep the rest of the source
tree.

> +struct tel_device {
> +	void			*au_dev;

Just use the right type here, i.e. struct audio_device. You're already
including device.h where it's defined so that should not cause you
trouble.

> +void *telephony_device_connecting(GIOChannel *io, struct btd_device *btd_dev,
> +					void *telephony_device, void *agent)

Please use proper types for the return value, telephony_device and
agent. Don't hide these types where not necessary as it will make it
impossible for the compiler to catch type errors. It's particularly
confusing in this case since the variable you're calling
telephony_device is actually of type struct audio_device (and not struct
tel_device).

If some struct (like struct tel_device) is missing just add a forward
declaration for it (without the full definition) to the relevant .h file
(telephony.h in this case) if you want to keep it opaque.

> +	dev = g_new0(struct tel_device, 1);
> +	dev->btd_dev = btd_dev;

Looks like missing reference counting here, i.e. btd_device_ref(). Also
add an unref to the appropriate place.

> +void telephony_device_connected(void *telephony_device)

No need to use void * here, just use struct tel_device (which wont be a
problem if you add the necessary forward declaration to telephony.h).

> +void telephony_device_disconnect(void *slc)

Same here. Why do you call the variable slc if it doesn't represent an
SLC (it represents a device object).

> +void telephony_device_disconnected(void *telephony_device)

Same here.

> +gboolean telephony_get_ready_state(void *adapter)

And here.

> +static int register_interface(void *adapter)

And here.

> +static void unregister_interface(void *adapter)

And here.

> +int telephony_adapter_init(void *adapter)

And here.

> +void telephony_adapter_exit(void *adapter)

And here.

Johan

  reply	other threads:[~2012-07-18 11:51 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-17 13:40 [PATCH v13 00/14] Add org.bluez.Telephony interface Frédéric Danis
2012-07-17 13:40 ` [PATCH v13 01/14] doc: Add telephony interface documents Frédéric Danis
2012-07-17 13:40 ` [PATCH v13 02/14] audio: Move telephony drivers to D-Bus interface Frédéric Danis
2012-07-18 11:51   ` Johan Hedberg [this message]
2012-07-17 13:40 ` [PATCH v13 03/14] audio: Simplify org.bluez.Headset Frédéric Danis
2012-07-18 12:02   ` Johan Hedberg
2012-07-17 13:40 ` [PATCH v13 04/14] audio: Remove dummy telephony driver Frédéric Danis
2012-07-17 13:40 ` [PATCH v13 05/14] audio: Remove maemo5 " Frédéric Danis
2012-07-17 13:40 ` [PATCH v13 06/14] audio: Remove maemo6 " Frédéric Danis
2012-07-17 13:40 ` [PATCH v13 07/14] audio: Remove oFono " Frédéric Danis
2012-07-17 13:40 ` [PATCH v13 08/14] audio: Move HFP/HSP AG servers to telephony.c Frédéric Danis
2012-07-17 13:40 ` [PATCH v13 09/14] audio: Send transport path to telephony agent Frédéric Danis
2012-07-17 13:40 ` [PATCH v13 10/14] audio: Move HFP HF server to telephony.c Frédéric Danis
2012-07-18 11:54   ` Johan Hedberg
2012-07-17 13:40 ` [PATCH v13 11/14] audio: Replace headset and gateway by telephony Frédéric Danis
2012-07-17 13:40 ` [PATCH v13 12/14] audio: Add DUN GW to org.bluez.Telephony Frédéric Danis
2012-07-18 11:58   ` Johan Hedberg
2012-07-17 13:40 ` [PATCH v13 13/14] audio: Add SAP " Frédéric Danis
2012-07-17 13:40 ` [PATCH v13 14/14] audio: Add fast connectable to telephony interface Frédéric Danis
2012-07-18 11:59   ` 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=20120718115101.GA15775@x220.ger.corp.intel.com \
    --to=johan.hedberg@gmail.com \
    --cc=frederic.danis@linux.intel.com \
    --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).