diff options
author | Alexander Kuleshov <kuleshovmail@gmail.com> | 2016-01-14 18:20:42 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-14 19:00:49 -0500 |
commit | 8c9c1701c7c23a57ebfd1a0b27b87053ae43cfb5 (patch) | |
tree | c528eedae09fd65e037205aeb47b39e765370a85 /include/linux/memblock.h | |
parent | f14516fbf0f6bec7d98c1cb5b5c73ccd2bb4a5e9 (diff) |
mm/memblock: introduce for_each_memblock_type()
We already have the for_each_memblock() macro in <linux/memblock.h>
which provides ability to iterate over memblock regions of a known type.
The for_each_memblock() macro allows us to pass the pointer to the
struct memblock_type, instead we need to pass name of the type.
This patch introduces a new macro for_each_memblock_type() which allows
us iterate over memblock regions with the given type when the type is
unknown.
Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/memblock.h')
-rw-r--r-- | include/linux/memblock.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/memblock.h b/include/linux/memblock.h index 3a092fba2eb2..c0c4208a286f 100644 --- a/include/linux/memblock.h +++ b/include/linux/memblock.h | |||
@@ -399,6 +399,11 @@ static inline unsigned long memblock_region_reserved_end_pfn(const struct memblo | |||
399 | region < (memblock.memblock_type.regions + memblock.memblock_type.cnt); \ | 399 | region < (memblock.memblock_type.regions + memblock.memblock_type.cnt); \ |
400 | region++) | 400 | region++) |
401 | 401 | ||
402 | #define for_each_memblock_type(memblock_type, rgn) \ | ||
403 | idx = 0; \ | ||
404 | rgn = &memblock_type->regions[idx]; \ | ||
405 | for (idx = 0; idx < memblock_type->cnt; \ | ||
406 | idx++,rgn = &memblock_type->regions[idx]) | ||
402 | 407 | ||
403 | #ifdef CONFIG_ARCH_DISCARD_MEMBLOCK | 408 | #ifdef CONFIG_ARCH_DISCARD_MEMBLOCK |
404 | #define __init_memblock __meminit | 409 | #define __init_memblock __meminit |