Skip to content

Commit

Permalink
bootuil: Replace flash_area_id_to_image with flash_area_to_image
Browse files Browse the repository at this point in the history
Move flash_area_get_id inside the function and rename it.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
  • Loading branch information
de-nordic committed Aug 22, 2023
1 parent 2c61caf commit 4ff95da
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions boot/bootutil/src/bootutil_public.c
Original file line number Diff line number Diff line change
Expand Up @@ -472,10 +472,11 @@ boot_write_copy_done(const struct flash_area *fap)

#ifndef MCUBOOT_BOOTUTIL_LIB_FOR_DIRECT_XIP

static int flash_area_id_to_image(int id)
static int flash_area_to_image(const struct flash_area *fa)
{
#if BOOT_IMAGE_NUMBER > 1
uint8_t i = 0;
int id = flash_area_get_id(fa);

while (i < BOOT_IMAGE_NUMBER) {
if (FLASH_AREA_IMAGE_PRIMARY(i) == id || (FLASH_AREA_IMAGE_SECONDARY(i) == id)) {
Expand All @@ -485,7 +486,7 @@ static int flash_area_id_to_image(int id)
++i;
}
#else
(void)id;
(void)fa;
#endif
return 0;
}
Expand Down Expand Up @@ -535,8 +536,7 @@ boot_set_next(const struct flash_area *fa, bool active, bool confirm)
} else {
swap_type = BOOT_SWAP_TYPE_TEST;
}
rc = boot_write_swap_info(fa, swap_type,
flash_area_id_to_image(flash_area_get_id(fa)));
rc = boot_write_swap_info(fa, swap_type, flash_area_to_image(fa));
}
}
break;
Expand Down

0 comments on commit 4ff95da

Please sign in to comment.