Bluetooth: Read LE Advertising Channel TX Power only when available
authorMarcel Holtmann <marcel@holtmann.org>
Sat, 12 Jul 2014 21:20:50 +0000 (23:20 +0200)
committerJohan Hedberg <johan.hedberg@intel.com>
Sun, 13 Jul 2014 05:49:04 +0000 (08:49 +0300)
The Read LE Advertising Channel TX Power command is not mandatory for
a Bluetooth HCI controller only supporting receiption. Move the command
to the third stage of the controller initialization and only execute it
when support for it has been indicated.

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

index 347f84fb66f9238be8106d78a24d081315e2a3cd..b29a984f7dd46922195d860557d9c6b427a49741 100644 (file)
@@ -1348,9 +1348,6 @@ static void le_setup(struct hci_request *req)
        /* Read LE Supported States */
        hci_req_add(req, HCI_OP_LE_READ_SUPPORTED_STATES, 0, NULL);
 
-       /* Read LE Advertising Channel TX Power */
-       hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);
-
        /* Read LE White List Size */
        hci_req_add(req, HCI_OP_LE_READ_WHITE_LIST_SIZE, 0, NULL);
 
@@ -1657,6 +1654,11 @@ static void hci_init3_req(struct hci_request *req, unsigned long opt)
                hci_req_add(req, HCI_OP_LE_SET_EVENT_MASK, sizeof(events),
                            events);
 
+               if (hdev->commands[25] & 0x40) {
+                       /* Read LE Advertising Channel TX Power */
+                       hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);
+               }
+
                hci_set_le_support(req);
        }