[PATCH] Bluetooth: btrtl: reuse define enumeration values

From: Andrey Skvortsov
Date: Thu Sep 14 2023 - 16:44:39 EST


rtlbt_parse_firmware function sets project_id defined like unnamed
integer constant. But later in the code (btrtl_set_quirks) project_id
is compared against values in btrtl_chip_id enumeration.

Signed-off-by: Andrey Skvortsov <andrej.skvortzov@xxxxxxxxx>
---
drivers/bluetooth/btrtl.c | 31 ++++++++++++++++---------------
1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
index 84c2c2e1122f..018d86410b88 100644
--- a/drivers/bluetooth/btrtl.c
+++ b/drivers/bluetooth/btrtl.c
@@ -60,7 +60,8 @@ enum btrtl_chip_id {
CHIP_ID_8723B,
CHIP_ID_8821A,
CHIP_ID_8761A,
- CHIP_ID_8822B = 8,
+ CHIP_ID_8703B = 7,
+ CHIP_ID_8822B,
CHIP_ID_8723D,
CHIP_ID_8821C,
CHIP_ID_8822C = 13,
@@ -631,20 +632,20 @@ static int rtlbt_parse_firmware(struct hci_dev *hdev,
__u16 lmp_subver;
__u8 id;
} project_id_to_lmp_subver[] = {
- { RTL_ROM_LMP_8723A, 0 },
- { RTL_ROM_LMP_8723B, 1 },
- { RTL_ROM_LMP_8821A, 2 },
- { RTL_ROM_LMP_8761A, 3 },
- { RTL_ROM_LMP_8703B, 7 },
- { RTL_ROM_LMP_8822B, 8 },
- { RTL_ROM_LMP_8723B, 9 }, /* 8723D */
- { RTL_ROM_LMP_8821A, 10 }, /* 8821C */
- { RTL_ROM_LMP_8822B, 13 }, /* 8822C */
- { RTL_ROM_LMP_8761A, 14 }, /* 8761B */
- { RTL_ROM_LMP_8852A, 18 }, /* 8852A */
- { RTL_ROM_LMP_8852A, 20 }, /* 8852B */
- { RTL_ROM_LMP_8852A, 25 }, /* 8852C */
- { RTL_ROM_LMP_8851B, 36 }, /* 8851B */
+ { RTL_ROM_LMP_8723A, CHIP_ID_8723A },
+ { RTL_ROM_LMP_8723B, CHIP_ID_8723B },
+ { RTL_ROM_LMP_8821A, CHIP_ID_8821A },
+ { RTL_ROM_LMP_8761A, CHIP_ID_8761A },
+ { RTL_ROM_LMP_8703B, CHIP_ID_8703B },
+ { RTL_ROM_LMP_8822B, CHIP_ID_8822B },
+ { RTL_ROM_LMP_8723B, CHIP_ID_8723D },
+ { RTL_ROM_LMP_8821A, CHIP_ID_8821C },
+ { RTL_ROM_LMP_8822B, CHIP_ID_8822C },
+ { RTL_ROM_LMP_8761A, CHIP_ID_8761B },
+ { RTL_ROM_LMP_8852A, CHIP_ID_8852A },
+ { RTL_ROM_LMP_8852A, CHIP_ID_8852B },
+ { RTL_ROM_LMP_8852A, CHIP_ID_8852C },
+ { RTL_ROM_LMP_8851B, CHIP_ID_8851B },
};

if (btrtl_dev->fw_len <= 8)
--
2.40.1