diff options
author | Cyril Bur <cyril.bur@au1.ibm.com> | 2015-06-23 13:22:08 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2015-06-23 13:38:42 +1000 |
commit | 69b152cab30aae6188b590b2df9a6f55932c4408 (patch) | |
tree | 3f8f375a5d80131dd4c0a1955b25a3e6b669d8d0 /core/flash.c | |
parent | 6c458a0369494a7f0ae2e6352850502c5e393f8f (diff) | |
download | skiboot-69b152cab30aae6188b590b2df9a6f55932c4408.zip skiboot-69b152cab30aae6188b590b2df9a6f55932c4408.tar.gz skiboot-69b152cab30aae6188b590b2df9a6f55932c4408.tar.bz2 |
libflash/ecc: Simplify and cleanup ecc code.
The ecc 'memcpy' style functions return success or fail in terms of the ECC
enum. This doesn't really make sense, use true or false. As the result the
ecc enum doesn't need to be exposed anymore, which makes more sense, not
clear why it was exposed in the first place.
Convert some of the ecc #defines to static inlines, shouldn't make any
difference but feels safer.
Fix minor stylistic and typo issues.
Reviewed-By: Alistair Popple <alistair@popple.id.au>
Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'core/flash.c')
-rw-r--r-- | core/flash.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/core/flash.c b/core/flash.c index bea5160..b9c739d 100644 --- a/core/flash.c +++ b/core/flash.c @@ -418,7 +418,7 @@ static int flash_find_subpartition(struct blocklevel_device *bl, uint32_t subid, /* Get raw partition size without ECC */ partsize = *total_size; if (ecc) - partsize = BUFFER_SIZE_MINUS_ECC(*total_size); + partsize = ecc_buffer_size_minus_ecc(*total_size); /* Get the TOC */ rc = flash_read_corrected(bl, *start, header, @@ -483,8 +483,8 @@ static int flash_find_subpartition(struct blocklevel_device *bl, uint32_t subid, *start += offset; *total_size = size; if (ecc) { - *start += ECC_SIZE(offset); - *total_size += ECC_SIZE(size); + *start += ecc_size(offset); + *total_size += ecc_size(size); } rc = 0; goto end; @@ -577,12 +577,12 @@ static int flash_load_resource(enum resource_id id, uint32_t subid, /* Work out what the final size of buffer will be without ECC */ size = part_size; if (ecc) { - if ECC_BUFFER_SIZE_CHECK(part_size) { + if (ecc_buffer_size_check(part_size)) { prerror("FLASH: %s image invalid size for ECC %d\n", name, part_size); goto out_free_ffs; } - size = BUFFER_SIZE_MINUS_ECC(part_size); + size = ecc_buffer_size_minus_ecc(part_size); } if (size > *len) { |