Commit b3bdda02aa547a0753b4fdbc105e86ef9046b30b
Committed by
Linus Torvalds
1 parent
48667e7a43
Exists in
master
and in
7 other branches
vmalloc: add const to void* parameters
Make vmalloc functions work the same way as kfree() and friends that take a const void * argument. [akpm@linux-foundation.org: fix consts, coding-style] Signed-off-by: Christoph Lameter <clameter@sgi.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 4 changed files with 17 additions and 17 deletions Side-by-side Diff
include/linux/mm.h
... | ... | @@ -232,8 +232,8 @@ |
232 | 232 | } |
233 | 233 | |
234 | 234 | /* Support for virtually mapped pages */ |
235 | -struct page *vmalloc_to_page(void *addr); | |
236 | -unsigned long vmalloc_to_pfn(void *addr); | |
235 | +struct page *vmalloc_to_page(const void *addr); | |
236 | +unsigned long vmalloc_to_pfn(const void *addr); | |
237 | 237 | |
238 | 238 | static inline struct page *compound_head(struct page *page) |
239 | 239 | { |
include/linux/vmalloc.h
... | ... | @@ -45,11 +45,11 @@ |
45 | 45 | extern void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot); |
46 | 46 | extern void *__vmalloc_area(struct vm_struct *area, gfp_t gfp_mask, |
47 | 47 | pgprot_t prot); |
48 | -extern void vfree(void *addr); | |
48 | +extern void vfree(const void *addr); | |
49 | 49 | |
50 | 50 | extern void *vmap(struct page **pages, unsigned int count, |
51 | 51 | unsigned long flags, pgprot_t prot); |
52 | -extern void vunmap(void *addr); | |
52 | +extern void vunmap(const void *addr); | |
53 | 53 | |
54 | 54 | extern int remap_vmalloc_range(struct vm_area_struct *vma, void *addr, |
55 | 55 | unsigned long pgoff); |
... | ... | @@ -71,7 +71,7 @@ |
71 | 71 | extern struct vm_struct *get_vm_area_node(unsigned long size, |
72 | 72 | unsigned long flags, int node, |
73 | 73 | gfp_t gfp_mask); |
74 | -extern struct vm_struct *remove_vm_area(void *addr); | |
74 | +extern struct vm_struct *remove_vm_area(const void *addr); | |
75 | 75 | |
76 | 76 | extern int map_vm_area(struct vm_struct *area, pgprot_t prot, |
77 | 77 | struct page ***pages); |
mm/nommu.c
... | ... | @@ -167,7 +167,7 @@ |
167 | 167 | DEFINE_RWLOCK(vmlist_lock); |
168 | 168 | struct vm_struct *vmlist; |
169 | 169 | |
170 | -void vfree(void *addr) | |
170 | +void vfree(const void *addr) | |
171 | 171 | { |
172 | 172 | kfree(addr); |
173 | 173 | } |
174 | 174 | |
... | ... | @@ -183,13 +183,13 @@ |
183 | 183 | } |
184 | 184 | EXPORT_SYMBOL(__vmalloc); |
185 | 185 | |
186 | -struct page * vmalloc_to_page(void *addr) | |
186 | +struct page *vmalloc_to_page(const void *addr) | |
187 | 187 | { |
188 | 188 | return virt_to_page(addr); |
189 | 189 | } |
190 | 190 | EXPORT_SYMBOL(vmalloc_to_page); |
191 | 191 | |
192 | -unsigned long vmalloc_to_pfn(void *addr) | |
192 | +unsigned long vmalloc_to_pfn(const void *addr) | |
193 | 193 | { |
194 | 194 | return page_to_pfn(virt_to_page(addr)); |
195 | 195 | } |
... | ... | @@ -267,7 +267,7 @@ |
267 | 267 | } |
268 | 268 | EXPORT_SYMBOL(vmap); |
269 | 269 | |
270 | -void vunmap(void *addr) | |
270 | +void vunmap(const void *addr) | |
271 | 271 | { |
272 | 272 | BUG(); |
273 | 273 | } |
mm/vmalloc.c
... | ... | @@ -169,7 +169,7 @@ |
169 | 169 | /* |
170 | 170 | * Map a vmalloc()-space virtual address to the physical page. |
171 | 171 | */ |
172 | -struct page *vmalloc_to_page(void *vmalloc_addr) | |
172 | +struct page *vmalloc_to_page(const void *vmalloc_addr) | |
173 | 173 | { |
174 | 174 | unsigned long addr = (unsigned long) vmalloc_addr; |
175 | 175 | struct page *page = NULL; |
... | ... | @@ -198,7 +198,7 @@ |
198 | 198 | /* |
199 | 199 | * Map a vmalloc()-space virtual address to the physical page frame number. |
200 | 200 | */ |
201 | -unsigned long vmalloc_to_pfn(void *vmalloc_addr) | |
201 | +unsigned long vmalloc_to_pfn(const void *vmalloc_addr) | |
202 | 202 | { |
203 | 203 | return page_to_pfn(vmalloc_to_page(vmalloc_addr)); |
204 | 204 | } |
... | ... | @@ -306,7 +306,7 @@ |
306 | 306 | } |
307 | 307 | |
308 | 308 | /* Caller must hold vmlist_lock */ |
309 | -static struct vm_struct *__find_vm_area(void *addr) | |
309 | +static struct vm_struct *__find_vm_area(const void *addr) | |
310 | 310 | { |
311 | 311 | struct vm_struct *tmp; |
312 | 312 | |
... | ... | @@ -319,7 +319,7 @@ |
319 | 319 | } |
320 | 320 | |
321 | 321 | /* Caller must hold vmlist_lock */ |
322 | -static struct vm_struct *__remove_vm_area(void *addr) | |
322 | +static struct vm_struct *__remove_vm_area(const void *addr) | |
323 | 323 | { |
324 | 324 | struct vm_struct **p, *tmp; |
325 | 325 | |
... | ... | @@ -348,7 +348,7 @@ |
348 | 348 | * This function returns the found VM area, but using it is NOT safe |
349 | 349 | * on SMP machines, except for its size or flags. |
350 | 350 | */ |
351 | -struct vm_struct *remove_vm_area(void *addr) | |
351 | +struct vm_struct *remove_vm_area(const void *addr) | |
352 | 352 | { |
353 | 353 | struct vm_struct *v; |
354 | 354 | write_lock(&vmlist_lock); |
... | ... | @@ -357,7 +357,7 @@ |
357 | 357 | return v; |
358 | 358 | } |
359 | 359 | |
360 | -static void __vunmap(void *addr, int deallocate_pages) | |
360 | +static void __vunmap(const void *addr, int deallocate_pages) | |
361 | 361 | { |
362 | 362 | struct vm_struct *area; |
363 | 363 | |
... | ... | @@ -408,7 +408,7 @@ |
408 | 408 | * |
409 | 409 | * Must not be called in interrupt context. |
410 | 410 | */ |
411 | -void vfree(void *addr) | |
411 | +void vfree(const void *addr) | |
412 | 412 | { |
413 | 413 | BUG_ON(in_interrupt()); |
414 | 414 | __vunmap(addr, 1); |
... | ... | @@ -424,7 +424,7 @@ |
424 | 424 | * |
425 | 425 | * Must not be called in interrupt context. |
426 | 426 | */ |
427 | -void vunmap(void *addr) | |
427 | +void vunmap(const void *addr) | |
428 | 428 | { |
429 | 429 | BUG_ON(in_interrupt()); |
430 | 430 | __vunmap(addr, 0); |