@@ -94,6 +94,9 @@ struct fwu_mdata {
} __packed;
#else /* CONFIG_FWU_MDATA_V1 */
+
+#define FWU_MAX_STATE_BANKS 4
+
/**
* struct fwu_mdata - FWU metadata structure for multi-bank updates
* @crc32: crc32 value for the FWU metadata
@@ -120,7 +123,7 @@ struct fwu_mdata {
uint32_t metadata_size;
uint16_t desc_offset;
uint16_t reserved1;
- uint8_t bank_state[4];
+ uint8_t bank_state[FWU_MAX_STATE_BANKS];
uint32_t reserved2;
// struct fwu_fw_store_desc fw_desc;
@@ -30,9 +30,6 @@ typedef uint64_t u64;
#define CONFIG_FWU_NUM_BANKS 0
#define CONFIG_FWU_NUM_IMAGES_PER_BANK 0
-/* version 2 supports maximum of 4 banks */
-#define MAX_BANKS_V2 4
-
#include <fwu_mdata.h>
static const char *opts_short = "b:i:a:p:v:V:gh";
@@ -292,7 +289,7 @@ static void fwu_fill_version_specific_mdata(struct fwu_mdata_object *mobj)
mdata->metadata_size = mobj->size;
mdata->desc_offset = sizeof(struct fwu_mdata);
- for (i = 0; i < MAX_BANKS_V2; i++)
+ for (i = 0; i < FWU_MAX_STATE_BANKS; i++)
mdata->bank_state[i] = i < mobj->banks ?
FWU_BANK_ACCEPTED : FWU_BANK_INVALID;
Replace the hardcoded size of the bank_state array with FWU_MAX_STATE_BANKS to improve readability and ensure consistency between the structure definition and code that relies on it, including the mkfwumdata tool. Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> --- include/fwu_mdata.h | 5 ++++- tools/mkfwumdata.c | 5 +---- 2 files changed, 5 insertions(+), 5 deletions(-)