]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
Bluetooth: btintel: Define a macro for Intel Reset vendor command
authorKiran K <kiran.k@intel.com>
Fri, 11 Jul 2025 10:07:25 +0000 (15:37 +0530)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Wed, 23 Jul 2025 14:31:03 +0000 (10:31 -0400)
Use macro for Intel Reset command (0xfc01) instead of hard coded value.

Signed-off-by: Kiran K <kiran.k@intel.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
drivers/bluetooth/btintel.c
drivers/bluetooth/btintel.h
drivers/bluetooth/btintel_pcie.c
drivers/bluetooth/btusb.c
drivers/bluetooth/hci_intel.c

index d02d5791e0da3a92cd98e750df3ff43169405882..be69d21c9aa7432e0c01179ac79709bbe99e4e42 100644 (file)
@@ -889,7 +889,7 @@ int btintel_send_intel_reset(struct hci_dev *hdev, u32 boot_param)
 
        params.boot_param = cpu_to_le32(boot_param);
 
-       skb = __hci_cmd_sync(hdev, 0xfc01, sizeof(params), &params,
+       skb = __hci_cmd_sync(hdev, BTINTEL_HCI_OP_RESET, sizeof(params), &params,
                             HCI_INIT_TIMEOUT);
        if (IS_ERR(skb)) {
                bt_dev_err(hdev, "Failed to send Intel Reset command");
@@ -1287,7 +1287,7 @@ static void btintel_reset_to_bootloader(struct hci_dev *hdev)
        params.boot_option = 0x00;
        params.boot_param = cpu_to_le32(0x00000000);
 
-       skb = __hci_cmd_sync(hdev, 0xfc01, sizeof(params),
+       skb = __hci_cmd_sync(hdev, BTINTEL_HCI_OP_RESET, sizeof(params),
                             &params, HCI_INIT_TIMEOUT);
        if (IS_ERR(skb)) {
                bt_dev_err(hdev, "FW download error recovery failed (%ld)",
index 1d12c4113c669ea334ce98a5beab0b8ac13ca515..431998049e686bffba98e6a0dd433a8aa2835206 100644 (file)
@@ -52,6 +52,8 @@ struct intel_tlv {
        u8 val[];
 } __packed;
 
+#define BTINTEL_HCI_OP_RESET   0xfc01
+
 #define BTINTEL_CNVI_BLAZARI           0x900
 #define BTINTEL_CNVI_BLAZARIW          0x901
 #define BTINTEL_CNVI_GAP               0x910
index ce59a98f1b6aad51efa94a818360adc0295323b2..60528bdc4316feb4b302988d2b2b7e54a3968ce9 100644 (file)
@@ -1977,12 +1977,12 @@ static int btintel_pcie_send_frame(struct hci_dev *hdev,
                        struct hci_command_hdr *cmd = (void *)skb->data;
                        __u16 opcode = le16_to_cpu(cmd->opcode);
 
-                       /* When the 0xfc01 command is issued to boot into
-                        * the operational firmware, it will actually not
-                        * send a command complete event. To keep the flow
+                       /* When the BTINTEL_HCI_OP_RESET command is issued to
+                        * boot into the operational firmware, it will actually
+                        * not send a command complete event. To keep the flow
                         * control working inject that event here.
                         */
-                       if (opcode == 0xfc01)
+                       if (opcode == BTINTEL_HCI_OP_RESET)
                                btintel_pcie_inject_cmd_complete(hdev, opcode);
                }
                /* Firmware raises alive interrupt on HCI_OP_RESET */
@@ -2017,10 +2017,10 @@ static int btintel_pcie_send_frame(struct hci_dev *hdev,
        }
 
        if (type == BTINTEL_PCIE_HCI_CMD_PKT &&
-           (opcode == HCI_OP_RESET || opcode == 0xfc01)) {
+           (opcode == HCI_OP_RESET || opcode == BTINTEL_HCI_OP_RESET)) {
                old_ctxt = data->alive_intr_ctxt;
                data->alive_intr_ctxt =
-                       (opcode == 0xfc01 ? BTINTEL_PCIE_INTEL_HCI_RESET1 :
+                       (opcode == BTINTEL_HCI_OP_RESET ? BTINTEL_PCIE_INTEL_HCI_RESET1 :
                                BTINTEL_PCIE_HCI_RESET);
                bt_dev_dbg(data->hdev, "sent cmd: 0x%4.4x alive context changed: %s  ->  %s",
                           opcode, btintel_pcie_alivectxt_state2str(old_ctxt),
index 128596ecc8889b6dd44ee7e142d0d3489c477602..2dd665bc5703bae3a14d8dd3ab6d1f86e01cc559 100644 (file)
@@ -2605,12 +2605,12 @@ static int btusb_send_frame_intel(struct hci_dev *hdev, struct sk_buff *skb)
                        else
                                urb = alloc_ctrl_urb(hdev, skb);
 
-                       /* When the 0xfc01 command is issued to boot into
-                        * the operational firmware, it will actually not
-                        * send a command complete event. To keep the flow
+                       /* When the BTINTEL_HCI_OP_RESET command is issued to
+                        * boot into the operational firmware, it will actually
+                        * not send a command complete event. To keep the flow
                         * control working inject that event here.
                         */
-                       if (opcode == 0xfc01)
+                       if (opcode == BTINTEL_HCI_OP_RESET)
                                inject_cmd_complete(hdev, opcode);
                } else {
                        urb = alloc_ctrl_urb(hdev, skb);
index d22fbb7f9fc5e1c6778698677a7e05d81d5f095f..9b353c3d6442105074d7abe8011e084a7e3a171b 100644 (file)
@@ -1029,12 +1029,12 @@ static struct sk_buff *intel_dequeue(struct hci_uart *hu)
                struct hci_command_hdr *cmd = (void *)skb->data;
                __u16 opcode = le16_to_cpu(cmd->opcode);
 
-               /* When the 0xfc01 command is issued to boot into
-                * the operational firmware, it will actually not
-                * send a command complete event. To keep the flow
-                * control working inject that event here.
+               /* When the BTINTEL_HCI_OP_RESET command is issued to boot into
+                * the operational firmware, it will actually not send a command
+                * complete event. To keep the flow control working inject that
+                * event here.
                 */
-               if (opcode == 0xfc01)
+               if (opcode == BTINTEL_HCI_OP_RESET)
                        inject_cmd_complete(hu->hdev, opcode);
        }