Commit 60678bbc authored by Jeff Dike's avatar Jeff Dike Committed by Linus Torvalds

[PATCH] uml: mem.c and physmem.c formatting fixes

Fix a bunch of style violations in mem.c and physmem.c
Signed-off-by: default avatarJeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 94c282d7
...@@ -253,8 +253,10 @@ struct page *arch_validate(struct page *page, gfp_t mask, int order) ...@@ -253,8 +253,10 @@ struct page *arch_validate(struct page *page, gfp_t mask, int order)
int i; int i;
again: again:
if(page == NULL) return(page); if(page == NULL)
if(PageHighMem(page)) return(page); return page;
if(PageHighMem(page))
return page;
addr = (unsigned long) page_address(page); addr = (unsigned long) page_address(page);
for(i = 0; i < (1 << order); i++){ for(i = 0; i < (1 << order); i++){
...@@ -263,13 +265,15 @@ struct page *arch_validate(struct page *page, gfp_t mask, int order) ...@@ -263,13 +265,15 @@ struct page *arch_validate(struct page *page, gfp_t mask, int order)
sizeof(zero), sizeof(zero),
&current->thread.fault_addr, &current->thread.fault_addr,
&current->thread.fault_catcher)){ &current->thread.fault_catcher)){
if(!(mask & __GFP_WAIT)) return(NULL); if(!(mask & __GFP_WAIT))
return NULL;
else break; else break;
} }
addr += PAGE_SIZE; addr += PAGE_SIZE;
} }
if(i == (1 << order)) return(page); if(i == (1 << order))
return page;
page = alloc_pages(mask, order); page = alloc_pages(mask, order);
goto again; goto again;
} }
...@@ -283,7 +287,6 @@ void free_initmem(void) ...@@ -283,7 +287,6 @@ void free_initmem(void)
} }
#ifdef CONFIG_BLK_DEV_INITRD #ifdef CONFIG_BLK_DEV_INITRD
void free_initrd_mem(unsigned long start, unsigned long end) void free_initrd_mem(unsigned long start, unsigned long end)
{ {
if (start < end) if (start < end)
...@@ -296,7 +299,6 @@ void free_initrd_mem(unsigned long start, unsigned long end) ...@@ -296,7 +299,6 @@ void free_initrd_mem(unsigned long start, unsigned long end)
totalram_pages++; totalram_pages++;
} }
} }
#endif #endif
void show_mem(void) void show_mem(void)
...@@ -366,14 +368,3 @@ struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address) ...@@ -366,14 +368,3 @@ struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address)
pte = alloc_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO); pte = alloc_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
return pte; return pte;
} }
/*
* Overrides for Emacs so that we follow Linus's tabbing style.
* Emacs will notice this stuff at the end of the file and automatically
* adjust the settings for this buffer only. This must remain at the end
* of the file.
* ---------------------------------------------------------------------------
* Local variables:
* c-file-style: "linux"
* End:
*/
...@@ -40,7 +40,7 @@ static struct rb_node **find_rb(void *virt) ...@@ -40,7 +40,7 @@ static struct rb_node **find_rb(void *virt)
while(*n != NULL){ while(*n != NULL){
d = rb_entry(*n, struct phys_desc, rb); d = rb_entry(*n, struct phys_desc, rb);
if(d->virt == virt) if(d->virt == virt)
return(n); return n;
if(d->virt > virt) if(d->virt > virt)
n = &(*n)->rb_left; n = &(*n)->rb_left;
...@@ -48,7 +48,7 @@ static struct rb_node **find_rb(void *virt) ...@@ -48,7 +48,7 @@ static struct rb_node **find_rb(void *virt)
n = &(*n)->rb_right; n = &(*n)->rb_right;
} }
return(n); return n;
} }
static struct phys_desc *find_phys_mapping(void *virt) static struct phys_desc *find_phys_mapping(void *virt)
...@@ -56,9 +56,9 @@ static struct phys_desc *find_phys_mapping(void *virt) ...@@ -56,9 +56,9 @@ static struct phys_desc *find_phys_mapping(void *virt)
struct rb_node **n = find_rb(virt); struct rb_node **n = find_rb(virt);
if(*n == NULL) if(*n == NULL)
return(NULL); return NULL;
return(rb_entry(*n, struct phys_desc, rb)); return rb_entry(*n, struct phys_desc, rb);
} }
static void insert_phys_mapping(struct phys_desc *desc) static void insert_phys_mapping(struct phys_desc *desc)
...@@ -89,10 +89,10 @@ static struct desc_mapping *find_mapping(int fd) ...@@ -89,10 +89,10 @@ static struct desc_mapping *find_mapping(int fd)
list_for_each(ele, &descriptor_mappings){ list_for_each(ele, &descriptor_mappings){
desc = list_entry(ele, struct desc_mapping, list); desc = list_entry(ele, struct desc_mapping, list);
if(desc->fd == fd) if(desc->fd == fd)
return(desc); return desc;
} }
return(NULL); return NULL;
} }
static struct desc_mapping *descriptor_mapping(int fd) static struct desc_mapping *descriptor_mapping(int fd)
...@@ -101,11 +101,11 @@ static struct desc_mapping *descriptor_mapping(int fd) ...@@ -101,11 +101,11 @@ static struct desc_mapping *descriptor_mapping(int fd)
desc = find_mapping(fd); desc = find_mapping(fd);
if(desc != NULL) if(desc != NULL)
return(desc); return desc;
desc = kmalloc(sizeof(*desc), GFP_ATOMIC); desc = kmalloc(sizeof(*desc), GFP_ATOMIC);
if(desc == NULL) if(desc == NULL)
return(NULL); return NULL;
*desc = ((struct desc_mapping) *desc = ((struct desc_mapping)
{ .fd = fd, { .fd = fd,
...@@ -113,7 +113,7 @@ static struct desc_mapping *descriptor_mapping(int fd) ...@@ -113,7 +113,7 @@ static struct desc_mapping *descriptor_mapping(int fd)
.pages = LIST_HEAD_INIT(desc->pages) }); .pages = LIST_HEAD_INIT(desc->pages) });
list_add(&desc->list, &descriptor_mappings); list_add(&desc->list, &descriptor_mappings);
return(desc); return desc;
} }
int physmem_subst_mapping(void *virt, int fd, __u64 offset, int w) int physmem_subst_mapping(void *virt, int fd, __u64 offset, int w)
...@@ -125,7 +125,7 @@ int physmem_subst_mapping(void *virt, int fd, __u64 offset, int w) ...@@ -125,7 +125,7 @@ int physmem_subst_mapping(void *virt, int fd, __u64 offset, int w)
fd_maps = descriptor_mapping(fd); fd_maps = descriptor_mapping(fd);
if(fd_maps == NULL) if(fd_maps == NULL)
return(-ENOMEM); return -ENOMEM;
phys = __pa(virt); phys = __pa(virt);
desc = find_phys_mapping(virt); desc = find_phys_mapping(virt);
...@@ -155,7 +155,7 @@ int physmem_subst_mapping(void *virt, int fd, __u64 offset, int w) ...@@ -155,7 +155,7 @@ int physmem_subst_mapping(void *virt, int fd, __u64 offset, int w)
rb_erase(&desc->rb, &phys_mappings); rb_erase(&desc->rb, &phys_mappings);
kfree(desc); kfree(desc);
out: out:
return(err); return err;
} }
static int physmem_fd = -1; static int physmem_fd = -1;
...@@ -182,10 +182,10 @@ int physmem_remove_mapping(void *virt) ...@@ -182,10 +182,10 @@ int physmem_remove_mapping(void *virt)
virt = (void *) ((unsigned long) virt & PAGE_MASK); virt = (void *) ((unsigned long) virt & PAGE_MASK);
desc = find_phys_mapping(virt); desc = find_phys_mapping(virt);
if(desc == NULL) if(desc == NULL)
return(0); return 0;
remove_mapping(desc); remove_mapping(desc);
return(1); return 1;
} }
void physmem_forget_descriptor(int fd) void physmem_forget_descriptor(int fd)
...@@ -241,7 +241,7 @@ int is_remapped(void *virt) ...@@ -241,7 +241,7 @@ int is_remapped(void *virt)
{ {
struct phys_desc *desc = find_phys_mapping(virt); struct phys_desc *desc = find_phys_mapping(virt);
return(desc != NULL); return desc != NULL;
} }
/* Changed during early boot */ /* Changed during early boot */
...@@ -276,7 +276,7 @@ int init_maps(unsigned long physmem, unsigned long iomem, unsigned long highmem) ...@@ -276,7 +276,7 @@ int init_maps(unsigned long physmem, unsigned long iomem, unsigned long highmem)
else map = alloc_bootmem_low_pages(total_len); else map = alloc_bootmem_low_pages(total_len);
if(map == NULL) if(map == NULL)
return(-ENOMEM); return -ENOMEM;
for(i = 0; i < total_pages; i++){ for(i = 0; i < total_pages; i++){
p = &map[i]; p = &map[i];
...@@ -286,7 +286,7 @@ int init_maps(unsigned long physmem, unsigned long iomem, unsigned long highmem) ...@@ -286,7 +286,7 @@ int init_maps(unsigned long physmem, unsigned long iomem, unsigned long highmem)
} }
max_mapnr = total_pages; max_mapnr = total_pages;
return(0); return 0;
} }
/* Changed during early boot */ /* Changed during early boot */
...@@ -296,7 +296,7 @@ unsigned long get_kmem_end(void) ...@@ -296,7 +296,7 @@ unsigned long get_kmem_end(void)
{ {
if(kmem_top == 0) if(kmem_top == 0)
kmem_top = CHOOSE_MODE(kmem_end_tt, kmem_end_skas); kmem_top = CHOOSE_MODE(kmem_end_tt, kmem_end_skas);
return(kmem_top); return kmem_top;
} }
void map_memory(unsigned long virt, unsigned long phys, unsigned long len, void 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,7 +379,7 @@ int phys_mapping(unsigned long phys, __u64 *offset_out)
*offset_out = phys - iomem_size; *offset_out = phys - iomem_size;
} }
return(fd); return fd;
} }
static int __init uml_mem_setup(char *line, int *add) static int __init uml_mem_setup(char *line, int *add)
...@@ -422,13 +422,13 @@ unsigned long find_iomem(char *driver, unsigned long *len_out) ...@@ -422,13 +422,13 @@ unsigned long find_iomem(char *driver, unsigned long *len_out)
while(region != NULL){ while(region != NULL){
if(!strcmp(region->driver, driver)){ if(!strcmp(region->driver, driver)){
*len_out = region->size; *len_out = region->size;
return(region->virt); return region->virt;
} }
region = region->next; region = region->next;
} }
return(0); return 0;
} }
int setup_iomem(void) int setup_iomem(void)
...@@ -452,18 +452,7 @@ int setup_iomem(void) ...@@ -452,18 +452,7 @@ int setup_iomem(void)
region = region->next; region = region->next;
} }
return(0); return 0;
} }
__initcall(setup_iomem); __initcall(setup_iomem);
/*
* Overrides for Emacs so that we follow Linus's tabbing style.
* Emacs will notice this stuff at the end of the file and automatically
* adjust the settings for this buffer only. This must remain at the end
* of the file.
* ---------------------------------------------------------------------------
* Local variables:
* c-file-style: "linux"
* End:
*/
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment