Bluetooth: Fix stand-alone HCI command handling
authorJohan Hedberg <johan.hedberg@intel.com>
Tue, 5 Mar 2013 18:37:47 +0000 (20:37 +0200)
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>
Fri, 8 Mar 2013 13:40:26 +0000 (10:40 -0300)
To have a consistent content for hdev->cmd_q all entries need to follow
the semantics of asynchronous HCI requests. This means that even single
commands need to be dressed as requests by having a request start
indicator. This patch adds these indicators to the two places needing
it (hci_send_cmd and hci_sock_sendmsg).

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
net/bluetooth/hci_core.c
net/bluetooth/hci_sock.c

index 6e6a9dd8a1557a66a10d15c74dc170cde6029bc0..4f8142bdf6558c8f791c5129b8332d25c03b73f1 100644 (file)
@@ -2511,6 +2511,11 @@ int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, void *param)
        if (test_bit(HCI_INIT, &hdev->flags))
                hdev->init_last_cmd = opcode;
 
+       /* Stand-alone HCI commands must be flaged as
+        * single-command requests.
+        */
+       bt_cb(skb)->req.start = true;
+
        skb_queue_tail(&hdev->cmd_q, skb);
        queue_work(hdev->workqueue, &hdev->cmd_work);
 
index ec044d31f79cdad9e300a8f555377e7d3acf41d8..aa4354fca77c76b2282f81d86114c2698088d273 100644 (file)
@@ -854,6 +854,11 @@ static int hci_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
                        skb_queue_tail(&hdev->raw_q, skb);
                        queue_work(hdev->workqueue, &hdev->tx_work);
                } else {
+                       /* Stand-alone HCI commands must be flaged as
+                        * single-command requests.
+                        */
+                       bt_cb(skb)->req.start = true;
+
                        skb_queue_tail(&hdev->cmd_q, skb);
                        queue_work(hdev->workqueue, &hdev->cmd_work);
                }