The LMB module has a bunch for API's which are used for allocating memory. There are a couple of API's for requesting memory, and two more for reserving regions of memory. Replace these different API's with a single one, lmb_allocate_mem(). The type of allocation to be made is specified through one of the parameters to the function.
Additionally, the two API's for reserving regions of memory, lmb_reserve() and lmb_alloc_addr() are the same with one difference. One can reserve any memory region with lmb_reserve(), while lmb_alloc_addr() actually checks that the memory region being requested is part of the LMB memory map. Reserving memory that is not part of the LMB memory map is pretty futile -- the allocation functions do not allocate memory which has not been added to the LMB memory map. This series also removes the functionality allowing for reserving memory regions outside the LMB memory map. Any request for reserving a region of memory outside the LMB memory map now returns an -EINVAL error. Certain places in the common code using the LMB API's were not checking the return value of the functions. Checks have been added for them. There are some calls being made from the architecture/platform specific code which too do not check the return value. Those have been kept the same, as I do not have the platform with me to check if it causes any issues on those platforms. Sughosh Ganu (5): lmb: replace lmb_reserve() and lmb_alloc_addr() API's lmb: replace the lmb_alloc() and lmb_alloc_base() API's lmb: staticise lmb_add_memory() lmb: use a single function to free up memory doc: add lmb documentation arch/arm/mach-apple/board.c | 27 +++-- arch/arm/mach-mediatek/tzcfg.c | 8 +- arch/arm/mach-snapdragon/board.c | 13 ++- arch/powerpc/cpu/mpc85xx/mp.c | 4 +- arch/powerpc/lib/misc.c | 5 +- boot/bootm.c | 11 +- boot/image-board.c | 49 +++++---- boot/image-fdt.c | 67 +++++++++--- cmd/booti.c | 8 +- cmd/bootz.c | 8 +- cmd/load.c | 6 +- doc/api/index.rst | 1 - doc/api/lmb.rst | 7 -- doc/develop/index.rst | 1 + doc/develop/lmb.rst | 166 ++++++++++++++++++++++++++++++ fs/fs.c | 3 +- include/lmb.h | 101 ++++++++---------- lib/efi_loader/efi_memory.c | 22 ++-- lib/lmb.c | 171 +++++++++++++++++-------------- test/lib/lmb.c | 102 ++++++++++++------ 20 files changed, 535 insertions(+), 245 deletions(-) delete mode 100644 doc/api/lmb.rst create mode 100644 doc/develop/lmb.rst -- 2.34.1