Skip to content

Commit 5ec6feb

Browse files
kirankrishnappa-intelVudentz
authored andcommitted
Bluetooth: btintel: Define macros for image types
Use macro for image type instead of using hard code number. Signed-off-by: Kiran K <[email protected]> Signed-off-by: Luiz Augusto von Dentz <[email protected]>
1 parent 5c16727 commit 5ec6feb

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

drivers/bluetooth/btintel.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ static int btintel_version_info_tlv(struct hci_dev *hdev,
489489
}
490490

491491
switch (version->img_type) {
492-
case 0x01:
492+
case BTINTEL_IMG_BOOTLOADER:
493493
variant = "Bootloader";
494494
/* It is required that every single firmware fragment is acknowledged
495495
* with a command complete event. If the boot parameters indicate
@@ -521,7 +521,7 @@ static int btintel_version_info_tlv(struct hci_dev *hdev,
521521
version->min_fw_build_nn, version->min_fw_build_cw,
522522
2000 + version->min_fw_build_yy);
523523
break;
524-
case 0x03:
524+
case BTINTEL_IMG_OP:
525525
variant = "Firmware";
526526
break;
527527
default:
@@ -535,7 +535,7 @@ static int btintel_version_info_tlv(struct hci_dev *hdev,
535535
bt_dev_info(hdev, "%s timestamp %u.%u buildtype %u build %u", variant,
536536
2000 + (version->timestamp >> 8), version->timestamp & 0xff,
537537
version->build_type, version->build_num);
538-
if (version->img_type == 0x03)
538+
if (version->img_type == BTINTEL_IMG_OP)
539539
bt_dev_info(hdev, "Firmware SHA1: 0x%8.8x", version->git_sha1);
540540

541541
return 0;
@@ -1172,7 +1172,7 @@ static int btintel_download_fw_tlv(struct hci_dev *hdev,
11721172
* If the firmware version has changed that means it needs to be reset
11731173
* to bootloader when operational so the new firmware can be loaded.
11741174
*/
1175-
if (ver->img_type == 0x03)
1175+
if (ver->img_type == BTINTEL_IMG_OP)
11761176
return -EINVAL;
11771177

11781178
/* iBT hardware variants 0x0b, 0x0c, 0x11, 0x12, 0x13, 0x14 support
@@ -2230,7 +2230,7 @@ static int btintel_prepare_fw_download_tlv(struct hci_dev *hdev,
22302230
* It is not possible to use the Secure Boot Parameters in this
22312231
* case since that command is only available in bootloader mode.
22322232
*/
2233-
if (ver->img_type == 0x03) {
2233+
if (ver->img_type == BTINTEL_IMG_OP) {
22342234
btintel_clear_flag(hdev, INTEL_BOOTLOADER);
22352235
btintel_check_bdaddr(hdev);
22362236
} else {
@@ -2600,7 +2600,7 @@ static int btintel_bootloader_setup_tlv(struct hci_dev *hdev,
26002600
return err;
26012601

26022602
/* check if controller is already having an operational firmware */
2603-
if (ver->img_type == 0x03)
2603+
if (ver->img_type == BTINTEL_IMG_OP)
26042604
goto finish;
26052605

26062606
err = btintel_boot(hdev, boot_param);

drivers/bluetooth/btintel.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ struct intel_tlv {
5151
u8 val[];
5252
} __packed;
5353

54+
#define BTINTEL_IMG_BOOTLOADER 0x01 /* Bootloader image */
55+
#define BTINTEL_IMG_OP 0x03 /* Operational image */
56+
5457
struct intel_version_tlv {
5558
u32 cnvi_top;
5659
u32 cnvr_top;

0 commit comments

Comments
 (0)