linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hedberg <johan.hedberg@gmail.com>
To: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] Bluetooth: Power the device up after a rfkill unblock
Date: Sun, 26 Aug 2012 10:28:02 +0300	[thread overview]
Message-ID: <20120826072802.GA32318@x220> (raw)
In-Reply-To: <1345838290-26796-1-git-send-email-vinicius.gomes@openbossa.org>

Hi Vinicius,

On Fri, Aug 24, 2012, Vinicius Costa Gomes wrote:
> With the HCI_SETUP patches, this is all that is needed to make the
> case when a adapter is added with Bluetooth blocked in rfkill to work.
> 
> When rfkill is unblocked, the device will be powered on if the device
> is in HCI_SETUP state, meaning that it was never properly initialized.
> If the device is not used by userspace, the HCI_AUTO_OFF flag will
> take care of powering it off.
> 
> Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
> ---
>  net/bluetooth/hci_core.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> index fa974a1..ef69d8b 100644
> --- a/net/bluetooth/hci_core.c
> +++ b/net/bluetooth/hci_core.c
> @@ -1061,8 +1061,10 @@ static int hci_rfkill_set_block(void *data, bool blocked)
>  
>  	BT_DBG("%p name %s blocked %d", hdev, hdev->name, blocked);
>  
> -	if (!blocked)
> +	if (!blocked && test_bit(HCI_SETUP, &hdev->dev_flags)) {
> +		schedule_work(&hdev->power_on);
>  		return 0;
> +	}
>  
>  	hci_dev_do_close(hdev);

This still isn't right. Now you'd be calling hci_dev_do_close() when
unblocking a device that doesn't have HCI_SETUP set. The test_bit needs
to be inside the if-branch. Btw, this all implies that you're not
properly testing your patches. Please always do that.

Johan

      reply	other threads:[~2012-08-26  7:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-22 19:33 [PATCH 1/2] Bluetooth: mgmt: Fix sending events with uninitialized data Vinicius Costa Gomes
2012-08-22 19:33 ` [PATCH 2/2] Bluetooth: Power the device up after a rfkill unblock Vinicius Costa Gomes
2012-08-24 12:28   ` Johan Hedberg
2012-08-24 13:32     ` Vinicius Costa Gomes
2012-08-24 19:58     ` [PATCH] " Vinicius Costa Gomes
2012-08-26  7:28       ` 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=20120826072802.GA32318@x220 \
    --to=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=vinicius.gomes@openbossa.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).