Commit c5c5c9d1 authored by Tang Chen's avatar Tang Chen Committed by Linus Torvalds

mm/memblock.c: make memblock_overlaps_region() return bool.

memblock_overlaps_region() checks if the given memblock region
intersects a region in memblock.  If so, it returns the index of the
intersected region.

But its only caller is memblock_is_region_reserved(), and it returns 0
if false, non-zero if true.

Both of these should return bool.
Signed-off-by: default avatarTang Chen <tangchen@cn.fujitsu.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tejun Heo <tj@kernel.org>
Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Cc: Luiz Capitulino <lcapitulino@redhat.com>
Cc: Xishi Qiu <qiuxishi@huawei.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Vladimir Murzin <vladimir.murzin@arm.com>
Cc: Fabian Frederick <fabf@skynet.be>
Cc: Alexander Kuleshov <kuleshovmail@gmail.com>
Cc: Baoquan He <bhe@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 72079ba0
...@@ -323,7 +323,7 @@ void memblock_enforce_memory_limit(phys_addr_t memory_limit); ...@@ -323,7 +323,7 @@ void memblock_enforce_memory_limit(phys_addr_t memory_limit);
int memblock_is_memory(phys_addr_t addr); int memblock_is_memory(phys_addr_t addr);
int memblock_is_region_memory(phys_addr_t base, phys_addr_t size); int memblock_is_region_memory(phys_addr_t base, phys_addr_t size);
int memblock_is_reserved(phys_addr_t addr); int memblock_is_reserved(phys_addr_t addr);
int memblock_is_region_reserved(phys_addr_t base, phys_addr_t size); bool memblock_is_region_reserved(phys_addr_t base, phys_addr_t size);
extern void __memblock_dump_all(void); extern void __memblock_dump_all(void);
......
...@@ -91,7 +91,7 @@ static unsigned long __init_memblock memblock_addrs_overlap(phys_addr_t base1, p ...@@ -91,7 +91,7 @@ static unsigned long __init_memblock memblock_addrs_overlap(phys_addr_t base1, p
return ((base1 < (base2 + size2)) && (base2 < (base1 + size1))); return ((base1 < (base2 + size2)) && (base2 < (base1 + size1)));
} }
static long __init_memblock memblock_overlaps_region(struct memblock_type *type, static bool __init_memblock memblock_overlaps_region(struct memblock_type *type,
phys_addr_t base, phys_addr_t size) phys_addr_t base, phys_addr_t size)
{ {
unsigned long i; unsigned long i;
...@@ -103,7 +103,7 @@ static long __init_memblock memblock_overlaps_region(struct memblock_type *type, ...@@ -103,7 +103,7 @@ static long __init_memblock memblock_overlaps_region(struct memblock_type *type,
break; break;
} }
return (i < type->cnt) ? i : -1; return i < type->cnt;
} }
/* /*
...@@ -1566,12 +1566,12 @@ int __init_memblock memblock_is_region_memory(phys_addr_t base, phys_addr_t size ...@@ -1566,12 +1566,12 @@ int __init_memblock memblock_is_region_memory(phys_addr_t base, phys_addr_t size
* Check if the region [@base, @base+@size) intersects a reserved memory block. * Check if the region [@base, @base+@size) intersects a reserved memory block.
* *
* RETURNS: * RETURNS:
* 0 if false, non-zero if true * True if they intersect, false if not.
*/ */
int __init_memblock memblock_is_region_reserved(phys_addr_t base, phys_addr_t size) bool __init_memblock memblock_is_region_reserved(phys_addr_t base, phys_addr_t size)
{ {
memblock_cap_size(base, &size); memblock_cap_size(base, &size);
return memblock_overlaps_region(&memblock.reserved, base, size) >= 0; return memblock_overlaps_region(&memblock.reserved, base, size);
} }
void __init_memblock memblock_trim_memory(phys_addr_t align) void __init_memblock memblock_trim_memory(phys_addr_t align)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment