2008-01-03 23:15:11

by Paolo Ciarrocchi

[permalink] [raw]
Subject: [PATCH] This patch to printk.c fixes a few errors reported by checkpatch.pl

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


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..00f784f 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


2008-01-03 23:43:16

by Jesper Juhl

[permalink] [raw]
Subject: Re: [PATCH] This patch to printk.c fixes a few errors reported by checkpatch.pl

On 04/01/2008, Paolo Ciarrocchi <[email protected]> wrote:
> This patch to printk.c fixes a few errors reported by checkpatch.pl
>
[...]
> - for (a=console_drivers->next, b=console_drivers ;
> - a; b=a, a=b->next) {
> + for (a = console_drivers->next, b = console_drivers ;

I would say that if you are modifying this line anyway you should make it read

for (a = console_drivers->next, b = console_drivers;

(the change is the removal of the space before the ';' at the end of the line)

otherwise I think it looks sane enough as a small style cleanup.

--
Jesper Juhl <[email protected]>
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please http://www.expita.com/nomime.html

2008-01-03 23:49:40

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH] This patch to printk.c fixes a few errors reported by checkpatch.pl

On Fri, 4 Jan 2008 00:14:46 +0100 Paolo Ciarrocchi wrote:

> 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
>
>
> 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..00f784f 100644
> --- a/kernel/printk.c
> +++ b/kernel/printk.c

Hi,

Please read Andrew's "The Perfect Patch," especially the section
about Subject: lines.

http://www.zip.com.au/~akpm/linux/patches/stuff/tpp.txt

---
~Randy
desserts: http://www.xenotime.net/linux/recipes/