Commit c5d4bb17 authored by Jeff Dike's avatar Jeff Dike Committed by Linus Torvalds

uml: style fixes in arch/um/kernel

Joe Perches noticed some printks in smp.c that needed fixing.

While I was in there, I did the usual tidying in arch/um/kernel, which
should be fairly style-clean at this point:
	copyright updates
	emacs formatting comments removal
	include tidying
	style fixes

Cc: Joe Perches <joe@perches.com>
Signed-off-by: default avatarJeff Dike <jdike@linux.intel.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent e6a2d1f7
/* /*
* Copyright (C) 2002 Jeff Dike (jdike@karaya.com) * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
* Licensed under the GPL * Licensed under the GPL
*/ */
#include "linux/kernel.h" #include <linux/ctype.h>
#include "linux/init.h" #include <linux/init.h>
#include "linux/ctype.h" #include <linux/kernel.h>
#include "linux/proc_fs.h" #include <linux/proc_fs.h>
#include "asm/uaccess.h" #include <linux/types.h>
#include <asm/uaccess.h>
/* If read and write race, the read will still atomically read a valid /*
* If read and write race, the read will still atomically read a valid
* value. * value.
*/ */
int uml_exitcode = 0; int uml_exitcode = 0;
...@@ -19,18 +21,19 @@ static int read_proc_exitcode(char *page, char **start, off_t off, ...@@ -19,18 +21,19 @@ static int read_proc_exitcode(char *page, char **start, off_t off,
{ {
int len, val; int len, val;
/* Save uml_exitcode in a local so that we don't need to guarantee /*
* Save uml_exitcode in a local so that we don't need to guarantee
* that sprintf accesses it atomically. * that sprintf accesses it atomically.
*/ */
val = uml_exitcode; val = uml_exitcode;
len = sprintf(page, "%d\n", val); len = sprintf(page, "%d\n", val);
len -= off; len -= off;
if(len <= off+count) if (len <= off+count)
*eof = 1; *eof = 1;
*start = page + off; *start = page + off;
if(len > count) if (len > count)
len = count; len = count;
if(len < 0) if (len < 0)
len = 0; len = 0;
return len; return len;
} }
...@@ -41,11 +44,11 @@ static int write_proc_exitcode(struct file *file, const char __user *buffer, ...@@ -41,11 +44,11 @@ static int write_proc_exitcode(struct file *file, const char __user *buffer,
char *end, buf[sizeof("nnnnn\0")]; char *end, buf[sizeof("nnnnn\0")];
int tmp; int tmp;
if(copy_from_user(buf, buffer, count)) if (copy_from_user(buf, buffer, count))
return -EFAULT; return -EFAULT;
tmp = simple_strtol(buf, &end, 0); tmp = simple_strtol(buf, &end, 0);
if((*end != '\0') && !isspace(*end)) if ((*end != '\0') && !isspace(*end))
return -EINVAL; return -EINVAL;
uml_exitcode = tmp; uml_exitcode = tmp;
...@@ -57,7 +60,7 @@ static int make_proc_exitcode(void) ...@@ -57,7 +60,7 @@ static int make_proc_exitcode(void)
struct proc_dir_entry *ent; struct proc_dir_entry *ent;
ent = create_proc_entry("exitcode", 0600, &proc_root); ent = create_proc_entry("exitcode", 0600, &proc_root);
if(ent == NULL){ if (ent == NULL) {
printk(KERN_WARNING "make_proc_exitcode : Failed to register " printk(KERN_WARNING "make_proc_exitcode : Failed to register "
"/proc/exitcode\n"); "/proc/exitcode\n");
return 0; return 0;
......
/* /*
* Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com) * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
* Licensed under the GPL * Licensed under the GPL
*/ */
...@@ -8,12 +8,13 @@ ...@@ -8,12 +8,13 @@
extern void __bb_init_func(void *) __attribute__((weak)); extern void __bb_init_func(void *) __attribute__((weak));
EXPORT_SYMBOL(__bb_init_func); EXPORT_SYMBOL(__bb_init_func);
/* This is defined (and referred to in profiling stub code) only by some GCC /*
* This is defined (and referred to in profiling stub code) only by some GCC
* versions in libgcov. * versions in libgcov.
* *
* Since SuSE backported the fix, we cannot handle it depending on GCC version. * Since SuSE backported the fix, we cannot handle it depending on GCC version.
* So, unconditionally export it. But also give it a weak declaration, which will * So, unconditionally export it. But also give it a weak declaration, which
* be overridden by any other one. * will be overridden by any other one.
*/ */
extern void __gcov_init(void *) __attribute__((weak)); extern void __gcov_init(void *) __attribute__((weak));
......
/* /*
* Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com) * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
* Licensed under the GPL * Licensed under the GPL
*/ */
...@@ -7,14 +7,3 @@ ...@@ -7,14 +7,3 @@
extern void mcount(void); extern void mcount(void);
EXPORT_SYMBOL(mcount); EXPORT_SYMBOL(mcount);
/*
* 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:
*/
...@@ -4,19 +4,21 @@ ...@@ -4,19 +4,21 @@
* Licensed under the GPL * Licensed under the GPL
*/ */
#include "linux/stddef.h" #include <linux/stddef.h>
#include "linux/err.h" #include <linux/err.h>
#include "linux/hardirq.h" #include <linux/hardirq.h>
#include "linux/mm.h" #include <linux/gfp.h>
#include "linux/personality.h" #include <linux/mm.h>
#include "linux/proc_fs.h" #include <linux/personality.h>
#include "linux/ptrace.h" #include <linux/proc_fs.h>
#include "linux/random.h" #include <linux/ptrace.h>
#include "linux/sched.h" #include <linux/random.h>
#include "linux/tick.h" #include <linux/sched.h>
#include "linux/threads.h" #include <linux/tick.h>
#include "asm/pgtable.h" #include <linux/threads.h>
#include "asm/uaccess.h" #include <asm/current.h>
#include <asm/pgtable.h>
#include <asm/uaccess.h>
#include "as-layout.h" #include "as-layout.h"
#include "kern_util.h" #include "kern_util.h"
#include "os.h" #include "os.h"
...@@ -40,7 +42,7 @@ int pid_to_processor_id(int pid) ...@@ -40,7 +42,7 @@ int pid_to_processor_id(int pid)
{ {
int i; int i;
for(i = 0; i < ncpus; i++) { for (i = 0; i < ncpus; i++) {
if (cpu_tasks[i].pid == pid) if (cpu_tasks[i].pid == pid)
return i; return i;
} }
...@@ -94,14 +96,15 @@ void *_switch_to(void *prev, void *next, void *last) ...@@ -94,14 +96,15 @@ void *_switch_to(void *prev, void *next, void *last)
do { do {
current->thread.saved_task = NULL; current->thread.saved_task = NULL;
switch_threads(&from->thread.switch_buf, &to->thread.switch_buf); switch_threads(&from->thread.switch_buf,
&to->thread.switch_buf);
arch_switch_to(current); arch_switch_to(current);
if (current->thread.saved_task) if (current->thread.saved_task)
show_regs(&(current->thread.regs)); show_regs(&(current->thread.regs));
next = current->thread.saved_task; to = current->thread.saved_task;
prev = current; from = current;
} while (current->thread.saved_task); } while (current->thread.saved_task);
return current->thread.prev_sched; return current->thread.prev_sched;
...@@ -232,7 +235,7 @@ void default_idle(void) ...@@ -232,7 +235,7 @@ void default_idle(void)
{ {
unsigned long long nsecs; unsigned long long nsecs;
while(1) { while (1) {
/* endless idle loop with no priority at all */ /* endless idle loop with no priority at all */
/* /*
...@@ -387,7 +390,7 @@ int singlestepping(void * t) ...@@ -387,7 +390,7 @@ int singlestepping(void * t)
{ {
struct task_struct *task = t ? t : current; struct task_struct *task = t ? t : current;
if ( ! (task->ptrace & PT_DTRACE) ) if (!(task->ptrace & PT_DTRACE))
return 0; return 0;
if (task->thread.singlestep_syscall) if (task->thread.singlestep_syscall)
......
...@@ -12,7 +12,7 @@ void (*pm_power_off)(void); ...@@ -12,7 +12,7 @@ void (*pm_power_off)(void);
static void kill_off_processes(void) static void kill_off_processes(void)
{ {
if(proc_mm) if (proc_mm)
/* /*
* FIXME: need to loop over userspace_pids * FIXME: need to loop over userspace_pids
*/ */
...@@ -22,8 +22,8 @@ static void kill_off_processes(void) ...@@ -22,8 +22,8 @@ static void kill_off_processes(void)
int pid, me; int pid, me;
me = os_getpid(); me = os_getpid();
for_each_process(p){ for_each_process(p) {
if(p->mm == NULL) if (p->mm == NULL)
continue; continue;
pid = p->mm->context.id.u.pid; pid = p->mm->context.id.u.pid;
......
/* /*
* Copyright (C) 2002 - 2003 Jeff Dike (jdike@addtoit.com) * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com)
* Licensed under the GPL * Licensed under the GPL
*/ */
#include "linux/kernel.h" #include <linux/interrupt.h>
#include "linux/list.h"
#include "linux/slab.h"
#include "linux/signal.h"
#include "linux/interrupt.h"
#include "init.h"
#include "sigio.h"
#include "irq_user.h"
#include "irq_kern.h" #include "irq_kern.h"
#include "os.h" #include "os.h"
#include "sigio.h"
/* Protected by sigio_lock() called from write_sigio_workaround */ /* Protected by sigio_lock() called from write_sigio_workaround */
static int sigio_irq_fd = -1; static int sigio_irq_fd = -1;
...@@ -33,9 +27,9 @@ int write_sigio_irq(int fd) ...@@ -33,9 +27,9 @@ int write_sigio_irq(int fd)
err = um_request_irq(SIGIO_WRITE_IRQ, fd, IRQ_READ, sigio_interrupt, err = um_request_irq(SIGIO_WRITE_IRQ, fd, IRQ_READ, sigio_interrupt,
IRQF_DISABLED|IRQF_SAMPLE_RANDOM, "write sigio", IRQF_DISABLED|IRQF_SAMPLE_RANDOM, "write sigio",
NULL); NULL);
if(err){ if (err) {
printk("write_sigio_irq : um_request_irq failed, err = %d\n", printk(KERN_ERR "write_sigio_irq : um_request_irq failed, "
err); "err = %d\n", err);
return -1; return -1;
} }
sigio_irq_fd = fd; sigio_irq_fd = fd;
......
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
* Licensed under the GPL * Licensed under the GPL
*/ */
#include "linux/module.h" #include <linux/module.h>
#include "linux/ptrace.h" #include <linux/ptrace.h>
#include "linux/sched.h" #include <linux/sched.h>
#include "asm/siginfo.h" #include <asm/siginfo.h>
#include "asm/signal.h" #include <asm/signal.h>
#include "asm/unistd.h" #include <asm/unistd.h>
#include "frame_kern.h" #include "frame_kern.h"
#include "kern_util.h" #include "kern_util.h"
#include "sigcontext.h" #include "sigcontext.h"
...@@ -36,7 +36,7 @@ static int handle_signal(struct pt_regs *regs, unsigned long signr, ...@@ -36,7 +36,7 @@ static int handle_signal(struct pt_regs *regs, unsigned long signr,
/* Did we come from a system call? */ /* Did we come from a system call? */
if (PT_REGS_SYSCALL_NR(regs) >= 0) { if (PT_REGS_SYSCALL_NR(regs) >= 0) {
/* If so, check system call restarting.. */ /* If so, check system call restarting.. */
switch(PT_REGS_SYSCALL_RET(regs)) { switch (PT_REGS_SYSCALL_RET(regs)) {
case -ERESTART_RESTARTBLOCK: case -ERESTART_RESTARTBLOCK:
case -ERESTARTNOHAND: case -ERESTARTNOHAND:
PT_REGS_SYSCALL_RET(regs) = -EINTR; PT_REGS_SYSCALL_RET(regs) = -EINTR;
...@@ -116,7 +116,7 @@ static int kern_do_signal(struct pt_regs *regs) ...@@ -116,7 +116,7 @@ static int kern_do_signal(struct pt_regs *regs)
/* Did we come from a system call? */ /* Did we come from a system call? */
if (!handled_sig && (PT_REGS_SYSCALL_NR(regs) >= 0)) { if (!handled_sig && (PT_REGS_SYSCALL_NR(regs) >= 0)) {
/* Restart the system call - no handlers present */ /* Restart the system call - no handlers present */
switch(PT_REGS_SYSCALL_RET(regs)) { switch (PT_REGS_SYSCALL_RET(regs)) {
case -ERESTARTNOHAND: case -ERESTARTNOHAND:
case -ERESTARTSYS: case -ERESTARTSYS:
case -ERESTARTNOINTR: case -ERESTARTNOINTR:
......
...@@ -60,7 +60,7 @@ void smp_send_stop(void) ...@@ -60,7 +60,7 @@ void smp_send_stop(void)
continue; continue;
os_write_file(cpu_data[i].ipi_pipe[1], "S", 1); os_write_file(cpu_data[i].ipi_pipe[1], "S", 1);
} }
printk(KERN_INFO "done\n"); printk(KERN_CONT "done\n");
} }
static cpumask_t smp_commenced_mask = CPU_MASK_NONE; static cpumask_t smp_commenced_mask = CPU_MASK_NONE;
...@@ -140,9 +140,8 @@ void smp_prepare_cpus(unsigned int maxcpus) ...@@ -140,9 +140,8 @@ void smp_prepare_cpus(unsigned int maxcpus)
while (waittime-- && !cpu_isset(cpu, cpu_callin_map)) while (waittime-- && !cpu_isset(cpu, cpu_callin_map))
cpu_relax(); cpu_relax();
if (cpu_isset(cpu, cpu_callin_map)) printk(KERN_INFO "%s\n",
printk(KERN_INFO "done\n"); cpu_isset(cpu, cpu_calling_map) ? "done" : "failed");
else printk(KERN_INFO "failed\n");
} }
} }
......
/* /*
* Copyright (C) 2001 Jeff Dike (jdike@karaya.com) * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
* Licensed under the GPL * Licensed under the GPL
*/ */
#include "linux/sched.h" #include <linux/kallsyms.h>
#include "linux/kernel.h" #include <linux/kernel.h>
#include "linux/module.h" #include <linux/module.h>
#include "linux/kallsyms.h" #include <linux/sched.h>
#include "asm/page.h"
#include "asm/processor.h"
#include "sysrq.h" #include "sysrq.h"
/* Catch non-i386 SUBARCH's. */ /* Catch non-i386 SUBARCH's. */
#if !defined(CONFIG_UML_X86) || defined(CONFIG_64BIT) #if !defined(CONFIG_UML_X86) || defined(CONFIG_64BIT)
void show_trace(struct task_struct *task, unsigned long * stack) void show_trace(struct task_struct *task, unsigned long * stack)
{ {
unsigned long addr; unsigned long addr;
if (!stack) { if (!stack) {
stack = (unsigned long*) &stack; stack = (unsigned long*) &stack;
WARN_ON(1); WARN_ON(1);
} }
printk("Call Trace: \n"); printk(KERN_INFO "Call Trace: \n");
while (((long) stack & (THREAD_SIZE-1)) != 0) { while (((long) stack & (THREAD_SIZE-1)) != 0) {
addr = *stack; addr = *stack;
if (__kernel_text_address(addr)) { if (__kernel_text_address(addr)) {
printk("%08lx: [<%08lx>]", (unsigned long) stack, addr); printk(KERN_INFO "%08lx: [<%08lx>]",
print_symbol(" %s", addr); (unsigned long) stack, addr);
printk("\n"); print_symbol(KERN_CONT " %s", addr);
} printk(KERN_CONT "\n");
stack++; }
} stack++;
printk("\n"); }
printk(KERN_INFO "\n");
} }
#endif #endif
...@@ -67,14 +66,13 @@ void show_stack(struct task_struct *task, unsigned long *esp) ...@@ -67,14 +66,13 @@ void show_stack(struct task_struct *task, unsigned long *esp)
} }
stack = esp; stack = esp;
for(i = 0; i < kstack_depth_to_print; i++) { for (i = 0; i < kstack_depth_to_print; i++) {
if (kstack_end(stack)) if (kstack_end(stack))
break; break;
if (i && ((i % 8) == 0)) if (i && ((i % 8) == 0))
printk("\n "); printk("\n" KERN_INFO " ");
printk("%08lx ", *stack++); printk("%08lx ", *stack++);
} }
printk("Call Trace: \n");
show_trace(task, esp); show_trace(task, esp);
} }
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
* Licensed under the GPL * Licensed under the GPL
*/ */
#include "linux/clockchips.h" #include <linux/clockchips.h>
#include "linux/interrupt.h" #include <linux/interrupt.h>
#include "linux/jiffies.h" #include <linux/jiffies.h>
#include "linux/threads.h" #include <linux/threads.h>
#include "asm/irq.h" #include <asm/irq.h>
#include "asm/param.h" #include <asm/param.h>
#include "kern_util.h" #include "kern_util.h"
#include "os.h" #include "os.h"
...@@ -32,7 +32,7 @@ void timer_handler(int sig, struct uml_pt_regs *regs) ...@@ -32,7 +32,7 @@ void timer_handler(int sig, struct uml_pt_regs *regs)
static void itimer_set_mode(enum clock_event_mode mode, static void itimer_set_mode(enum clock_event_mode mode,
struct clock_event_device *evt) struct clock_event_device *evt)
{ {
switch(mode) { switch (mode) {
case CLOCK_EVT_MODE_PERIODIC: case CLOCK_EVT_MODE_PERIODIC:
set_interval(); set_interval();
break; break;
......
...@@ -57,7 +57,7 @@ static int do_ops(struct host_vm_change *hvc, int end, ...@@ -57,7 +57,7 @@ static int do_ops(struct host_vm_change *hvc, int end,
for (i = 0; i < end && !ret; i++) { for (i = 0; i < end && !ret; i++) {
op = &hvc->ops[i]; op = &hvc->ops[i];
switch(op->type) { switch (op->type) {
case MMAP: case MMAP:
ret = map(hvc->id, op->u.mmap.addr, op->u.mmap.len, ret = map(hvc->id, op->u.mmap.addr, op->u.mmap.len,
op->u.mmap.prot, op->u.mmap.fd, op->u.mmap.prot, op->u.mmap.fd,
......
/* /*
* Copyright (C) 2001 Chris Emerson (cemerson@chiark.greenend.org.uk) * Copyright (C) 2001 Chris Emerson (cemerson@chiark.greenend.org.uk)
* Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com) * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
* Licensed under the GPL * Licensed under the GPL
*/ */
/* These are here rather than tt/uaccess.c because skas mode needs them in /*
* These are here rather than tt/uaccess.c because skas mode needs them in
* order to do SIGBUS recovery when a tmpfs mount runs out of room. * order to do SIGBUS recovery when a tmpfs mount runs out of room.
*/ */
...@@ -25,6 +26,8 @@ int __do_copy_to_user(void *to, const void *from, int n, ...@@ -25,6 +26,8 @@ int __do_copy_to_user(void *to, const void *from, int n,
fault = __do_user_copy(to, from, n, fault_addr, fault_catcher, fault = __do_user_copy(to, from, n, fault_addr, fault_catcher,
__do_copy, &faulted); __do_copy, &faulted);
if(!faulted) return(0); if (!faulted)
else return(n - (fault - (unsigned long) to)); return 0;
else
return n - (fault - (unsigned long) to);
} }
...@@ -3,23 +3,23 @@ ...@@ -3,23 +3,23 @@
* Licensed under the GPL * Licensed under the GPL
*/ */
#include "linux/delay.h" #include <linux/delay.h>
#include "linux/mm.h" #include <linux/init.h>
#include "linux/module.h" #include <linux/mm.h>
#include "linux/seq_file.h" #include <linux/module.h>
#include "linux/string.h" #include <linux/seq_file.h>
#include "linux/utsname.h" #include <linux/string.h>
#include "asm/pgtable.h" #include <linux/utsname.h>
#include "asm/processor.h" #include <asm/pgtable.h>
#include "asm/setup.h" #include <asm/processor.h>
#include "arch.h" #include <asm/setup.h>
#include "as-layout.h" #include "as-layout.h"
#include "arch.h"
#include "init.h" #include "init.h"
#include "kern.h" #include "kern.h"
#include "kern_util.h" #include "kern_util.h"
#include "mem_user.h" #include "mem_user.h"
#include "os.h" #include "os.h"
#include "skas.h"
#define DEFAULT_COMMAND_LINE "root=98:0" #define DEFAULT_COMMAND_LINE "root=98:0"
...@@ -201,7 +201,7 @@ static void __init uml_checksetup(char *line, int *add) ...@@ -201,7 +201,7 @@ static void __init uml_checksetup(char *line, int *add)
struct uml_param *p; struct uml_param *p;
p = &__uml_setup_start; p = &__uml_setup_start;
while(p < &__uml_setup_end) { while (p < &__uml_setup_end) {
int n; int n;
n = strlen(p->str); n = strlen(p->str);
...@@ -216,7 +216,7 @@ static void __init uml_postsetup(void) ...@@ -216,7 +216,7 @@ static void __init uml_postsetup(void)
initcall_t *p; initcall_t *p;
p = &__uml_postsetup_start; p = &__uml_postsetup_start;
while(p < &__uml_postsetup_end) { while (p < &__uml_postsetup_end) {
(*p)(); (*p)();
p++; p++;
} }
......
/* /*
* Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com) * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
* Licensed under the GPL * Licensed under the GPL
*/ */
#include "asm/errno.h" #include <asm/errno.h>
#include "init.h" #include "init.h"
#include "os.h"
#include "kern.h" #include "kern.h"
#include "linux/kernel.h" #include "os.h"
/* Changed by set_umid_arg */ /* Changed by set_umid_arg */
static int umid_inited = 0; static int umid_inited = 0;
...@@ -16,16 +15,16 @@ static int __init set_umid_arg(char *name, int *add) ...@@ -16,16 +15,16 @@ static int __init set_umid_arg(char *name, int *add)
{ {
int err; int err;
if(umid_inited){ if (umid_inited) {
printf("umid already set\n"); printf("umid already set\n");
return 0; return 0;
} }
*add = 0; *add = 0;
err = set_umid(name); err = set_umid(name);
if(err == -EEXIST) if (err == -EEXIST)
printf("umid '%s' already in use\n", name); printf("umid '%s' already in use\n", name);
else if(!err) else if (!err)
umid_inited = 1; umid_inited = 1;
return 0; return 0;
......
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