lkml.org 
[lkml]   [2010]   [Feb]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] scripts/checkpatch.pl: Dramatically improve #define parse times
On Tue, 02 Feb 2010 19:18:32 -0800
Joe Perches <joe@perches.com> wrote:

>
> #define macros currently take a _very_ long time to parse because
> the macro is being searched for multiple statements and unnecessary
> searching is being done when comments are replaced with unprintable
> characters.
>
> For instance:
>
> Without this patch:
> $ time perl ./scripts/checkpatch.pl -f include/linux/mfd/wm831x/irq.h > /dev/null
>
> real 3m43.229s
> user 3m42.254s
> sys 0m0.332s
>
> With this patch:
> $ time perl ./scripts/checkpatch.pl -f include/linux/mfd/wm831x/irq.h > /dev/null
>
> real 0m1.372s
> user 0m1.348s
> sys 0m0.020s
>
> A 160:1 improvement.
>
> I don't know if this is correct, but it seems to work for me.

This patch triggers lots of warnings:

akpm:/usr/src/25> perl scripts/checkpatch.pl patches/drivers-char-memc-cleanups-fix.patch
Use of uninitialized value in length at scripts/checkpatch.pl line 1589.
Use of uninitialized value in substr at scripts/checkpatch.pl line 1589.
Use of uninitialized value in substr at scripts/checkpatch.pl line 1589.
Use of uninitialized value in pattern match (m//) at scripts/checkpatch.pl line 1597.
Use of uninitialized value in pattern match (m//) at scripts/checkpatch.pl line 1655.
Use of uninitialized value in length at scripts/checkpatch.pl line 1589.
Use of uninitialized value in substr at scripts/checkpatch.pl line 1589.
Use of uninitialized value in substr at scripts/checkpatch.pl line 1589.
Use of uninitialized value in pattern match (m//) at scripts/checkpatch.pl line 1597.
Use of uninitialized value in pattern match (m//) at scripts/checkpatch.pl line 1655.
Use of uninitialized value in length at scripts/checkpatch.pl line 1589.
Use of uninitialized value in substr at scripts/checkpatch.pl line 1589.
Use of uninitialized value in substr at scripts/checkpatch.pl line 1589.
Use of uninitialized value in pattern match (m//) at scripts/checkpatch.pl line 1597.
Use of uninitialized value in pattern match (m//) at scripts/checkpatch.pl line 1655.
Use of uninitialized value in length at scripts/checkpatch.pl line 1589.
Use of uninitialized value in substr at scripts/checkpatch.pl line 1589.
Use of uninitialized value in substr at scripts/checkpatch.pl line 1589.
Use of uninitialized value in pattern match (m//) at scripts/checkpatch.pl line 1597.
Use of uninitialized value in pattern match (m//) at scripts/checkpatch.pl line 1655.


Test case:


diff -puN drivers/char/mem.c~drivers-char-memc-cleanups-fix drivers/char/mem.c
--- a/drivers/char/mem.c~drivers-char-memc-cleanups-fix
+++ a/drivers/char/mem.c
@@ -579,7 +579,7 @@ static ssize_t read_port(struct file *fi
if (!access_ok(VERIFY_WRITE, buf, count))
return -EFAULT;
while (count-- > 0 && i < 65536) {
- if (__put_user(inb(i),tmp) < 0)
+ if (__put_user(inb(i), tmp) < 0)
return -EFAULT;
i++;
tmp++;
@@ -594,7 +594,7 @@ static ssize_t write_port(struct file *f
unsigned long i = *ppos;
const char __user * tmp = buf;

- if (!access_ok(VERIFY_READ,buf,count))
+ if (!access_ok(VERIFY_READ, buf, count))
return -EFAULT;
while (count-- > 0 && i < 65536) {
char c;
@@ -603,7 +603,7 @@ static ssize_t write_port(struct file *f
break;
return -EFAULT;
}
- outb(c,i);
+ outb(c, i);
i++;
tmp++;
}
@@ -630,7 +630,7 @@ static int pipe_to_null(struct pipe_inod
return sd->len;
}

-static ssize_t splice_write_null(struct pipe_inode_info *pipe,struct file *out,
+static ssize_t splice_write_null(struct pipe_inode_info *pipe, struct file *out,
loff_t *ppos, size_t len, unsigned int flags)
{
return splice_from_pipe(pipe, out, ppos, len, flags, pipe_to_null);
@@ -831,7 +831,7 @@ static ssize_t kmsg_write(struct file *f
}

static const struct file_operations kmsg_fops = {
- .write = kmsg_write,
+ .write = kmsg_write,
};

static const struct memdev {
@@ -907,7 +907,7 @@ static int __init chr_dev_init(void)
if (err)
return err;

- if (register_chrdev(MEM_MAJOR,"mem",&memory_fops))
+ if (register_chrdev(MEM_MAJOR, "mem", &memory_fops))
printk("unable to get major %d for memory devs\n", MEM_MAJOR);

mem_class = class_create(THIS_MODULE, "mem");
_




\
 
 \ /
  Last update: 2010-02-09 00:19    [W:0.039 / U:1.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site