summaryrefslogtreecommitdiffstats
path: root/mm/memblock.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-10-30 19:39:02 +0100
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-10-30 19:39:02 +0100
commit31271e9aacaa3c3460cbad8ec62fb5a04a522f5b (patch)
tree815c671dac14e0e07959dc88e94c36a994f9c460 /mm/memblock.c
parentMerge tag 'spi-linus' into spi-next (diff)
parentspi: tegra: add spi driver for SLINK controller (diff)
downloadlinux-31271e9aacaa3c3460cbad8ec62fb5a04a522f5b.tar.xz
linux-31271e9aacaa3c3460cbad8ec62fb5a04a522f5b.zip
Merge branch 'spi-tegra' into spi-next
Diffstat (limited to 'mm/memblock.c')
-rw-r--r--mm/memblock.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/mm/memblock.c b/mm/memblock.c
index 931eef145af5..625905523c2a 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -930,6 +930,30 @@ int __init_memblock memblock_is_region_reserved(phys_addr_t base, phys_addr_t si
return memblock_overlaps_region(&memblock.reserved, base, size) >= 0;
}
+void __init_memblock memblock_trim_memory(phys_addr_t align)
+{
+ int i;
+ phys_addr_t start, end, orig_start, orig_end;
+ struct memblock_type *mem = &memblock.memory;
+
+ for (i = 0; i < mem->cnt; i++) {
+ orig_start = mem->regions[i].base;
+ orig_end = mem->regions[i].base + mem->regions[i].size;
+ start = round_up(orig_start, align);
+ end = round_down(orig_end, align);
+
+ if (start == orig_start && end == orig_end)
+ continue;
+
+ if (start < end) {
+ mem->regions[i].base = start;
+ mem->regions[i].size = end - start;
+ } else {
+ memblock_remove_region(mem, i);
+ i--;
+ }
+ }
+}
void __init_memblock memblock_set_current_limit(phys_addr_t limit)
{