diff options
author | Mike Rapoport <rppt@linux.vnet.ibm.com> | 2018-06-30 10:55:01 -0400 |
---|---|---|
committer | Jonathan Corbet <corbet@lwn.net> | 2018-08-02 14:17:27 -0400 |
commit | e1720fee27246dfb84f7c433e35367170a2d4436 (patch) | |
tree | 692ff63348b891ca6eea2052f79f60ed1576b7e6 | |
parent | 58faef9328f7d66b377cb34a20331c4310cdbd5e (diff) |
mm/memblock: add a name for memblock flags enumeration
Since kernel-doc does not like anonymous enums the name is required for
adding documentation. While on it, I've also updated all the function
declarations to use 'enum memblock_flags' instead of unsigned long.
Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
-rw-r--r-- | include/linux/memblock.h | 22 | ||||
-rw-r--r-- | mm/memblock.c | 37 | ||||
-rw-r--r-- | mm/nobootmem.c | 2 |
3 files changed, 33 insertions, 28 deletions
diff --git a/include/linux/memblock.h b/include/linux/memblock.h index ca59883c8364..8b8fbceffd4d 100644 --- a/include/linux/memblock.h +++ b/include/linux/memblock.h | |||
@@ -21,7 +21,7 @@ | |||
21 | #define INIT_PHYSMEM_REGIONS 4 | 21 | #define INIT_PHYSMEM_REGIONS 4 |
22 | 22 | ||
23 | /* Definition of memblock flags. */ | 23 | /* Definition of memblock flags. */ |
24 | enum { | 24 | enum memblock_flags { |
25 | MEMBLOCK_NONE = 0x0, /* No special request */ | 25 | MEMBLOCK_NONE = 0x0, /* No special request */ |
26 | MEMBLOCK_HOTPLUG = 0x1, /* hotpluggable region */ | 26 | MEMBLOCK_HOTPLUG = 0x1, /* hotpluggable region */ |
27 | MEMBLOCK_MIRROR = 0x2, /* mirrored region */ | 27 | MEMBLOCK_MIRROR = 0x2, /* mirrored region */ |
@@ -31,7 +31,7 @@ enum { | |||
31 | struct memblock_region { | 31 | struct memblock_region { |
32 | phys_addr_t base; | 32 | phys_addr_t base; |
33 | phys_addr_t size; | 33 | phys_addr_t size; |
34 | unsigned long flags; | 34 | enum memblock_flags flags; |
35 | #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP | 35 | #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP |
36 | int nid; | 36 | int nid; |
37 | #endif | 37 | #endif |
@@ -72,7 +72,7 @@ void memblock_discard(void); | |||
72 | 72 | ||
73 | phys_addr_t memblock_find_in_range_node(phys_addr_t size, phys_addr_t align, | 73 | phys_addr_t memblock_find_in_range_node(phys_addr_t size, phys_addr_t align, |
74 | phys_addr_t start, phys_addr_t end, | 74 | phys_addr_t start, phys_addr_t end, |
75 | int nid, ulong flags); | 75 | int nid, enum memblock_flags flags); |
76 | phys_addr_t memblock_find_in_range(phys_addr_t start, phys_addr_t end, | 76 | phys_addr_t memblock_find_in_range(phys_addr_t start, phys_addr_t end, |
77 | phys_addr_t size, phys_addr_t align); | 77 | phys_addr_t size, phys_addr_t align); |
78 | void memblock_allow_resize(void); | 78 | void memblock_allow_resize(void); |
@@ -89,19 +89,19 @@ int memblock_clear_hotplug(phys_addr_t base, phys_addr_t size); | |||
89 | int memblock_mark_mirror(phys_addr_t base, phys_addr_t size); | 89 | int memblock_mark_mirror(phys_addr_t base, phys_addr_t size); |
90 | int memblock_mark_nomap(phys_addr_t base, phys_addr_t size); | 90 | int memblock_mark_nomap(phys_addr_t base, phys_addr_t size); |
91 | int memblock_clear_nomap(phys_addr_t base, phys_addr_t size); | 91 | int memblock_clear_nomap(phys_addr_t base, phys_addr_t size); |
92 | ulong choose_memblock_flags(void); | 92 | enum memblock_flags choose_memblock_flags(void); |
93 | 93 | ||
94 | /* Low level functions */ | 94 | /* Low level functions */ |
95 | int memblock_add_range(struct memblock_type *type, | 95 | int memblock_add_range(struct memblock_type *type, |
96 | phys_addr_t base, phys_addr_t size, | 96 | phys_addr_t base, phys_addr_t size, |
97 | int nid, unsigned long flags); | 97 | int nid, enum memblock_flags flags); |
98 | 98 | ||
99 | void __next_mem_range(u64 *idx, int nid, ulong flags, | 99 | void __next_mem_range(u64 *idx, int nid, enum memblock_flags flags, |
100 | struct memblock_type *type_a, | 100 | struct memblock_type *type_a, |
101 | struct memblock_type *type_b, phys_addr_t *out_start, | 101 | struct memblock_type *type_b, phys_addr_t *out_start, |
102 | phys_addr_t *out_end, int *out_nid); | 102 | phys_addr_t *out_end, int *out_nid); |
103 | 103 | ||
104 | void __next_mem_range_rev(u64 *idx, int nid, ulong flags, | 104 | void __next_mem_range_rev(u64 *idx, int nid, enum memblock_flags flags, |
105 | struct memblock_type *type_a, | 105 | struct memblock_type *type_a, |
106 | struct memblock_type *type_b, phys_addr_t *out_start, | 106 | struct memblock_type *type_b, phys_addr_t *out_start, |
107 | phys_addr_t *out_end, int *out_nid); | 107 | phys_addr_t *out_end, int *out_nid); |
@@ -253,13 +253,13 @@ void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn, | |||
253 | NUMA_NO_NODE, MEMBLOCK_NONE, p_start, p_end, NULL) | 253 | NUMA_NO_NODE, MEMBLOCK_NONE, p_start, p_end, NULL) |
254 | 254 | ||
255 | static inline void memblock_set_region_flags(struct memblock_region *r, | 255 | static inline void memblock_set_region_flags(struct memblock_region *r, |
256 | unsigned long flags) | 256 | enum memblock_flags flags) |
257 | { | 257 | { |
258 | r->flags |= flags; | 258 | r->flags |= flags; |
259 | } | 259 | } |
260 | 260 | ||
261 | static inline void memblock_clear_region_flags(struct memblock_region *r, | 261 | static inline void memblock_clear_region_flags(struct memblock_region *r, |
262 | unsigned long flags) | 262 | enum memblock_flags flags) |
263 | { | 263 | { |
264 | r->flags &= ~flags; | 264 | r->flags &= ~flags; |
265 | } | 265 | } |
@@ -317,10 +317,10 @@ static inline bool memblock_bottom_up(void) | |||
317 | 317 | ||
318 | phys_addr_t __init memblock_alloc_range(phys_addr_t size, phys_addr_t align, | 318 | phys_addr_t __init memblock_alloc_range(phys_addr_t size, phys_addr_t align, |
319 | phys_addr_t start, phys_addr_t end, | 319 | phys_addr_t start, phys_addr_t end, |
320 | ulong flags); | 320 | enum memblock_flags flags); |
321 | phys_addr_t memblock_alloc_base_nid(phys_addr_t size, | 321 | phys_addr_t memblock_alloc_base_nid(phys_addr_t size, |
322 | phys_addr_t align, phys_addr_t max_addr, | 322 | phys_addr_t align, phys_addr_t max_addr, |
323 | int nid, ulong flags); | 323 | int nid, enum memblock_flags flags); |
324 | phys_addr_t memblock_alloc_base(phys_addr_t size, phys_addr_t align, | 324 | phys_addr_t memblock_alloc_base(phys_addr_t size, phys_addr_t align, |
325 | phys_addr_t max_addr); | 325 | phys_addr_t max_addr); |
326 | phys_addr_t __memblock_alloc_base(phys_addr_t size, phys_addr_t align, | 326 | phys_addr_t __memblock_alloc_base(phys_addr_t size, phys_addr_t align, |
diff --git a/mm/memblock.c b/mm/memblock.c index 03d48d8835ba..20f48b49821a 100644 --- a/mm/memblock.c +++ b/mm/memblock.c | |||
@@ -60,7 +60,7 @@ static int memblock_can_resize __initdata_memblock; | |||
60 | static int memblock_memory_in_slab __initdata_memblock = 0; | 60 | static int memblock_memory_in_slab __initdata_memblock = 0; |
61 | static int memblock_reserved_in_slab __initdata_memblock = 0; | 61 | static int memblock_reserved_in_slab __initdata_memblock = 0; |
62 | 62 | ||
63 | ulong __init_memblock choose_memblock_flags(void) | 63 | enum memblock_flags __init_memblock choose_memblock_flags(void) |
64 | { | 64 | { |
65 | return system_has_some_mirror ? MEMBLOCK_MIRROR : MEMBLOCK_NONE; | 65 | return system_has_some_mirror ? MEMBLOCK_MIRROR : MEMBLOCK_NONE; |
66 | } | 66 | } |
@@ -109,7 +109,7 @@ bool __init_memblock memblock_overlaps_region(struct memblock_type *type, | |||
109 | static phys_addr_t __init_memblock | 109 | static phys_addr_t __init_memblock |
110 | __memblock_find_range_bottom_up(phys_addr_t start, phys_addr_t end, | 110 | __memblock_find_range_bottom_up(phys_addr_t start, phys_addr_t end, |
111 | phys_addr_t size, phys_addr_t align, int nid, | 111 | phys_addr_t size, phys_addr_t align, int nid, |
112 | ulong flags) | 112 | enum memblock_flags flags) |
113 | { | 113 | { |
114 | phys_addr_t this_start, this_end, cand; | 114 | phys_addr_t this_start, this_end, cand; |
115 | u64 i; | 115 | u64 i; |
@@ -143,7 +143,7 @@ __memblock_find_range_bottom_up(phys_addr_t start, phys_addr_t end, | |||
143 | static phys_addr_t __init_memblock | 143 | static phys_addr_t __init_memblock |
144 | __memblock_find_range_top_down(phys_addr_t start, phys_addr_t end, | 144 | __memblock_find_range_top_down(phys_addr_t start, phys_addr_t end, |
145 | phys_addr_t size, phys_addr_t align, int nid, | 145 | phys_addr_t size, phys_addr_t align, int nid, |
146 | ulong flags) | 146 | enum memblock_flags flags) |
147 | { | 147 | { |
148 | phys_addr_t this_start, this_end, cand; | 148 | phys_addr_t this_start, this_end, cand; |
149 | u64 i; | 149 | u64 i; |
@@ -188,7 +188,8 @@ __memblock_find_range_top_down(phys_addr_t start, phys_addr_t end, | |||
188 | */ | 188 | */ |
189 | phys_addr_t __init_memblock memblock_find_in_range_node(phys_addr_t size, | 189 | phys_addr_t __init_memblock memblock_find_in_range_node(phys_addr_t size, |
190 | phys_addr_t align, phys_addr_t start, | 190 | phys_addr_t align, phys_addr_t start, |
191 | phys_addr_t end, int nid, ulong flags) | 191 | phys_addr_t end, int nid, |
192 | enum memblock_flags flags) | ||
192 | { | 193 | { |
193 | phys_addr_t kernel_end, ret; | 194 | phys_addr_t kernel_end, ret; |
194 | 195 | ||
@@ -251,7 +252,7 @@ phys_addr_t __init_memblock memblock_find_in_range(phys_addr_t start, | |||
251 | phys_addr_t align) | 252 | phys_addr_t align) |
252 | { | 253 | { |
253 | phys_addr_t ret; | 254 | phys_addr_t ret; |
254 | ulong flags = choose_memblock_flags(); | 255 | enum memblock_flags flags = choose_memblock_flags(); |
255 | 256 | ||
256 | again: | 257 | again: |
257 | ret = memblock_find_in_range_node(size, align, start, end, | 258 | ret = memblock_find_in_range_node(size, align, start, end, |
@@ -472,7 +473,8 @@ static void __init_memblock memblock_merge_regions(struct memblock_type *type) | |||
472 | static void __init_memblock memblock_insert_region(struct memblock_type *type, | 473 | static void __init_memblock memblock_insert_region(struct memblock_type *type, |
473 | int idx, phys_addr_t base, | 474 | int idx, phys_addr_t base, |
474 | phys_addr_t size, | 475 | phys_addr_t size, |
475 | int nid, unsigned long flags) | 476 | int nid, |
477 | enum memblock_flags flags) | ||
476 | { | 478 | { |
477 | struct memblock_region *rgn = &type->regions[idx]; | 479 | struct memblock_region *rgn = &type->regions[idx]; |
478 | 480 | ||
@@ -504,7 +506,7 @@ static void __init_memblock memblock_insert_region(struct memblock_type *type, | |||
504 | */ | 506 | */ |
505 | int __init_memblock memblock_add_range(struct memblock_type *type, | 507 | int __init_memblock memblock_add_range(struct memblock_type *type, |
506 | phys_addr_t base, phys_addr_t size, | 508 | phys_addr_t base, phys_addr_t size, |
507 | int nid, unsigned long flags) | 509 | int nid, enum memblock_flags flags) |
508 | { | 510 | { |
509 | bool insert = false; | 511 | bool insert = false; |
510 | phys_addr_t obase = base; | 512 | phys_addr_t obase = base; |
@@ -873,7 +875,8 @@ void __init_memblock __next_reserved_mem_region(u64 *idx, | |||
873 | * As both region arrays are sorted, the function advances the two indices | 875 | * As both region arrays are sorted, the function advances the two indices |
874 | * in lockstep and returns each intersection. | 876 | * in lockstep and returns each intersection. |
875 | */ | 877 | */ |
876 | void __init_memblock __next_mem_range(u64 *idx, int nid, ulong flags, | 878 | void __init_memblock __next_mem_range(u64 *idx, int nid, |
879 | enum memblock_flags flags, | ||
877 | struct memblock_type *type_a, | 880 | struct memblock_type *type_a, |
878 | struct memblock_type *type_b, | 881 | struct memblock_type *type_b, |
879 | phys_addr_t *out_start, | 882 | phys_addr_t *out_start, |
@@ -982,7 +985,8 @@ void __init_memblock __next_mem_range(u64 *idx, int nid, ulong flags, | |||
982 | * | 985 | * |
983 | * Reverse of __next_mem_range(). | 986 | * Reverse of __next_mem_range(). |
984 | */ | 987 | */ |
985 | void __init_memblock __next_mem_range_rev(u64 *idx, int nid, ulong flags, | 988 | void __init_memblock __next_mem_range_rev(u64 *idx, int nid, |
989 | enum memblock_flags flags, | ||
986 | struct memblock_type *type_a, | 990 | struct memblock_type *type_a, |
987 | struct memblock_type *type_b, | 991 | struct memblock_type *type_b, |
988 | phys_addr_t *out_start, | 992 | phys_addr_t *out_start, |
@@ -1140,7 +1144,8 @@ int __init_memblock memblock_set_node(phys_addr_t base, phys_addr_t size, | |||
1140 | 1144 | ||
1141 | static phys_addr_t __init memblock_alloc_range_nid(phys_addr_t size, | 1145 | static phys_addr_t __init memblock_alloc_range_nid(phys_addr_t size, |
1142 | phys_addr_t align, phys_addr_t start, | 1146 | phys_addr_t align, phys_addr_t start, |
1143 | phys_addr_t end, int nid, ulong flags) | 1147 | phys_addr_t end, int nid, |
1148 | enum memblock_flags flags) | ||
1144 | { | 1149 | { |
1145 | phys_addr_t found; | 1150 | phys_addr_t found; |
1146 | 1151 | ||
@@ -1162,7 +1167,7 @@ static phys_addr_t __init memblock_alloc_range_nid(phys_addr_t size, | |||
1162 | 1167 | ||
1163 | phys_addr_t __init memblock_alloc_range(phys_addr_t size, phys_addr_t align, | 1168 | phys_addr_t __init memblock_alloc_range(phys_addr_t size, phys_addr_t align, |
1164 | phys_addr_t start, phys_addr_t end, | 1169 | phys_addr_t start, phys_addr_t end, |
1165 | ulong flags) | 1170 | enum memblock_flags flags) |
1166 | { | 1171 | { |
1167 | return memblock_alloc_range_nid(size, align, start, end, NUMA_NO_NODE, | 1172 | return memblock_alloc_range_nid(size, align, start, end, NUMA_NO_NODE, |
1168 | flags); | 1173 | flags); |
@@ -1170,14 +1175,14 @@ phys_addr_t __init memblock_alloc_range(phys_addr_t size, phys_addr_t align, | |||
1170 | 1175 | ||
1171 | phys_addr_t __init memblock_alloc_base_nid(phys_addr_t size, | 1176 | phys_addr_t __init memblock_alloc_base_nid(phys_addr_t size, |
1172 | phys_addr_t align, phys_addr_t max_addr, | 1177 | phys_addr_t align, phys_addr_t max_addr, |
1173 | int nid, ulong flags) | 1178 | int nid, enum memblock_flags flags) |
1174 | { | 1179 | { |
1175 | return memblock_alloc_range_nid(size, align, 0, max_addr, nid, flags); | 1180 | return memblock_alloc_range_nid(size, align, 0, max_addr, nid, flags); |
1176 | } | 1181 | } |
1177 | 1182 | ||
1178 | phys_addr_t __init memblock_alloc_nid(phys_addr_t size, phys_addr_t align, int nid) | 1183 | phys_addr_t __init memblock_alloc_nid(phys_addr_t size, phys_addr_t align, int nid) |
1179 | { | 1184 | { |
1180 | ulong flags = choose_memblock_flags(); | 1185 | enum memblock_flags flags = choose_memblock_flags(); |
1181 | phys_addr_t ret; | 1186 | phys_addr_t ret; |
1182 | 1187 | ||
1183 | again: | 1188 | again: |
@@ -1258,7 +1263,7 @@ static void * __init memblock_virt_alloc_internal( | |||
1258 | { | 1263 | { |
1259 | phys_addr_t alloc; | 1264 | phys_addr_t alloc; |
1260 | void *ptr; | 1265 | void *ptr; |
1261 | ulong flags = choose_memblock_flags(); | 1266 | enum memblock_flags flags = choose_memblock_flags(); |
1262 | 1267 | ||
1263 | if (WARN_ONCE(nid == MAX_NUMNODES, "Usage of MAX_NUMNODES is deprecated. Use NUMA_NO_NODE instead\n")) | 1268 | if (WARN_ONCE(nid == MAX_NUMNODES, "Usage of MAX_NUMNODES is deprecated. Use NUMA_NO_NODE instead\n")) |
1264 | nid = NUMA_NO_NODE; | 1269 | nid = NUMA_NO_NODE; |
@@ -1733,7 +1738,7 @@ phys_addr_t __init_memblock memblock_get_current_limit(void) | |||
1733 | static void __init_memblock memblock_dump(struct memblock_type *type) | 1738 | static void __init_memblock memblock_dump(struct memblock_type *type) |
1734 | { | 1739 | { |
1735 | phys_addr_t base, end, size; | 1740 | phys_addr_t base, end, size; |
1736 | unsigned long flags; | 1741 | enum memblock_flags flags; |
1737 | int idx; | 1742 | int idx; |
1738 | struct memblock_region *rgn; | 1743 | struct memblock_region *rgn; |
1739 | 1744 | ||
@@ -1751,7 +1756,7 @@ static void __init_memblock memblock_dump(struct memblock_type *type) | |||
1751 | snprintf(nid_buf, sizeof(nid_buf), " on node %d", | 1756 | snprintf(nid_buf, sizeof(nid_buf), " on node %d", |
1752 | memblock_get_region_node(rgn)); | 1757 | memblock_get_region_node(rgn)); |
1753 | #endif | 1758 | #endif |
1754 | pr_info(" %s[%#x]\t[%pa-%pa], %pa bytes%s flags: %#lx\n", | 1759 | pr_info(" %s[%#x]\t[%pa-%pa], %pa bytes%s flags: %#x\n", |
1755 | type->name, idx, &base, &end, &size, nid_buf, flags); | 1760 | type->name, idx, &base, &end, &size, nid_buf, flags); |
1756 | } | 1761 | } |
1757 | } | 1762 | } |
diff --git a/mm/nobootmem.c b/mm/nobootmem.c index c2cfa04f0231..439af3b765a7 100644 --- a/mm/nobootmem.c +++ b/mm/nobootmem.c | |||
@@ -42,7 +42,7 @@ static void * __init __alloc_memory_core_early(int nid, u64 size, u64 align, | |||
42 | { | 42 | { |
43 | void *ptr; | 43 | void *ptr; |
44 | u64 addr; | 44 | u64 addr; |
45 | ulong flags = choose_memblock_flags(); | 45 | enum memblock_flags flags = choose_memblock_flags(); |
46 | 46 | ||
47 | if (limit > memblock.current_limit) | 47 | if (limit > memblock.current_limit) |
48 | limit = memblock.current_limit; | 48 | limit = memblock.current_limit; |