/* Store back to the same location it was read from with ab_control_create_from_misc(). */
static int ab_control_store(struct blk_desc *dev_desc, const disk_partition_t *part_info, struct bootloader_control *abc)
/* Store back to the same location it was read from with ab_control_create_from_misc(). */
static int ab_control_store(struct blk_desc *dev_desc, const disk_partition_t *part_info, struct bootloader_control *abc)
{
	ulong abc_offset, abc_blocks, ret;
	abc_offset = offsetof(struct bootloader_message_ab, slot_suffix) /
		     part_info->blksz;
	abc_blocks = DIV_ROUND_UP(sizeof(struct bootloader_control),
				  part_info->blksz);
	ret = blk_dwrite(dev_desc, part_info->start + abc_offset, abc_blocks,
			 abc);
	if (IS_ERR_VALUE(ret)) {
		log_err("ANDROID: Could not write back the misc partition\n");
		return -EIO;
	}
	return 0;
}