From: Johan Hedberg <johan.hedberg@intel.com>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: Tedd Ho-Jeong An <tedd.an@intel.com>,
linux-bluetooth <linux-bluetooth@vger.kernel.org>,
don.fry@intel.com
Subject: Re: [RFC] Bluetooth: Add support for Intel Bluetooth device [8087:07dc]
Date: Thu, 11 Apr 2013 08:57:56 +0900 [thread overview]
Message-ID: <20130410235756.GA20270@x220> (raw)
In-Reply-To: <6C02E13F-AA1A-43B9-891F-8B42F9111DD8@holtmann.org>
Hi Marcel,
On Wed, Apr 10, 2013, Marcel Holtmann wrote:
> > + /* Send command based on the evt */
> > + if (evt->evt == HCI_EV_CMD_COMPLETE) {
> > + /* Command Complete Event */
> > + skb = __hci_cmd_sync(hdev, cmd->opcode, cmd->plen,
> > + (void *)param,
> > + HCI_INIT_TIMEOUT);
> > + if (IS_ERR(skb)) {
> > + BT_ERR("__hci_cmd_sync(patch): %ld",
> > + PTR_ERR(skb));
> > + m_off_code = m_off_1;
> > + goto exit_mfg;
> > + }
> > +
> > + /* Check the event status */
> > + if (skb->data[0]) {
> > + BT_ERR("%s patch failed(%02x)", hdev->name,
> > + skb->data[0]);
> > + m_off_code = m_off_1;
> > + kfree_skb(skb);
> > + goto exit_mfg;
> > + }
> > + } else {
> > + /* Non Command Complete Event */
> > + skb = __hci_cmd_sync_ev(hdev, cmd->opcode, cmd->plen,
> > + (void *)param, evt->evt,
> > + HCI_INIT_TIMEOUT);
> > + if (IS_ERR(skb)) {
> > + BT_ERR("__hci_cmd_sync_ev(patch): %ld",
> > + PTR_ERR(skb));
> > + m_off_code = m_off_1;
> > + goto exit_mfg;
> > + }
> > +
> > + /* Checking the returned event */
> > + if (memcmp(skb->data, evt_param, evt->plen)) {
> > + BT_ERR("%s patch event doesn't match!!",
> > + hdev->name);
> > + m_off_code = m_off_1;
> > + kfree_skb(skb);
> > + goto exit_mfg;
> > + }
> > + }
>
> Check if the __hci_cmd_sync_ev can just take HCI_EV_CMD_COMPLETE as
> event and it would work the same.
It should work but it does change the semantics of the function a bit.
When a non-zero "special" event is given __hci_cmd_sync_ev() assumes no
special knowledge of the contents of the event. This means that it
does not strip off the cmd_complete header, where as a value 0 (or using
__hci_cmd_sync) will strip off the cmd_complete header in the returned
skb so that it can be directly cast to the structs we have in hci.h.
Johan
prev parent reply other threads:[~2013-04-10 23:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-10 2:44 [RFC] Bluetooth: Add support for Intel Bluetooth device [8087:07dc] Tedd Ho-Jeong An
2013-04-10 15:40 ` Fry, Don
2013-04-10 16:23 ` Tedd Ho-Jeong An
2013-04-10 16:11 ` Marcel Holtmann
2013-04-10 16:34 ` Tedd Ho-Jeong An
2013-04-10 22:04 ` Johan Hedberg
2013-04-10 22:09 ` Marcel Holtmann
2013-04-11 19:35 ` Gustavo Padovan
2013-04-10 23:57 ` 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=20130410235756.GA20270@x220 \
--to=johan.hedberg@intel.com \
--cc=don.fry@intel.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=marcel@holtmann.org \
--cc=tedd.an@intel.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