if (info->filename)
return offset & (ARCH_DMA_MINALIGN - 1);
- return offset % info->bl_len;
+ return offset & (info->bl_len - 1);
}
static int get_aligned_image_size(struct spl_load_info *info, int data_size,
images = (struct boot_img_t *)((u8 *)container +
sizeof(struct container_hdr));
- if (images[image_index].offset % info->bl_len) {
+ if (!IS_ALIGNED(images[image_index].offset, info->bl_len)) {
printf("%s: image%d offset not aligned to %u\n",
__func__, image_index, info->bl_len);
return NULL;
}
- sectors = roundup(images[image_index].size, info->bl_len) /
+ sectors = ALIGN(images[image_index].size, info->bl_len) /
info->bl_len;
sector = images[image_index].offset / info->bl_len +
container_sector;
u32 sectors;
int i, size, ret = 0;
- size = roundup(CONTAINER_HDR_ALIGNMENT, info->bl_len);
+ size = ALIGN(CONTAINER_HDR_ALIGNMENT, info->bl_len);
sectors = size / info->bl_len;
/*
debug("Container length %u\n", length);
if (length > CONTAINER_HDR_ALIGNMENT) {
- size = roundup(length, info->bl_len);
+ size = ALIGN(length, info->bl_len);
sectors = size / info->bl_len;
free(container);