flashrom.c: Refactor parameters of select_erase_functions()

Replace separate parameters with a pointer to the current `walk_info`.

Change-Id: I46890589971183ca91684a8e275112d822780253
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/72557
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/flashrom.c b/flashrom.c
index 8bfc383..278b553 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -1074,27 +1074,23 @@
  * @param	layout		erase layout
  * @param	findex		index of the erase function
  * @param	block_num	index of the block to erase according to the erase function index
- * @param	curcontents	buffer containg the current contents of the flash
- * @param	newcontents	buffer containg the new contents of the flash
- * @param	rstart		start address of the region
- * @rend	rend		end address of the region
+ * @param	info		current info from walking the regions
  */
 void select_erase_functions(struct flashctx *flashctx, const struct erase_layout *layout,
-				size_t findex, size_t block_num, uint8_t *curcontents, uint8_t *newcontents,
-				chipoff_t rstart, chipoff_t rend);
+				       size_t findex, size_t block_num, const struct walk_info *info);
 void select_erase_functions(struct flashctx *flashctx, const struct erase_layout *layout,
-				size_t findex, size_t block_num, uint8_t *curcontents, uint8_t *newcontents,
-				chipoff_t rstart, chipoff_t rend)
+				       size_t findex, size_t block_num, const struct walk_info *info)
 {
 	struct eraseblock_data *ll = &layout[findex].layout_list[block_num];
 	if (!findex) {
-		if (ll->start_addr >= rstart && ll->end_addr <= rend) {
+		if (ll->start_addr >= info->region_start && ll->end_addr <= info->region_end) {
 			chipoff_t start_addr = ll->start_addr;
 			chipoff_t end_addr = ll->end_addr;
 			const chipsize_t erase_len = end_addr - start_addr + 1;
 			const uint8_t erased_value = ERASED_VALUE(flashctx);
-			ll->selected = need_erase(curcontents + start_addr, newcontents + start_addr, erase_len,
-						flashctx->chip->gran, erased_value);
+			ll->selected = need_erase(
+				info->curcontents + start_addr, info->newcontents + start_addr,
+				erase_len, flashctx->chip->gran, erased_value);
 		}
 	} else {
 		int count = 0;
@@ -1103,15 +1099,14 @@
 
 		int j;
 		for (j = sub_block_start; j <= sub_block_end; j++) {
-			select_erase_functions(flashctx, layout, findex - 1, j, curcontents, newcontents,
-						rstart, rend);
+			select_erase_functions(flashctx, layout, findex - 1, j, info);
 			if (layout[findex - 1].layout_list[j].selected)
 				count++;
 		}
 
 		const int total_blocks = sub_block_end - sub_block_start + 1;
 		if (count && count > total_blocks/2) {
-			if (ll->start_addr >= rstart && ll->end_addr <= rend) {
+			if (ll->start_addr >= info->region_start && ll->end_addr <= info->region_end) {
 				for (j = sub_block_start; j <= sub_block_end; j++)
 					layout[findex - 1].layout_list[j].selected = false;
 				ll->selected = true;