Let's move walk_memory_blocks() to the place where memory block logic resides and simplify it. While at it, add a type for the callback function.
Showing the changes to include/linux (2 of 4 files). Show all
Unified · Split
| @@ -119,6 +119,9 @@ extern int memory_isolate_notify(unsigned long val, void *v); · 118 unmodified lines | |||
| 119 | extern struct memory_block *find_memory_block_hinted(struct mem_section *, | 119 | extern struct memory_block *find_memory_block_hinted(struct mem_section *, |
| 120 | struct memory_block *); | 120 | struct memory_block *); |
| 121 | extern struct memory_block *find_memory_block(struct mem_section *); | 121 | extern struct memory_block *find_memory_block(struct mem_section *); |
| 122 | typedef int (*walk_memory_blocks_func_t)(struct memory_block *, void *); | ||
| 123 | extern int walk_memory_blocks(unsigned long start, unsigned long size, | ||
| 124 | void *arg, walk_memory_blocks_func_t func); | ||
| 122 | #define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT) | 125 | #define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT) |
| 123 | #endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */ | 126 | #endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */ |
| 124 | 127 | ||
| @@ -340,8 +340,6 @@ static inline void __remove_memory(int nid, u64 start, u64 size) {} · 339 unmodified lines | |||
| 340 | #endif /* CONFIG_MEMORY_HOTREMOVE */ | 340 | #endif /* CONFIG_MEMORY_HOTREMOVE */ |
| 341 | 341 | ||
| 342 | extern void __ref free_area_init_core_hotplug(int nid); | 342 | extern void __ref free_area_init_core_hotplug(int nid); |
| 343 | extern int walk_memory_blocks(unsigned long start, unsigned long size, | ||
| 344 | void *arg, int (*func)(struct memory_block *, void *)); | ||
| 345 | extern int __add_memory(int nid, u64 start, u64 size); | 343 | extern int __add_memory(int nid, u64 start, u64 size); |
| 346 | extern int add_memory(int nid, u64 start, u64 size); | 344 | extern int add_memory(int nid, u64 start, u64 size); |
| 347 | extern int add_memory_resource(int nid, struct resource *resource); | 345 | extern int add_memory_resource(int nid, struct resource *resource); |