aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/kernel/physmem.c
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/um/kernel/physmem.c
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/um/kernel/physmem.c')
-rw-r--r--arch/um/kernel/physmem.c57
1 files changed, 23 insertions, 34 deletions
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 */