提交 581adcbe 编写于 作者: T Tejun Heo

memblock: Make memblock_{add|remove|free|reserve}() return int and update prototypes

memblock_{add|remove|free|reserve}() return either 0 or -errno but had
long as return type.  Chage it to int.  Also, drop 'extern' from all
prototypes in memblock.h - they are unnecessary and used
inconsistently (especially if mm.h is included in the picture).
Signed-off-by: NTejun Heo <tj@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Yinghai Lu <yinghai@kernel.org>
上级 1c16d242
...@@ -52,15 +52,15 @@ phys_addr_t memblock_find_in_range(phys_addr_t start, phys_addr_t end, ...@@ -52,15 +52,15 @@ phys_addr_t memblock_find_in_range(phys_addr_t start, phys_addr_t end,
int memblock_free_reserved_regions(void); int memblock_free_reserved_regions(void);
int memblock_reserve_reserved_regions(void); int memblock_reserve_reserved_regions(void);
extern void memblock_init(void); void memblock_init(void);
extern void memblock_analyze(void); void memblock_analyze(void);
extern long memblock_add(phys_addr_t base, phys_addr_t size); int memblock_add(phys_addr_t base, phys_addr_t size);
extern long memblock_remove(phys_addr_t base, phys_addr_t size); int memblock_remove(phys_addr_t base, phys_addr_t size);
extern long memblock_free(phys_addr_t base, phys_addr_t size); int memblock_free(phys_addr_t base, phys_addr_t size);
extern long memblock_reserve(phys_addr_t base, phys_addr_t size); int memblock_reserve(phys_addr_t base, phys_addr_t size);
extern void __next_free_mem_range(u64 *idx, int nid, phys_addr_t *out_start, void __next_free_mem_range(u64 *idx, int nid, phys_addr_t *out_start,
phys_addr_t *out_end, int *out_nid); phys_addr_t *out_end, int *out_nid);
/** /**
* for_each_free_mem_range - iterate through free memblock areas * for_each_free_mem_range - iterate through free memblock areas
...@@ -80,7 +80,7 @@ extern void __next_free_mem_range(u64 *idx, int nid, phys_addr_t *out_start, ...@@ -80,7 +80,7 @@ extern void __next_free_mem_range(u64 *idx, int nid, phys_addr_t *out_start,
__next_free_mem_range(&i, nid, p_start, p_end, p_nid)) __next_free_mem_range(&i, nid, p_start, p_end, p_nid))
#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
extern int memblock_set_node(phys_addr_t base, phys_addr_t size, int nid); int memblock_set_node(phys_addr_t base, phys_addr_t size, int nid);
static inline void memblock_set_region_node(struct memblock_region *r, int nid) static inline void memblock_set_region_node(struct memblock_region *r, int nid)
{ {
...@@ -105,37 +105,31 @@ static inline int memblock_get_region_node(const struct memblock_region *r) ...@@ -105,37 +105,31 @@ static inline int memblock_get_region_node(const struct memblock_region *r)
/* The numa aware allocator is only available if /* The numa aware allocator is only available if
* CONFIG_ARCH_POPULATES_NODE_MAP is set * CONFIG_ARCH_POPULATES_NODE_MAP is set
*/ */
extern phys_addr_t memblock_find_in_range_node(phys_addr_t start, phys_addr_t memblock_find_in_range_node(phys_addr_t start, phys_addr_t end,
phys_addr_t end, phys_addr_t size, phys_addr_t align, int nid);
phys_addr_t size, phys_addr_t memblock_alloc_nid(phys_addr_t size, phys_addr_t align, int nid);
phys_addr_t align, int nid); phys_addr_t memblock_alloc_try_nid(phys_addr_t size, phys_addr_t align, int nid);
extern phys_addr_t memblock_alloc_nid(phys_addr_t size, phys_addr_t align,
int nid);
extern phys_addr_t memblock_alloc_try_nid(phys_addr_t size, phys_addr_t align,
int nid);
extern phys_addr_t memblock_alloc(phys_addr_t size, phys_addr_t align); phys_addr_t memblock_alloc(phys_addr_t size, phys_addr_t align);
/* Flags for memblock_alloc_base() amd __memblock_alloc_base() */ /* Flags for memblock_alloc_base() amd __memblock_alloc_base() */
#define MEMBLOCK_ALLOC_ANYWHERE (~(phys_addr_t)0) #define MEMBLOCK_ALLOC_ANYWHERE (~(phys_addr_t)0)
#define MEMBLOCK_ALLOC_ACCESSIBLE 0 #define MEMBLOCK_ALLOC_ACCESSIBLE 0
extern phys_addr_t memblock_alloc_base(phys_addr_t size, phys_addr_t memblock_alloc_base(phys_addr_t size, phys_addr_t align,
phys_addr_t align, phys_addr_t max_addr);
phys_addr_t max_addr); phys_addr_t __memblock_alloc_base(phys_addr_t size, phys_addr_t align,
extern phys_addr_t __memblock_alloc_base(phys_addr_t size, phys_addr_t max_addr);
phys_addr_t align, phys_addr_t memblock_phys_mem_size(void);
phys_addr_t max_addr); phys_addr_t memblock_start_of_DRAM(void);
extern phys_addr_t memblock_phys_mem_size(void); phys_addr_t memblock_end_of_DRAM(void);
extern phys_addr_t memblock_start_of_DRAM(void); void memblock_enforce_memory_limit(phys_addr_t memory_limit);
extern phys_addr_t memblock_end_of_DRAM(void); int memblock_is_memory(phys_addr_t addr);
extern void memblock_enforce_memory_limit(phys_addr_t memory_limit); int memblock_is_region_memory(phys_addr_t base, phys_addr_t size);
extern int memblock_is_memory(phys_addr_t addr); int memblock_is_reserved(phys_addr_t addr);
extern int memblock_is_region_memory(phys_addr_t base, phys_addr_t size); int memblock_is_region_reserved(phys_addr_t base, phys_addr_t size);
extern int memblock_is_reserved(phys_addr_t addr);
extern int memblock_is_region_reserved(phys_addr_t base, phys_addr_t size); void memblock_dump_all(void);
extern void memblock_dump_all(void);
/** /**
* memblock_set_current_limit - Set the current allocation limit to allow * memblock_set_current_limit - Set the current allocation limit to allow
...@@ -143,7 +137,7 @@ extern void memblock_dump_all(void); ...@@ -143,7 +137,7 @@ extern void memblock_dump_all(void);
* accessible during boot * accessible during boot
* @limit: New limit value (physical address) * @limit: New limit value (physical address)
*/ */
extern void memblock_set_current_limit(phys_addr_t limit); void memblock_set_current_limit(phys_addr_t limit);
/* /*
......
...@@ -176,7 +176,7 @@ static void __init_memblock memblock_remove_region(struct memblock_type *type, u ...@@ -176,7 +176,7 @@ static void __init_memblock memblock_remove_region(struct memblock_type *type, u
} }
/* Defined below but needed now */ /* Defined below but needed now */
static long memblock_add_region(struct memblock_type *type, phys_addr_t base, phys_addr_t size); static int memblock_add_region(struct memblock_type *type, phys_addr_t base, phys_addr_t size);
static int __init_memblock memblock_double_array(struct memblock_type *type) static int __init_memblock memblock_double_array(struct memblock_type *type)
{ {
...@@ -316,8 +316,8 @@ static void __init_memblock memblock_insert_region(struct memblock_type *type, ...@@ -316,8 +316,8 @@ static void __init_memblock memblock_insert_region(struct memblock_type *type,
* RETURNS: * RETURNS:
* 0 on success, -errno on failure. * 0 on success, -errno on failure.
*/ */
static long __init_memblock memblock_add_region(struct memblock_type *type, static int __init_memblock memblock_add_region(struct memblock_type *type,
phys_addr_t base, phys_addr_t size) phys_addr_t base, phys_addr_t size)
{ {
bool insert = false; bool insert = false;
phys_addr_t obase = base, end = base + size; phys_addr_t obase = base, end = base + size;
...@@ -387,13 +387,13 @@ static long __init_memblock memblock_add_region(struct memblock_type *type, ...@@ -387,13 +387,13 @@ static long __init_memblock memblock_add_region(struct memblock_type *type,
} }
} }
long __init_memblock memblock_add(phys_addr_t base, phys_addr_t size) int __init_memblock memblock_add(phys_addr_t base, phys_addr_t size)
{ {
return memblock_add_region(&memblock.memory, base, size); return memblock_add_region(&memblock.memory, base, size);
} }
static long __init_memblock __memblock_remove(struct memblock_type *type, static int __init_memblock __memblock_remove(struct memblock_type *type,
phys_addr_t base, phys_addr_t size) phys_addr_t base, phys_addr_t size)
{ {
phys_addr_t end = base + size; phys_addr_t end = base + size;
int i; int i;
...@@ -443,12 +443,12 @@ static long __init_memblock __memblock_remove(struct memblock_type *type, ...@@ -443,12 +443,12 @@ static long __init_memblock __memblock_remove(struct memblock_type *type,
return 0; return 0;
} }
long __init_memblock memblock_remove(phys_addr_t base, phys_addr_t size) int __init_memblock memblock_remove(phys_addr_t base, phys_addr_t size)
{ {
return __memblock_remove(&memblock.memory, base, size); return __memblock_remove(&memblock.memory, base, size);
} }
long __init_memblock memblock_free(phys_addr_t base, phys_addr_t size) int __init_memblock memblock_free(phys_addr_t base, phys_addr_t size)
{ {
memblock_dbg(" memblock_free: [%#016llx-%#016llx] %pF\n", memblock_dbg(" memblock_free: [%#016llx-%#016llx] %pF\n",
(unsigned long long)base, (unsigned long long)base,
...@@ -458,7 +458,7 @@ long __init_memblock memblock_free(phys_addr_t base, phys_addr_t size) ...@@ -458,7 +458,7 @@ long __init_memblock memblock_free(phys_addr_t base, phys_addr_t size)
return __memblock_remove(&memblock.reserved, base, size); return __memblock_remove(&memblock.reserved, base, size);
} }
long __init_memblock memblock_reserve(phys_addr_t base, phys_addr_t size) int __init_memblock memblock_reserve(phys_addr_t base, phys_addr_t size)
{ {
struct memblock_type *_rgn = &memblock.reserved; struct memblock_type *_rgn = &memblock.reserved;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册