Skip to content

Commit c5d4bb1

Browse files
cfd-36Linus Torvalds
authored andcommitted
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: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent e6a2d1f commit c5d4bb1

14 files changed

Lines changed: 122 additions & 133 deletions

File tree

‎arch/um/kernel/exitcode.c‎

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
/*
2-
* Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
2+
* Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
33
* Licensed under the GPL
44
*/
55

6-
#include "linux/kernel.h"
7-
#include "linux/init.h"
8-
#include "linux/ctype.h"
9-
#include "linux/proc_fs.h"
10-
#include "asm/uaccess.h"
6+
#include <linux/ctype.h>
7+
#include <linux/init.h>
8+
#include <linux/kernel.h>
9+
#include <linux/proc_fs.h>
10+
#include <linux/types.h>
11+
#include <asm/uaccess.h>
1112

12-
/* If read and write race, the read will still atomically read a valid
13+
/*
14+
* If read and write race, the read will still atomically read a valid
1315
* value.
1416
*/
1517
int uml_exitcode = 0;
@@ -19,18 +21,19 @@ static int read_proc_exitcode(char *page, char **start, off_t off,
1921
{
2022
int len, val;
2123

22-
/* Save uml_exitcode in a local so that we don't need to guarantee
24+
/*
25+
* Save uml_exitcode in a local so that we don't need to guarantee
2326
* that sprintf accesses it atomically.
2427
*/
2528
val = uml_exitcode;
2629
len = sprintf(page, "%d\n", val);
2730
len -= off;
28-
if(len <= off+count)
31+
if (len <= off+count)
2932
*eof = 1;
3033
*start = page + off;
31-
if(len > count)
34+
if (len > count)
3235
len = count;
33-
if(len < 0)
36+
if (len < 0)
3437
len = 0;
3538
return len;
3639
}
@@ -41,11 +44,11 @@ static int write_proc_exitcode(struct file *file, const char __user *buffer,
4144
char *end, buf[sizeof("nnnnn\0")];
4245
int tmp;
4346

44-
if(copy_from_user(buf, buffer, count))
47+
if (copy_from_user(buf, buffer, count))
4548
return -EFAULT;
4649

4750
tmp = simple_strtol(buf, &end, 0);
48-
if((*end != '\0') && !isspace(*end))
51+
if ((*end != '\0') && !isspace(*end))
4952
return -EINVAL;
5053

5154
uml_exitcode = tmp;
@@ -57,7 +60,7 @@ static int make_proc_exitcode(void)
5760
struct proc_dir_entry *ent;
5861

5962
ent = create_proc_entry("exitcode", 0600, &proc_root);
60-
if(ent == NULL){
63+
if (ent == NULL) {
6164
printk(KERN_WARNING "make_proc_exitcode : Failed to register "
6265
"/proc/exitcode\n");
6366
return 0;

‎arch/um/kernel/gmon_syms.c‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/*
2-
* Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com)
1+
/*
2+
* Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
33
* Licensed under the GPL
44
*/
55

@@ -8,12 +8,13 @@
88
extern void __bb_init_func(void *) __attribute__((weak));
99
EXPORT_SYMBOL(__bb_init_func);
1010

11-
/* This is defined (and referred to in profiling stub code) only by some GCC
11+
/*
12+
* This is defined (and referred to in profiling stub code) only by some GCC
1213
* versions in libgcov.
1314
*
1415
* Since SuSE backported the fix, we cannot handle it depending on GCC version.
15-
* So, unconditionally export it. But also give it a weak declaration, which will
16-
* be overridden by any other one.
16+
* So, unconditionally export it. But also give it a weak declaration, which
17+
* will be overridden by any other one.
1718
*/
1819

1920
extern void __gcov_init(void *) __attribute__((weak));

‎arch/um/kernel/gprof_syms.c‎

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,9 @@
11
/*
2-
* Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com)
2+
* Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
33
* Licensed under the GPL
44
*/
55

66
#include "linux/module.h"
77

88
extern void mcount(void);
99
EXPORT_SYMBOL(mcount);
10-
11-
/*
12-
* Overrides for Emacs so that we follow Linus's tabbing style.
13-
* Emacs will notice this stuff at the end of the file and automatically
14-
* adjust the settings for this buffer only. This must remain at the end
15-
* of the file.
16-
* ---------------------------------------------------------------------------
17-
* Local variables:
18-
* c-file-style: "linux"
19-
* End:
20-
*/

‎arch/um/kernel/process.c‎

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,21 @@
44
* Licensed under the GPL
55
*/
66

7-
#include "linux/stddef.h"
8-
#include "linux/err.h"
9-
#include "linux/hardirq.h"
10-
#include "linux/mm.h"
11-
#include "linux/personality.h"
12-
#include "linux/proc_fs.h"
13-
#include "linux/ptrace.h"
14-
#include "linux/random.h"
15-
#include "linux/sched.h"
16-
#include "linux/tick.h"
17-
#include "linux/threads.h"
18-
#include "asm/pgtable.h"
19-
#include "asm/uaccess.h"
7+
#include <linux/stddef.h>
8+
#include <linux/err.h>
9+
#include <linux/hardirq.h>
10+
#include <linux/gfp.h>
11+
#include <linux/mm.h>
12+
#include <linux/personality.h>
13+
#include <linux/proc_fs.h>
14+
#include <linux/ptrace.h>
15+
#include <linux/random.h>
16+
#include <linux/sched.h>
17+
#include <linux/tick.h>
18+
#include <linux/threads.h>
19+
#include <asm/current.h>
20+
#include <asm/pgtable.h>
21+
#include <asm/uaccess.h>
2022
#include "as-layout.h"
2123
#include "kern_util.h"
2224
#include "os.h"
@@ -40,7 +42,7 @@ int pid_to_processor_id(int pid)
4042
{
4143
int i;
4244

43-
for(i = 0; i < ncpus; i++) {
45+
for (i = 0; i < ncpus; i++) {
4446
if (cpu_tasks[i].pid == pid)
4547
return i;
4648
}
@@ -94,14 +96,15 @@ void *_switch_to(void *prev, void *next, void *last)
9496
do {
9597
current->thread.saved_task = NULL;
9698

97-
switch_threads(&from->thread.switch_buf, &to->thread.switch_buf);
99+
switch_threads(&from->thread.switch_buf,
100+
&to->thread.switch_buf);
98101

99102
arch_switch_to(current);
100103

101104
if (current->thread.saved_task)
102105
show_regs(&(current->thread.regs));
103-
next = current->thread.saved_task;
104-
prev = current;
106+
to = current->thread.saved_task;
107+
from = current;
105108
} while (current->thread.saved_task);
106109

107110
return current->thread.prev_sched;
@@ -232,7 +235,7 @@ void default_idle(void)
232235
{
233236
unsigned long long nsecs;
234237

235-
while(1) {
238+
while (1) {
236239
/* endless idle loop with no priority at all */
237240

238241
/*
@@ -387,7 +390,7 @@ int singlestepping(void * t)
387390
{
388391
struct task_struct *task = t ? t : current;
389392

390-
if ( ! (task->ptrace & PT_DTRACE) )
393+
if (!(task->ptrace & PT_DTRACE))
391394
return 0;
392395

393396
if (task->thread.singlestep_syscall)

‎arch/um/kernel/reboot.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ void (*pm_power_off)(void);
1212

1313
static void kill_off_processes(void)
1414
{
15-
if(proc_mm)
15+
if (proc_mm)
1616
/*
1717
* FIXME: need to loop over userspace_pids
1818
*/
@@ -22,8 +22,8 @@ static void kill_off_processes(void)
2222
int pid, me;
2323

2424
me = os_getpid();
25-
for_each_process(p){
26-
if(p->mm == NULL)
25+
for_each_process(p) {
26+
if (p->mm == NULL)
2727
continue;
2828

2929
pid = p->mm->context.id.u.pid;

‎arch/um/kernel/sigio.c‎

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
11
/*
2-
* Copyright (C) 2002 - 2003 Jeff Dike (jdike@addtoit.com)
2+
* Copyright (C) 2002 - 2007 Jeff Dike (jdike@{linux.intel,addtoit}.com)
33
* Licensed under the GPL
44
*/
55

6-
#include "linux/kernel.h"
7-
#include "linux/list.h"
8-
#include "linux/slab.h"
9-
#include "linux/signal.h"
10-
#include "linux/interrupt.h"
11-
#include "init.h"
12-
#include "sigio.h"
13-
#include "irq_user.h"
6+
#include <linux/interrupt.h>
147
#include "irq_kern.h"
158
#include "os.h"
9+
#include "sigio.h"
1610

1711
/* Protected by sigio_lock() called from write_sigio_workaround */
1812
static int sigio_irq_fd = -1;
@@ -33,9 +27,9 @@ int write_sigio_irq(int fd)
3327
err = um_request_irq(SIGIO_WRITE_IRQ, fd, IRQ_READ, sigio_interrupt,
3428
IRQF_DISABLED|IRQF_SAMPLE_RANDOM, "write sigio",
3529
NULL);
36-
if(err){
37-
printk("write_sigio_irq : um_request_irq failed, err = %d\n",
38-
err);
30+
if (err) {
31+
printk(KERN_ERR "write_sigio_irq : um_request_irq failed, "
32+
"err = %d\n", err);
3933
return -1;
4034
}
4135
sigio_irq_fd = fd;

‎arch/um/kernel/signal.c‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
* Licensed under the GPL
44
*/
55

6-
#include "linux/module.h"
7-
#include "linux/ptrace.h"
8-
#include "linux/sched.h"
9-
#include "asm/siginfo.h"
10-
#include "asm/signal.h"
11-
#include "asm/unistd.h"
6+
#include <linux/module.h>
7+
#include <linux/ptrace.h>
8+
#include <linux/sched.h>
9+
#include <asm/siginfo.h>
10+
#include <asm/signal.h>
11+
#include <asm/unistd.h>
1212
#include "frame_kern.h"
1313
#include "kern_util.h"
1414
#include "sigcontext.h"
@@ -36,7 +36,7 @@ static int handle_signal(struct pt_regs *regs, unsigned long signr,
3636
/* Did we come from a system call? */
3737
if (PT_REGS_SYSCALL_NR(regs) >= 0) {
3838
/* If so, check system call restarting.. */
39-
switch(PT_REGS_SYSCALL_RET(regs)) {
39+
switch (PT_REGS_SYSCALL_RET(regs)) {
4040
case -ERESTART_RESTARTBLOCK:
4141
case -ERESTARTNOHAND:
4242
PT_REGS_SYSCALL_RET(regs) = -EINTR;
@@ -116,7 +116,7 @@ static int kern_do_signal(struct pt_regs *regs)
116116
/* Did we come from a system call? */
117117
if (!handled_sig && (PT_REGS_SYSCALL_NR(regs) >= 0)) {
118118
/* Restart the system call - no handlers present */
119-
switch(PT_REGS_SYSCALL_RET(regs)) {
119+
switch (PT_REGS_SYSCALL_RET(regs)) {
120120
case -ERESTARTNOHAND:
121121
case -ERESTARTSYS:
122122
case -ERESTARTNOINTR:

‎arch/um/kernel/smp.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ void smp_send_stop(void)
6060
continue;
6161
os_write_file(cpu_data[i].ipi_pipe[1], "S", 1);
6262
}
63-
printk(KERN_INFO "done\n");
63+
printk(KERN_CONT "done\n");
6464
}
6565

6666
static cpumask_t smp_commenced_mask = CPU_MASK_NONE;
@@ -140,9 +140,8 @@ void smp_prepare_cpus(unsigned int maxcpus)
140140
while (waittime-- && !cpu_isset(cpu, cpu_callin_map))
141141
cpu_relax();
142142

143-
if (cpu_isset(cpu, cpu_callin_map))
144-
printk(KERN_INFO "done\n");
145-
else printk(KERN_INFO "failed\n");
143+
printk(KERN_INFO "%s\n",
144+
cpu_isset(cpu, cpu_calling_map) ? "done" : "failed");
146145
}
147146
}
148147

‎arch/um/kernel/sysrq.c‎

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,37 @@
1-
/*
2-
* Copyright (C) 2001 Jeff Dike (jdike@karaya.com)
1+
/*
2+
* Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
33
* Licensed under the GPL
44
*/
55

6-
#include "linux/sched.h"
7-
#include "linux/kernel.h"
8-
#include "linux/module.h"
9-
#include "linux/kallsyms.h"
10-
#include "asm/page.h"
11-
#include "asm/processor.h"
6+
#include <linux/kallsyms.h>
7+
#include <linux/kernel.h>
8+
#include <linux/module.h>
9+
#include <linux/sched.h>
1210
#include "sysrq.h"
1311

1412
/* Catch non-i386 SUBARCH's. */
1513
#if !defined(CONFIG_UML_X86) || defined(CONFIG_64BIT)
1614
void show_trace(struct task_struct *task, unsigned long * stack)
1715
{
18-
unsigned long addr;
16+
unsigned long addr;
1917

20-
if (!stack) {
18+
if (!stack) {
2119
stack = (unsigned long*) &stack;
2220
WARN_ON(1);
2321
}
2422

25-
printk("Call Trace: \n");
26-
while (((long) stack & (THREAD_SIZE-1)) != 0) {
27-
addr = *stack;
23+
printk(KERN_INFO "Call Trace: \n");
24+
while (((long) stack & (THREAD_SIZE-1)) != 0) {
25+
addr = *stack;
2826
if (__kernel_text_address(addr)) {
29-
printk("%08lx: [<%08lx>]", (unsigned long) stack, addr);
30-
print_symbol(" %s", addr);
31-
printk("\n");
32-
}
33-
stack++;
34-
}
35-
printk("\n");
27+
printk(KERN_INFO "%08lx: [<%08lx>]",
28+
(unsigned long) stack, addr);
29+
print_symbol(KERN_CONT " %s", addr);
30+
printk(KERN_CONT "\n");
31+
}
32+
stack++;
33+
}
34+
printk(KERN_INFO "\n");
3635
}
3736
#endif
3837

@@ -67,14 +66,13 @@ void show_stack(struct task_struct *task, unsigned long *esp)
6766
}
6867

6968
stack = esp;
70-
for(i = 0; i < kstack_depth_to_print; i++) {
69+
for (i = 0; i < kstack_depth_to_print; i++) {
7170
if (kstack_end(stack))
7271
break;
7372
if (i && ((i % 8) == 0))
74-
printk("\n ");
73+
printk("\n" KERN_INFO " ");
7574
printk("%08lx ", *stack++);
7675
}
7776

78-
printk("Call Trace: \n");
7977
show_trace(task, esp);
8078
}

0 commit comments

Comments
 (0)