@@ -1549,8 +1549,7 @@ spi_nor_find_best_erase_type(const struct spi_nor_erase_map *map,
continue;
/* Alignment is not mandatory for overlaid regions */
- if (region->flags & SNOR_OVERLAID_REGION &&
- region->size <= len)
+ if (region->overlaid && region->size <= len)
return erase;
/* Don't erase more than what the user has asked for. */
@@ -1592,7 +1591,7 @@ spi_nor_init_erase_cmd(const struct spi_nor_erase_region *region,
cmd->opcode = erase->opcode;
cmd->count = 1;
- if (region->flags & SNOR_OVERLAID_REGION)
+ if (region->overlaid)
cmd->size = region->size;
else
cmd->size = erase->size;
@@ -1650,7 +1649,7 @@ static int spi_nor_init_erase_cmd_list(struct spi_nor *nor,
goto destroy_erase_cmd_list;
if (prev_erase != erase || erase->size != cmd->size ||
- region->flags & SNOR_OVERLAID_REGION) {
+ region->overlaid) {
cmd = spi_nor_init_erase_cmd(region, erase);
if (IS_ERR(cmd)) {
ret = PTR_ERR(cmd);
@@ -238,19 +238,17 @@ struct spi_nor_erase_command {
* inside this region. The erase types are sorted in
* ascending order with the smallest Erase Type size being
* at BIT(0).
- * @flags: flags to determine if this region is overlaid.
+ * @overlaid: determine if this region is overlaid.
*/
struct spi_nor_erase_region {
u64 offset;
u64 size;
u8 erase_mask;
- u8 flags;
+ bool overlaid;
};
#define SNOR_ERASE_TYPE_MAX 4
-#define SNOR_OVERLAID_REGION BIT(0)
-
/**
* struct spi_nor_erase_map - Structure to describe the SPI NOR erase map
* @regions: array of erase regions. The regions are consecutive in
@@ -142,13 +142,12 @@ static int spi_nor_params_show(struct seq_file *s, void *data)
}
seq_puts(s, "\nsector map\n");
- seq_puts(s, " region (in hex) | erase mask | flags\n");
+ seq_puts(s, " region (in hex) | erase mask | overlaid\n");
seq_puts(s, " ------------------+------------+----------\n");
for (i = 0; i < erase_map->n_regions; i++) {
u64 start = region[i].offset;
u64 end = start + region[i].size - 1;
u8 erase_mask = region[i].erase_mask;
- u8 flags = region[i].flags;
seq_printf(s, " %08llx-%08llx | [%c%c%c%c] | %s\n",
start, end,
@@ -156,7 +155,7 @@ static int spi_nor_params_show(struct seq_file *s, void *data)
erase_mask & BIT(1) ? '1' : ' ',
erase_mask & BIT(2) ? '2' : ' ',
erase_mask & BIT(3) ? '3' : ' ',
- flags & SNOR_OVERLAID_REGION ? "overlaid" : "");
+ region[i].overlaid ? "yes" : "no");
}
return 0;
@@ -773,11 +773,6 @@ static const u32 *spi_nor_get_map_in_use(struct spi_nor *nor, const u32 *smpt,
return ret;
}
-static void spi_nor_region_mark_overlay(struct spi_nor_erase_region *region)
-{
- region->flags |= SNOR_OVERLAID_REGION;
-}
-
/**
* spi_nor_region_check_overlay() - set overlay bit when the region is overlaid
* @region: pointer to a structure that describes a SPI NOR erase region
@@ -795,7 +790,7 @@ spi_nor_region_check_overlay(struct spi_nor_erase_region *region,
if (!(erase[i].size && erase_type & BIT(erase[i].idx)))
continue;
if (region->size & erase[i].size_mask) {
- spi_nor_region_mark_overlay(region);
+ region->overlaid = true;
return;
}
}