Bluetooth: Store supported commands only during setup procedure
authorMarcel Holtmann <marcel@holtmann.org>
Thu, 31 Oct 2013 11:54:33 +0000 (04:54 -0700)
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>
Wed, 4 Dec 2013 13:09:03 +0000 (11:09 -0200)
The list of supported commands of a controller can not change during
its lifetime. So store the list just once during the setup procedure
and not every time the HCI command is executed.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
net/bluetooth/hci_event.c

index d75d51f..4d0f401 100644 (file)
@@ -486,7 +486,10 @@ static void hci_cc_read_local_commands(struct hci_dev *hdev,
 
        BT_DBG("%s status 0x%2.2x", hdev->name, rp->status);
 
 
        BT_DBG("%s status 0x%2.2x", hdev->name, rp->status);
 
-       if (!rp->status)
+       if (rp->status)
+               return;
+
+       if (test_bit(HCI_SETUP, &hdev->dev_flags))
                memcpy(hdev->commands, rp->commands, sizeof(hdev->commands));
 }
 
                memcpy(hdev->commands, rp->commands, sizeof(hdev->commands));
 }