lib/imd_cbmem: Remove indirection through cbmem_get_imd()

It always returns the same pointer so why not use the pointer directly?

Change-Id: Ib5a13edc7f3ab05c3baf9956ab67031507bdddc1
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/37360
Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Patrick Georgi 2019-11-29 12:14:30 +01:00
parent bc2204edd2
commit cd666d992d
1 changed files with 4 additions and 8 deletions

View File

@ -43,11 +43,7 @@ void *cbmem_top(void)
} }
static inline struct imd *cbmem_get_imd(void) static struct imd imd_cbmem;
{
static struct imd imd_cbmem;
return &imd_cbmem;
}
static inline const struct cbmem_entry *imd_to_cbmem(const struct imd_entry *e) static inline const struct cbmem_entry *imd_to_cbmem(const struct imd_entry *e)
{ {
@ -75,7 +71,7 @@ static struct imd *imd_init_backing(struct imd *backing)
{ {
struct imd *imd; struct imd *imd;
imd = cbmem_get_imd(); imd = &imd_cbmem;
if (imd != NULL) if (imd != NULL)
return imd; return imd;
@ -288,7 +284,7 @@ void cbmem_add_bootmem(void)
void cbmem_get_region(void **baseptr, size_t *size) void cbmem_get_region(void **baseptr, size_t *size)
{ {
imd_region_used(cbmem_get_imd(), baseptr, size); imd_region_used(&imd_cbmem, baseptr, size);
} }
#if ENV_PAYLOAD_LOADER || (CONFIG(EARLY_CBMEM_LIST) \ #if ENV_PAYLOAD_LOADER || (CONFIG(EARLY_CBMEM_LIST) \
@ -314,7 +310,7 @@ void cbmem_add_records_to_cbtable(struct lb_header *header)
struct imd_cursor cursor; struct imd_cursor cursor;
struct imd *imd; struct imd *imd;
imd = cbmem_get_imd(); imd = &imd_cbmem;
if (imd_cursor_init(imd, &cursor)) if (imd_cursor_init(imd, &cursor))
return; return;