2008-01-04 00:23:41

by Paolo Ciarrocchi

[permalink] [raw]
Subject: [PATCH] printk: Coding style fixes

This patch to printk.c fixes a few errors reported by checkpatch.pl

Before:
total: 18 errors, 17 warnings, 1306 lines checked

After:
total: 1 errors, 17 warnings, 1305 lines checked

This new version includes a fix suggested by Jesper Juhl

Signed-off-by: Paolo Ciarrocchi <[email protected]>
---

Adrian, I'm sending this patch to you because according to git shortlog -e
you are the most active modifier of this file.


kernel/printk.c | 25 ++++++++++++-------------
1 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/kernel/printk.c b/kernel/printk.c
index 89011bf..8d131c6 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -100,8 +100,7 @@ static unsigned long log_end; /* Index into log_buf: most-recently-written-char
/*
* Array of consoles built from command line options (console=)
*/
-struct console_cmdline
-{
+struct console_cmdline {
char name[8]; /* Name of the driver */
int index; /* Minor dev. to use */
char *options; /* Options for the driver */
@@ -323,7 +322,7 @@ int do_syslog(int type, char __user *buf, int len)
c = LOG_BUF(log_start);
log_start++;
spin_unlock_irq(&logbuf_lock);
- error = __put_user(c,buf);
+ error = __put_user(c, buf);
buf++;
i++;
cond_resched();
@@ -368,7 +367,7 @@ int do_syslog(int type, char __user *buf, int len)
break;
c = LOG_BUF(j);
spin_unlock_irq(&logbuf_lock);
- error = __put_user(c,&buf[count-1-i]);
+ error = __put_user(c, &buf[count-1-i]);
cond_resched();
spin_lock_irq(&logbuf_lock);
}
@@ -380,8 +379,8 @@ int do_syslog(int type, char __user *buf, int len)
int offset = count-error;
/* buffer overflow during copy, correct user buffer. */
for (i = 0; i < error; i++) {
- if (__get_user(c,&buf[i+offset]) ||
- __put_user(c,&buf[i])) {
+ if (__get_user(c, &buf[i+offset]) ||
+ __put_user(c, &buf[i])) {
error = -EFAULT;
break;
}
@@ -556,7 +555,7 @@ static void zap_locks(void)
#if defined(CONFIG_PRINTK_TIME)
static int printk_time = 1;
#else
-static int printk_time = 0;
+static int printk_time ;
#endif
module_param_named(time, printk_time, bool, S_IRUGO | S_IWUSR);

@@ -659,7 +658,7 @@ asmlinkage int vprintk(const char *fmt, va_list args)
*/
for (p = printk_buf; *p; p++) {
if (log_level_unknown) {
- /* log_level_unknown signals the start of a new line */
+ /* log_level_unknown signals the start of a new line */
if (printk_time) {
int loglev_char;
char tbuf[50], *tp;
@@ -671,7 +670,7 @@ asmlinkage int vprintk(const char *fmt, va_list args)
* force the log level token to be
* before the time output.
*/
- if (p[0] == '<' && p[1] >='0' &&
+ if (p[0] == '<' && p[1] >= '0' &&
p[1] <= '7' && p[2] == '>') {
loglev_char = p[1];
p += 3;
@@ -1176,16 +1175,16 @@ EXPORT_SYMBOL(register_console);

int unregister_console(struct console *console)
{
- struct console *a, *b;
+ struct console *a, *b;
int res = 1;

acquire_console_sem();
if (console_drivers == console) {
- console_drivers=console->next;
+ console_drivers = console->next;
res = 0;
} else if (console_drivers) {
- for (a=console_drivers->next, b=console_drivers ;
- a; b=a, a=b->next) {
+ for (a = console_drivers->next, b = console_drivers;
+ a; b = a, a = b->next) {
if (a == console) {
b->next = a->next;
res = 0;
--
1.5.4.rc2.17.g257f