summaryrefslogtreecommitdiff
path: root/src/drivers/spi
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2019-11-08 14:37:58 -0700
committerPatrick Georgi <pgeorgi@google.com>2019-11-11 10:28:09 +0000
commit56aeae0400df8843b62bea85d0dbe27aaf0be325 (patch)
tree7df697460b26f9d0d40da88675e494106d6f0e63 /src/drivers/spi
parentb1ea53d846b865d5fa1332fb2e31d0f2865a7fc0 (diff)
downloadcoreboot-56aeae0400df8843b62bea85d0dbe27aaf0be325.tar.xz
region: publicize region_end() and add region_device_end()
Provide region_device_end() and make region_end() publically available for use to match a pattern of open coding the offset + size calculation for both struct region and struct region_device. Apply the use of the helpers where the usage matches in the code. Change-Id: Iaef5d007eef9a77f7f33b0e89298abef0197352d Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/36689 Reviewed-by: Julius Werner <jwerner@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/drivers/spi')
-rw-r--r--src/drivers/spi/winbond.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/drivers/spi/winbond.c b/src/drivers/spi/winbond.c
index 00a7bf90cd..fa9140ec01 100644
--- a/src/drivers/spi/winbond.c
+++ b/src/drivers/spi/winbond.c
@@ -431,8 +431,7 @@ static int winbond_get_write_protection(const struct spi_flash *flash,
}
printk(BIOS_DEBUG, "WINBOND: flash protected range 0x%08zx-0x%08zx\n",
- region_offset(&wp_region),
- region_offset(&wp_region) + region_sz(&wp_region));
+ region_offset(&wp_region), region_end(&wp_region));
return region_is_subregion(&wp_region, region);
}
@@ -562,8 +561,7 @@ winbond_set_write_protection(const struct spi_flash *flash,
int ret;
/* Need to touch TOP or BOTTOM */
- if (region_offset(region) != 0 &&
- (region_offset(region) + region_sz(region)) != flash->size)
+ if (region_offset(region) != 0 && region_end(region) != flash->size)
return -1;
params = (const struct winbond_spi_flash_params *)flash->driver_private;
@@ -654,8 +652,7 @@ winbond_set_write_protection(const struct spi_flash *flash,
return ret;
printk(BIOS_DEBUG, "WINBOND: write-protection set to range "
- "0x%08zx-0x%08zx\n", region_offset(region),
- region_offset(region) + region_sz(region));
+ "0x%08zx-0x%08zx\n", region_offset(region), region_end(region));
return ret;
}