diff options
author | Mike Frysinger <michael.frysinger@analog.com> | 2007-07-12 00:32:00 -0400 |
---|---|---|
committer | Bryan Wu <bryan.wu@analog.com> | 2007-07-12 00:32:00 -0400 |
commit | 1d1894749cca89f4bb013364524199b3015d7b00 (patch) | |
tree | 5b38641977f0964bc76432f928e50a4223cdc3f2 /arch/blackfin/mm | |
parent | 5610db61cf2945a5e74667e952f2792c96ba53a1 (diff) |
Blackfin arch: combine the common code of free_initrd_mem and free_initmem
Signed-off-by: Mike Frysinger <michael.frysinger@analog.com>
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Diffstat (limited to 'arch/blackfin/mm')
-rw-r--r-- | arch/blackfin/mm/init.c | 45 |
1 files changed, 17 insertions, 28 deletions
diff --git a/arch/blackfin/mm/init.c b/arch/blackfin/mm/init.c index 2d12449be596..68459cc052a1 100644 --- a/arch/blackfin/mm/init.c +++ b/arch/blackfin/mm/init.c | |||
@@ -168,42 +168,31 @@ void __init mem_init(void) | |||
168 | } | 168 | } |
169 | } | 169 | } |
170 | 170 | ||
171 | #ifdef CONFIG_BLK_DEV_INITRD | 171 | static __init void free_init_pages(const char *what, unsigned long begin, unsigned long end) |
172 | void __init free_initrd_mem(unsigned long start, unsigned long end) | ||
173 | { | 172 | { |
174 | int pages = 0; | 173 | unsigned long addr; |
175 | for (; start < end; start += PAGE_SIZE) { | 174 | /* next to check that the page we free is not a partial page */ |
176 | ClearPageReserved(virt_to_page(start)); | 175 | for (addr = begin; addr + PAGE_SIZE <= end; addr += PAGE_SIZE) { |
177 | init_page_count(virt_to_page(start)); | 176 | ClearPageReserved(virt_to_page(addr)); |
178 | free_page(start); | 177 | init_page_count(virt_to_page(addr)); |
178 | free_page(addr); | ||
179 | totalram_pages++; | 179 | totalram_pages++; |
180 | pages++; | ||
181 | } | 180 | } |
182 | printk(KERN_NOTICE "Freeing initrd memory: %dk freed\n", pages); | 181 | printk(KERN_INFO "Freeing %s: %ldk freed\n", what, (end - begin) >> 10); |
182 | } | ||
183 | |||
184 | #ifdef CONFIG_BLK_DEV_INITRD | ||
185 | void __init free_initrd_mem(unsigned long start, unsigned long end) | ||
186 | { | ||
187 | free_init_pages("initrd memory", start, end); | ||
183 | } | 188 | } |
184 | #endif | 189 | #endif |
185 | 190 | ||
186 | void __init free_initmem(void) | 191 | void __init free_initmem(void) |
187 | { | 192 | { |
188 | #ifdef CONFIG_RAMKERNEL | 193 | #ifdef CONFIG_RAMKERNEL |
189 | unsigned long addr; | 194 | free_init_pages("unused kernel memory", |
190 | /* | 195 | (unsigned long)(&__init_begin), |
191 | * the following code should be cool even if these sections | 196 | (unsigned long)(&__init_end)); |
192 | * are not page aligned. | ||
193 | */ | ||
194 | addr = PAGE_ALIGN((unsigned long)(__init_begin)); | ||
195 | /* next to check that the page we free is not a partial page */ | ||
196 | for (; addr + PAGE_SIZE < (unsigned long)(__init_end); | ||
197 | addr += PAGE_SIZE) { | ||
198 | ClearPageReserved(virt_to_page(addr)); | ||
199 | init_page_count(virt_to_page(addr)); | ||
200 | free_page(addr); | ||
201 | totalram_pages++; | ||
202 | } | ||
203 | printk(KERN_NOTICE | ||
204 | "Freeing unused kernel memory: %ldk freed (0x%x - 0x%x)\n", | ||
205 | (addr - PAGE_ALIGN((long)__init_begin)) >> 10, | ||
206 | (int)(PAGE_ALIGN((unsigned long)(__init_begin))), | ||
207 | (int)(addr - PAGE_SIZE)); | ||
208 | #endif | 197 | #endif |
209 | } | 198 | } |