Linux bluetooth development
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: chen kris <bluefrog2012@gmail.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: Is it incorrect in checking of "NO_RESET" bit in hci_core.c:hci_dev_do_close()?
Date: Mon, 15 Oct 2012 20:02:07 +0200	[thread overview]
Message-ID: <1350324127.26318.0.camel@aeonflux> (raw)
In-Reply-To: <CACKG3X=Jky7m=gU7b=rPYOO1ZqQR_79fgoL-EQCYgog6wNZsLQ@mail.gmail.com>

Hi Chen,

> static int hci_dev_do_close(struct hci_dev *hdev)
> {
>     ...
> 
>     /* Reset device */
>     skb_queue_purge(&hdev->cmd_q);
>     atomic_set(&hdev->cmd_cnt, 1);
>     if (!test_bit(HCI_RAW, &hdev->flags) &&
>                 test_bit(HCI_QUIRK_NO_RESET, &hdev->quirks)) {
>         set_bit(HCI_INIT, &hdev->flags);
>         __hci_request(hdev, hci_reset_req, 0,
>                     msecs_to_jiffies(250));
>         clear_bit(HCI_INIT, &hdev->flags);
>     }
>     ...
> }
> 
> I guess the condition should be as following:
> 
>     if (!test_bit(HCI_RAW, &hdev->flags) &&
>                 *! *test_bit(HCI_QUIRK_NO_RESET, &hdev->quirks))
> 
> it means the code should sent HCI_RESET, only if both of the following
> conditions are met:
> 1. HCI_RAW is NOT set;
> 2. HCI_QUIRK_NO_RESET is *NOT* set.

the name is confusing, when closing the device and NO_RESET is set, then
it needs to send the HCI Reset.

Regards

Marcel



  reply	other threads:[~2012-10-15 18:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CACKG3XmHwTgbsWBwsckZ-tA5M9xBD0TBRme7mCJo7shd90L4=Q@mail.gmail.com>
2012-10-15 15:01 ` Is it incorrect in checking of "NO_RESET" bit in hci_core.c:hci_dev_do_close()? chen kris
2012-10-15 18:02   ` Marcel Holtmann [this message]
2012-10-15 18:09     ` Anderson Lizardo
2012-10-16  9:49       ` chen kris

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=1350324127.26318.0.camel@aeonflux \
    --to=marcel@holtmann.org \
    --cc=bluefrog2012@gmail.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