From: Johan Hedberg <johan.hedberg@nokia.com>
To: Radoslaw Jablonski <ext-jablonski.radoslaw@nokia.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 1/4] Fix headset disconnecting via device disconnect
Date: Wed, 22 Sep 2010 22:22:58 +0300 [thread overview]
Message-ID: <20100922192258.GA20756@jh-x301> (raw)
In-Reply-To: <1285162521-21997-1-git-send-email-ext-jablonski.radoslaw@nokia.com>
Hi Radek,
On Wed, Sep 22, 2010, Radoslaw Jablonski wrote:
> +static void disconnect_cb(struct btd_device *btd_dev, gboolean removal,
> + void *user_data)
> +{
> + struct audio_device *dev = user_data;
> + struct dev_priv *priv = dev->priv;
> +
> + if (priv->state == AUDIO_STATE_DISCONNECTED)
> + return;
> +
> + if (priv->disconnecting)
> + return;
> +
> + priv->disconnecting = TRUE;
> +
> + if (dev->control) {
> + device_remove_control_timer(dev);
> + avrcp_disconnect(dev);
> + }
> +
> + if (dev->sink && priv->sink_state != SINK_STATE_DISCONNECTED)
> + sink_shutdown(dev->sink);
> +
> + if (priv->hs_state != HEADSET_STATE_DISCONNECTED)
> + headset_shutdown(dev);
> +
> + priv->disconnecting = FALSE;
> +}
I'd prefer if you keep the behaviour of disconnect_cb roughly the same
as dev_disconnect. I.e. set the flag, disconnect either HFP or A2DP and
then let the state callbacks do the right thing. The way you're using
the new priv->disconnecting flag doesn't seem to make sense here. The
idea of having a flag would be to do the right thing in the asynchronous
state callbacks but you're setting it back to FALSE before returning
from the function which seems to defeat that purpose.
About the other patches, since the existing profile specific callbacks
could mess up the logic together with the new callback I'm fine with a
single patch which adds the new and removes the old callbacks.
Johan
prev parent reply other threads:[~2010-09-22 19:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-22 13:35 [PATCH 1/4] Fix headset disconnecting via device disconnect Radoslaw Jablonski
2010-09-22 13:35 ` [PATCH 2/4] Remove unnecessary disconnect callback from headset.c Radoslaw Jablonski
2010-09-22 13:35 ` [PATCH 3/4] Remove unnecessary disconnect callback from sink.c Radoslaw Jablonski
2010-09-22 13:35 ` [PATCH 4/4] Remove unnecessary disconnect callback from source.c Radoslaw Jablonski
2010-09-22 19:22 ` Johan Hedberg [this message]
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=20100922192258.GA20756@jh-x301 \
--to=johan.hedberg@nokia.com \
--cc=ext-jablonski.radoslaw@nokia.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).