use ARRAY_SIZE macro
Search and destroy lingering cases where the ARRAY_SIZE macro should be used to convey more intrinsic meaning in the OpenOCD code.
This commit is contained in:
+2
-2
@@ -290,7 +290,7 @@ static int avrf_probe(struct flash_bank *bank)
|
||||
LOG_ERROR("0x%" PRIx32 " is invalid Manufacturer for avr, 0x%X is expected", EXTRACT_MFG(device_id), 0x1F);
|
||||
}
|
||||
|
||||
for (i = 0; i < (int)(sizeof(avft_chips_info) / sizeof(avft_chips_info[0])); i++)
|
||||
for (i = 0; i < (int)ARRAY_SIZE(avft_chips_info); i++)
|
||||
{
|
||||
if (avft_chips_info[i].chip_id == EXTRACT_PART(device_id))
|
||||
{
|
||||
@@ -369,7 +369,7 @@ static int avrf_info(struct flash_bank *bank, char *buf, int buf_size)
|
||||
LOG_ERROR("0x%" PRIx32 " is invalid Manufacturer for avr, 0x%X is expected", EXTRACT_MFG(device_id), 0x1F);
|
||||
}
|
||||
|
||||
for (i = 0; i < (int)(sizeof(avft_chips_info) / sizeof(avft_chips_info[0])); i++)
|
||||
for (i = 0; i < (int)ARRAY_SIZE(avft_chips_info); i++)
|
||||
{
|
||||
if (avft_chips_info[i].chip_id == EXTRACT_PART(device_id))
|
||||
{
|
||||
|
||||
+6
-6
@@ -46,7 +46,7 @@ const struct flash_sector TMS470R1A256_SECTORS[] = {
|
||||
};
|
||||
|
||||
#define TMS470R1A256_NUM_SECTORS \
|
||||
(sizeof(TMS470R1A256_SECTORS)/sizeof(TMS470R1A256_SECTORS[0]))
|
||||
ARRAY_SIZE(TMS470R1A256_SECTORS)
|
||||
|
||||
const struct flash_sector TMS470R1A288_BANK0_SECTORS[] = {
|
||||
{0x00000000, 0x00002000, -1, -1},
|
||||
@@ -56,7 +56,7 @@ const struct flash_sector TMS470R1A288_BANK0_SECTORS[] = {
|
||||
};
|
||||
|
||||
#define TMS470R1A288_BANK0_NUM_SECTORS \
|
||||
(sizeof(TMS470R1A288_BANK0_SECTORS)/sizeof(TMS470R1A288_BANK0_SECTORS[0]))
|
||||
ARRAY_SIZE(TMS470R1A288_BANK0_SECTORS)
|
||||
|
||||
const struct flash_sector TMS470R1A288_BANK1_SECTORS[] = {
|
||||
{0x00040000, 0x00010000, -1, -1},
|
||||
@@ -66,7 +66,7 @@ const struct flash_sector TMS470R1A288_BANK1_SECTORS[] = {
|
||||
};
|
||||
|
||||
#define TMS470R1A288_BANK1_NUM_SECTORS \
|
||||
(sizeof(TMS470R1A288_BANK1_SECTORS)/sizeof(TMS470R1A288_BANK1_SECTORS[0]))
|
||||
ARRAY_SIZE(TMS470R1A288_BANK1_SECTORS)
|
||||
|
||||
const struct flash_sector TMS470R1A384_BANK0_SECTORS[] = {
|
||||
{0x00000000, 0x00002000, -1, -1},
|
||||
@@ -82,7 +82,7 @@ const struct flash_sector TMS470R1A384_BANK0_SECTORS[] = {
|
||||
};
|
||||
|
||||
#define TMS470R1A384_BANK0_NUM_SECTORS \
|
||||
(sizeof(TMS470R1A384_BANK0_SECTORS)/sizeof(TMS470R1A384_BANK0_SECTORS[0]))
|
||||
ARRAY_SIZE(TMS470R1A384_BANK0_SECTORS)
|
||||
|
||||
const struct flash_sector TMS470R1A384_BANK1_SECTORS[] = {
|
||||
{0x00020000, 0x00008000, -1, -1},
|
||||
@@ -92,7 +92,7 @@ const struct flash_sector TMS470R1A384_BANK1_SECTORS[] = {
|
||||
};
|
||||
|
||||
#define TMS470R1A384_BANK1_NUM_SECTORS \
|
||||
(sizeof(TMS470R1A384_BANK1_SECTORS)/sizeof(TMS470R1A384_BANK1_SECTORS[0]))
|
||||
ARRAY_SIZE(TMS470R1A384_BANK1_SECTORS)
|
||||
|
||||
const struct flash_sector TMS470R1A384_BANK2_SECTORS[] = {
|
||||
{0x00040000, 0x00008000, -1, -1},
|
||||
@@ -102,7 +102,7 @@ const struct flash_sector TMS470R1A384_BANK2_SECTORS[] = {
|
||||
};
|
||||
|
||||
#define TMS470R1A384_BANK2_NUM_SECTORS \
|
||||
(sizeof(TMS470R1A384_BANK2_SECTORS)/sizeof(TMS470R1A384_BANK2_SECTORS[0]))
|
||||
ARRAY_SIZE(TMS470R1A384_BANK2_SECTORS)
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user