aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2007-02-10 04:44:10 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-11 13:51:22 -0500
commit60678bbc76685bea47043e61981b8fc5cffc10da (patch)
tree6d4844a2c126ad0c47cfe863671e74592fe0ee2a /arch
parent94c282d79e17a83ccc876990e05378ed6dfbccae (diff)
[PATCH] uml: mem.c and physmem.c formatting fixes
Fix a bunch of style violations in mem.c and physmem.c Signed-off-by: Jeff Dike <jdike@addtoit.com> Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/um/kernel/mem.c77
-rw-r--r--arch/um/kernel/physmem.c57
2 files changed, 57 insertions, 77 deletions
diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
index fb11992f0b8a..d1480ff0f2a6 100644
--- a/arch/um/kernel/mem.c
+++ b/arch/um/kernel/mem.c
@@ -65,8 +65,8 @@ void mem_init(void)
65{ 65{
66 max_low_pfn = (high_physmem - uml_physmem) >> PAGE_SHIFT; 66 max_low_pfn = (high_physmem - uml_physmem) >> PAGE_SHIFT;
67 67
68 /* clear the zero-page */ 68 /* clear the zero-page */
69 memset((void *) empty_zero_page, 0, PAGE_SIZE); 69 memset((void *) empty_zero_page, 0, PAGE_SIZE);
70 70
71 /* Map in the area just after the brk now that kmalloc is about 71 /* Map in the area just after the brk now that kmalloc is about
72 * to be turned on. 72 * to be turned on.
@@ -253,8 +253,10 @@ struct page *arch_validate(struct page *page, gfp_t mask, int order)
253 int i; 253 int i;
254 254
255 again: 255 again:
256 if(page == NULL) return(page); 256 if(page == NULL)
257 if(PageHighMem(page)) return(page); 257 return page;
258 if(PageHighMem(page))
259 return page;
258 260
259 addr = (unsigned long) page_address(page); 261 addr = (unsigned long) page_address(page);
260 for(i = 0; i < (1 << order); i++){ 262 for(i = 0; i < (1 << order); i++){
@@ -263,13 +265,15 @@ struct page *arch_validate(struct page *page, gfp_t mask, int order)
263 sizeof(zero), 265 sizeof(zero),
264 &current->thread.fault_addr, 266 &current->thread.fault_addr,
265 &current->thread.fault_catcher)){ 267 &current->thread.fault_catcher)){
266 if(!(mask & __GFP_WAIT)) return(NULL); 268 if(!(mask & __GFP_WAIT))
269 return NULL;
267 else break; 270 else break;
268 } 271 }
269 addr += PAGE_SIZE; 272 addr += PAGE_SIZE;
270 } 273 }
271 274
272 if(i == (1 << order)) return(page); 275 if(i == (1 << order))
276 return page;
273 page = alloc_pages(mask, order); 277 page = alloc_pages(mask, order);
274 goto again; 278 goto again;
275} 279}
@@ -283,7 +287,6 @@ void free_initmem(void)
283} 287}
284 288
285#ifdef CONFIG_BLK_DEV_INITRD 289#ifdef CONFIG_BLK_DEV_INITRD
286
287void free_initrd_mem(unsigned long start, unsigned long end) 290void free_initrd_mem(unsigned long start, unsigned long end)
288{ 291{
289 if (start < end) 292 if (start < end)
@@ -296,37 +299,36 @@ void free_initrd_mem(unsigned long start, unsigned long end)
296 totalram_pages++; 299 totalram_pages++;
297 } 300 }
298} 301}
299
300#endif 302#endif
301 303
302void show_mem(void) 304void show_mem(void)
303{ 305{
304 int pfn, total = 0, reserved = 0; 306 int pfn, total = 0, reserved = 0;
305 int shared = 0, cached = 0; 307 int shared = 0, cached = 0;
306 int highmem = 0; 308 int highmem = 0;
307 struct page *page; 309 struct page *page;
308 310
309 printk("Mem-info:\n"); 311 printk("Mem-info:\n");
310 show_free_areas(); 312 show_free_areas();
311 printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10)); 313 printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10));
312 pfn = max_mapnr; 314 pfn = max_mapnr;
313 while(pfn-- > 0) { 315 while(pfn-- > 0) {
314 page = pfn_to_page(pfn); 316 page = pfn_to_page(pfn);
315 total++; 317 total++;
316 if(PageHighMem(page)) 318 if(PageHighMem(page))
317 highmem++; 319 highmem++;
318 if(PageReserved(page)) 320 if(PageReserved(page))
319 reserved++; 321 reserved++;
320 else if(PageSwapCache(page)) 322 else if(PageSwapCache(page))
321 cached++; 323 cached++;
322 else if(page_count(page)) 324 else if(page_count(page))
323 shared += page_count(page) - 1; 325 shared += page_count(page) - 1;
324 } 326 }
325 printk("%d pages of RAM\n", total); 327 printk("%d pages of RAM\n", total);
326 printk("%d pages of HIGHMEM\n", highmem); 328 printk("%d pages of HIGHMEM\n", highmem);
327 printk("%d reserved pages\n", reserved); 329 printk("%d reserved pages\n", reserved);
328 printk("%d pages shared\n", shared); 330 printk("%d pages shared\n", shared);
329 printk("%d pages swap cached\n", cached); 331 printk("%d pages swap cached\n", cached);
330} 332}
331 333
332/* 334/*
@@ -362,18 +364,7 @@ pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
362struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address) 364struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address)
363{ 365{
364 struct page *pte; 366 struct page *pte;
365 367
366 pte = alloc_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO); 368 pte = alloc_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
367 return pte; 369 return pte;
368} 370}
369
370/*
371 * Overrides for Emacs so that we follow Linus's tabbing style.
372 * Emacs will notice this stuff at the end of the file and automatically
373 * adjust the settings for this buffer only. This must remain at the end
374 * of the file.
375 * ---------------------------------------------------------------------------
376 * Local variables:
377 * c-file-style: "linux"
378 * End:
379 */
diff --git a/arch/um/kernel/physmem.c b/arch/um/kernel/physmem.c
index 22d3cf359669..638f3b5f6094 100644
--- a/arch/um/kernel/physmem.c
+++ b/arch/um/kernel/physmem.c
@@ -40,7 +40,7 @@ static struct rb_node **find_rb(void *virt)
40 while(*n != NULL){ 40 while(*n != NULL){
41 d = rb_entry(*n, struct phys_desc, rb); 41 d = rb_entry(*n, struct phys_desc, rb);
42 if(d->virt == virt) 42 if(d->virt == virt)
43 return(n); 43 return n;
44 44
45 if(d->virt > virt) 45 if(d->virt > virt)
46 n = &(*n)->rb_left; 46 n = &(*n)->rb_left;
@@ -48,7 +48,7 @@ static struct rb_node **find_rb(void *virt)
48 n = &(*n)->rb_right; 48 n = &(*n)->rb_right;
49 } 49 }
50 50
51 return(n); 51 return n;
52} 52}
53 53
54static struct phys_desc *find_phys_mapping(void *virt) 54static struct phys_desc *find_phys_mapping(void *virt)
@@ -56,9 +56,9 @@ static struct phys_desc *find_phys_mapping(void *virt)
56 struct rb_node **n = find_rb(virt); 56 struct rb_node **n = find_rb(virt);
57 57
58 if(*n == NULL) 58 if(*n == NULL)
59 return(NULL); 59 return NULL;
60 60
61 return(rb_entry(*n, struct phys_desc, rb)); 61 return rb_entry(*n, struct phys_desc, rb);
62} 62}
63 63
64static void insert_phys_mapping(struct phys_desc *desc) 64static void insert_phys_mapping(struct phys_desc *desc)
@@ -89,10 +89,10 @@ static struct desc_mapping *find_mapping(int fd)
89 list_for_each(ele, &descriptor_mappings){ 89 list_for_each(ele, &descriptor_mappings){
90 desc = list_entry(ele, struct desc_mapping, list); 90 desc = list_entry(ele, struct desc_mapping, list);
91 if(desc->fd == fd) 91 if(desc->fd == fd)
92 return(desc); 92 return desc;
93 } 93 }
94 94
95 return(NULL); 95 return NULL;
96} 96}
97 97
98static struct desc_mapping *descriptor_mapping(int fd) 98static struct desc_mapping *descriptor_mapping(int fd)
@@ -101,11 +101,11 @@ static struct desc_mapping *descriptor_mapping(int fd)
101 101
102 desc = find_mapping(fd); 102 desc = find_mapping(fd);
103 if(desc != NULL) 103 if(desc != NULL)
104 return(desc); 104 return desc;
105 105
106 desc = kmalloc(sizeof(*desc), GFP_ATOMIC); 106 desc = kmalloc(sizeof(*desc), GFP_ATOMIC);
107 if(desc == NULL) 107 if(desc == NULL)
108 return(NULL); 108 return NULL;
109 109
110 *desc = ((struct desc_mapping) 110 *desc = ((struct desc_mapping)
111 { .fd = fd, 111 { .fd = fd,
@@ -113,7 +113,7 @@ static struct desc_mapping *descriptor_mapping(int fd)
113 .pages = LIST_HEAD_INIT(desc->pages) }); 113 .pages = LIST_HEAD_INIT(desc->pages) });
114 list_add(&desc->list, &descriptor_mappings); 114 list_add(&desc->list, &descriptor_mappings);
115 115
116 return(desc); 116 return desc;
117} 117}
118 118
119int physmem_subst_mapping(void *virt, int fd, __u64 offset, int w) 119int physmem_subst_mapping(void *virt, int fd, __u64 offset, int w)
@@ -125,11 +125,11 @@ int physmem_subst_mapping(void *virt, int fd, __u64 offset, int w)
125 125
126 fd_maps = descriptor_mapping(fd); 126 fd_maps = descriptor_mapping(fd);
127 if(fd_maps == NULL) 127 if(fd_maps == NULL)
128 return(-ENOMEM); 128 return -ENOMEM;
129 129
130 phys = __pa(virt); 130 phys = __pa(virt);
131 desc = find_phys_mapping(virt); 131 desc = find_phys_mapping(virt);
132 if(desc != NULL) 132 if(desc != NULL)
133 panic("Address 0x%p is already substituted\n", virt); 133 panic("Address 0x%p is already substituted\n", virt);
134 134
135 err = -ENOMEM; 135 err = -ENOMEM;
@@ -155,7 +155,7 @@ int physmem_subst_mapping(void *virt, int fd, __u64 offset, int w)
155 rb_erase(&desc->rb, &phys_mappings); 155 rb_erase(&desc->rb, &phys_mappings);
156 kfree(desc); 156 kfree(desc);
157 out: 157 out:
158 return(err); 158 return err;
159} 159}
160 160
161static int physmem_fd = -1; 161static int physmem_fd = -1;
@@ -182,10 +182,10 @@ int physmem_remove_mapping(void *virt)
182 virt = (void *) ((unsigned long) virt & PAGE_MASK); 182 virt = (void *) ((unsigned long) virt & PAGE_MASK);
183 desc = find_phys_mapping(virt); 183 desc = find_phys_mapping(virt);
184 if(desc == NULL) 184 if(desc == NULL)
185 return(0); 185 return 0;
186 186
187 remove_mapping(desc); 187 remove_mapping(desc);
188 return(1); 188 return 1;
189} 189}
190 190
191void physmem_forget_descriptor(int fd) 191void physmem_forget_descriptor(int fd)
@@ -239,9 +239,9 @@ void arch_free_page(struct page *page, int order)
239 239
240int is_remapped(void *virt) 240int is_remapped(void *virt)
241{ 241{
242 struct phys_desc *desc = find_phys_mapping(virt); 242 struct phys_desc *desc = find_phys_mapping(virt);
243 243
244 return(desc != NULL); 244 return desc != NULL;
245} 245}
246 246
247/* Changed during early boot */ 247/* Changed during early boot */
@@ -276,7 +276,7 @@ int init_maps(unsigned long physmem, unsigned long iomem, unsigned long highmem)
276 else map = alloc_bootmem_low_pages(total_len); 276 else map = alloc_bootmem_low_pages(total_len);
277 277
278 if(map == NULL) 278 if(map == NULL)
279 return(-ENOMEM); 279 return -ENOMEM;
280 280
281 for(i = 0; i < total_pages; i++){ 281 for(i = 0; i < total_pages; i++){
282 p = &map[i]; 282 p = &map[i];
@@ -286,7 +286,7 @@ int init_maps(unsigned long physmem, unsigned long iomem, unsigned long highmem)
286 } 286 }
287 287
288 max_mapnr = total_pages; 288 max_mapnr = total_pages;
289 return(0); 289 return 0;
290} 290}
291 291
292/* Changed during early boot */ 292/* Changed during early boot */
@@ -296,7 +296,7 @@ unsigned long get_kmem_end(void)
296{ 296{
297 if(kmem_top == 0) 297 if(kmem_top == 0)
298 kmem_top = CHOOSE_MODE(kmem_end_tt, kmem_end_skas); 298 kmem_top = CHOOSE_MODE(kmem_end_tt, kmem_end_skas);
299 return(kmem_top); 299 return kmem_top;
300} 300}
301 301
302void map_memory(unsigned long virt, unsigned long phys, unsigned long len, 302void map_memory(unsigned long virt, unsigned long phys, unsigned long len,
@@ -379,7 +379,7 @@ int phys_mapping(unsigned long phys, __u64 *offset_out)
379 *offset_out = phys - iomem_size; 379 *offset_out = phys - iomem_size;
380 } 380 }
381 381
382 return(fd); 382 return fd;
383} 383}
384 384
385static int __init uml_mem_setup(char *line, int *add) 385static int __init uml_mem_setup(char *line, int *add)
@@ -422,13 +422,13 @@ unsigned long find_iomem(char *driver, unsigned long *len_out)
422 while(region != NULL){ 422 while(region != NULL){
423 if(!strcmp(region->driver, driver)){ 423 if(!strcmp(region->driver, driver)){
424 *len_out = region->size; 424 *len_out = region->size;
425 return(region->virt); 425 return region->virt;
426 } 426 }
427 427
428 region = region->next; 428 region = region->next;
429 } 429 }
430 430
431 return(0); 431 return 0;
432} 432}
433 433
434int setup_iomem(void) 434int setup_iomem(void)
@@ -452,18 +452,7 @@ int setup_iomem(void)
452 region = region->next; 452 region = region->next;
453 } 453 }
454 454
455 return(0); 455 return 0;
456} 456}
457 457
458__initcall(setup_iomem); 458__initcall(setup_iomem);
459
460/*
461 * Overrides for Emacs so that we follow Linus's tabbing style.
462 * Emacs will notice this stuff at the end of the file and automatically
463 * adjust the settings for this buffer only. This must remain at the end
464 * of the file.
465 * ---------------------------------------------------------------------------
466 * Local variables:
467 * c-file-style: "linux"
468 * End:
469 */