Re: [PATCH 1/4] Fix headset disconnecting via device disconnect

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux