From 56aeae0400df8843b62bea85d0dbe27aaf0be325 Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Fri, 8 Nov 2019 14:37:58 -0700 Subject: 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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/36689 Reviewed-by: Julius Werner Tested-by: build bot (Jenkins) --- src/commonlib/include/commonlib/region.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/commonlib/include') diff --git a/src/commonlib/include/commonlib/region.h b/src/commonlib/include/commonlib/region.h index f27a494d39..39db1bb627 100644 --- a/src/commonlib/include/commonlib/region.h +++ b/src/commonlib/include/commonlib/region.h @@ -122,6 +122,11 @@ static inline size_t region_sz(const struct region *r) return r->size; } +static inline size_t region_end(const struct region *r) +{ + return region_offset(r) + region_sz(r); +} + static inline const struct region *region_device_region( const struct region_device *rdev) { @@ -138,6 +143,11 @@ static inline size_t region_device_offset(const struct region_device *rdev) return region_offset(region_device_region(rdev)); } +static inline size_t region_device_end(const struct region_device *rdev) +{ + return region_end(region_device_region(rdev)); +} + /* Memory map entire region device. Same semantics as rdev_mmap() above. */ static inline void *rdev_mmap_full(const struct region_device *rd) { -- cgit v1.2.3