From: "Gustavo F. Padovan" <padovan@profusion.mobi>
To: Szymon Janc <szymon.janc@tieto.com>
Cc: "linux-bluetooth@vger.kernel.org"
<linux-bluetooth@vger.kernel.org>,
"mmvinni@yahoo.com" <mmvinni@yahoo.com>,
"justinmattock@gmail.com" <justinmattock@gmail.com>,
"edt@aei.ca" <edt@aei.ca>
Subject: Re: [PATCH] Bluetooth: Fix HCI_RESET command syncronization
Date: Thu, 17 Mar 2011 13:48:40 -0300 [thread overview]
Message-ID: <20110317164840.GA2214@joana> (raw)
In-Reply-To: <201103171135.20477.szymon.janc@tieto.com>
Hi Szymon,
* Szymon Janc <szymon.janc@tieto.com> [2011-03-17 11:35:20 +0100]:
> > We can't send new commands before a cmd_complete for the HCI_RESET commnnd
>
> Typo: comm*a*nd
>
> > shows up.
> >
> > Reported-by: Mikko Vinni <mmvinni@yahoo.com>
> > Reported-by: Justin P. Mattock <justinmattock@gmail.com>
> > Reported-by: Ed Tomlinson <edt@aei.ca>
> > Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
> > ---
> > include/net/bluetooth/hci.h | 2 ++
> > net/bluetooth/hci_core.c | 3 +++
> > net/bluetooth/hci_event.c | 4 +++-
> > 3 files changed, 8 insertions(+), 1 deletions(-)
> >
> > diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
> > index ec6acf2..2c0d309 100644
> > --- a/include/net/bluetooth/hci.h
> > +++ b/include/net/bluetooth/hci.h
> > @@ -84,6 +84,8 @@ enum {
> > HCI_SERVICE_CACHE,
> > HCI_LINK_KEYS,
> > HCI_DEBUG_KEYS,
> > +
> > + HCI_RESET,
> > };
> >
> > /* HCI ioctl defines */
> > diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> > index b372fb8..32b82e2 100644
> > --- a/net/bluetooth/hci_core.c
> > +++ b/net/bluetooth/hci_core.c
> > @@ -534,6 +534,8 @@ int hci_dev_open(__u16 dev)
> > set_bit(HCI_INIT, &hdev->flags);
> > hdev->init_last_cmd = 0;
> >
> > + set_bit(HCI_RESET, &hdev->flags);
>
> Does this work with HCI_QUIRK_NO_RESET enabled?
> Shouldn't this bit be set only right before sending HCI_OP_RESET
> (in hci_init_req and hci_reset_req) for doing what commit msg says?
>
> Now it looks more like a workaround for initialization issue..
Ah yes, I fixed this as well now.
>
> > +
> > ret = __hci_request(hdev, hci_init_req, 0,
> > msecs_to_jiffies(HCI_INIT_TIMEOUT));
> >
> > @@ -1074,6 +1076,7 @@ static void hci_cmd_timer(unsigned long arg)
> >
> > BT_ERR("%s command tx timeout", hdev->name);
> > atomic_set(&hdev->cmd_cnt, 1);
> > + clear_bit(HCI_RESET, &hdev->flags);
> > tasklet_schedule(&hdev->cmd_task);
> > }
> >
> > diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
> > index 3fbfa50..cebe7588 100644
> > --- a/net/bluetooth/hci_event.c
> > +++ b/net/bluetooth/hci_event.c
> > @@ -183,6 +183,8 @@ static void hci_cc_reset(struct hci_dev *hdev, struct sk_buff *skb)
> >
> > BT_DBG("%s status 0x%x", hdev->name, status);
> >
> > + clear_bit(HCI_RESET, &hdev->flags);
> > +
> > hci_req_complete(hdev, HCI_OP_RESET, status);
> > }
> >
> > @@ -1847,7 +1849,7 @@ static inline void hci_cmd_status_evt(struct hci_dev *hdev, struct sk_buff *skb)
> > if (ev->opcode != HCI_OP_NOP)
> > del_timer(&hdev->cmd_timer);
> >
> > - if (ev->ncmd) {
> > + if (ev->ncmd && !test_bit(HCI_RESET, &hdev->flags)) {
> > atomic_set(&hdev->cmd_cnt, 1);
> > if (!skb_queue_empty(&hdev->cmd_q))
> > tasklet_schedule(&hdev->cmd_task);
>
> Maybe use unlikely() here?
We don't use this in Bluetooth.
--
Gustavo F. Padovan
http://profusion.mobi
prev parent reply other threads:[~2011-03-17 16:48 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-28 22:29 re "bluetooth disabled" and "[BUG] usb problems in .38-rc3+" Mikko Vinni
2011-03-01 5:51 ` Justin Mattock
2011-03-02 14:00 ` Johan Hedberg
2011-03-03 10:54 ` Mikko Vinni
2011-03-03 14:31 ` Johan Hedberg
2011-03-04 4:47 ` Ville Tervo
2011-03-07 19:50 ` Mikko Vinni
2011-03-08 22:30 ` Justin P. Mattock
2011-03-09 21:23 ` Justin P. Mattock
2011-03-10 2:54 ` Ed Tomlinson
2011-03-10 7:32 ` Johan Hedberg
2011-03-10 18:02 ` Justin P. Mattock
2011-03-12 1:33 ` Gustavo F. Padovan
2011-03-12 17:44 ` Justin P. Mattock
2011-03-16 18:44 ` [PATCH] Bluetooth: Fix HCI_RESET command syncronization Gustavo F. Padovan
2011-03-16 18:46 ` Gustavo F. Padovan
2011-03-16 18:48 ` Anderson Lizardo
2011-03-16 19:01 ` Gustavo F. Padovan
2011-03-16 19:11 ` Justin P. Mattock
2011-03-16 19:15 ` Gustavo F. Padovan
2011-03-16 20:02 ` Justin Mattock
2011-03-16 21:13 ` Mikko Vinni
2011-03-16 22:33 ` Ed Tomlinson
2011-03-17 10:35 ` Szymon Janc
2011-03-17 16:48 ` Gustavo F. Padovan [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=20110317164840.GA2214@joana \
--to=padovan@profusion.mobi \
--cc=edt@aei.ca \
--cc=justinmattock@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=mmvinni@yahoo.com \
--cc=szymon.janc@tieto.com \
/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).