History log of /scripts/checkpatch.pl
Revision Date Author Comments
17441227f6258fc379c6ebfe21c3eec43b6f0de3 16-Jun-2011 Joe Perches <joe@perches.com> checkpatch: add warning for uses of printk_ratelimit

Warn about uses of printk_ratelimit() because it uses a global state and
can hide subsequent useful messages.

Signed-off-by: Joe Perches <joe@perches.com>
Cc: Andy Whitcroft <apw@canonical.com>
Cc: Richard Weinberger <richard@nod.at>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
0fccc6221821e07366aa44bca112c4edb6d04dd7 25-May-2011 Joe Perches <joe@perches.com> checkpatch: fix defect in printk(KERN_<LEVEL> 80 column exceptions

Currently, printk lines with a only KERN_PREFIX and a quoted string
without a comma or close paren that exceed 80 columns are flagged with a
warning.

ie:
printk(KERN_WARNING "some long string that extends beond 80 cols..."
"and is continued on another line\n");

Allow this form instead of emitting a warning.

Signed-off-by: Joe Perches <joe@perches.com>
Cc: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
b05317221b7607ba61ee921c31867ed08912aa46 25-May-2011 Joe Perches <joe@perches.com> checkpatch: add <foo>_<level> and MODULE_<BAR> to 80 column exceptions

Many module or file local logging functions use specific prefixes other
than pr|dev|netdev. Allow all forms like foo_printk and foo_err to be
longer than 80 columns.

Also allow MODULE_<BAR> declarations to be longer than 80 columns.

Signed-off-by: Joe Perches <joe@perches.com>
Cc: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
428e2fdc4ecee2312829e97549f99c12312f4faf 25-May-2011 Joe Perches <joe@perches.com> checkpatch: add check for line continuations in quoted strings

Add a warning for unterminated quoted strings with line continuations as
these frequently add unwanted whitespace.

Signed-off-by: Joe Perches <joe@perches.com>
Cc: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
25985edcedea6396277003854657b5f3cb31a628 31-Mar-2011 Lucas De Marchi <lucas.demarchi@profusion.mobi> Fix common misspellings

Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
309c00c73f053a905d144b430d4fb55d811085e2 23-Mar-2011 Dave Jones <davej@redhat.com> checkpatch: warn about memset with swapped arguments

Because the second and third arguments of memset have the same type, it
turns out to be really easy to mix them up.

This bug comes up time after time, so checkpatch should really be checking
for it at patch submission time.

Signed-off-by: Dave Jones <davej@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
b0781216e7bff68aca2fbcd275b4db7531d1e22f 23-Mar-2011 Mike Frysinger <vapier@gentoo.org> scripts/checkpatch.pl: reset rpt_cleaners warnings

If you run checkpatch against multiple patches, and one of them has a
whitespace issue which can be helped via a script (rpt_cleaners), you will
see the same NOTE over and over for all subsequent patches. It makes it
seem like those patches also have whitespace problems when in reality,
there's only one or two bad apples.

So reset rpt_cleaners back to 0 after we've issued the note so that it
only shows up near the patch with the actual problems.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Cc: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
33ee3b2e2eb9b4b6c64dcf9ed66e2ac3124e748c 23-Mar-2011 Alexey Dobriyan <adobriyan@gmail.com> kstrto*: converting strings to integers done (hopefully) right

1. simple_strto*() do not contain overflow checks and crufty,
libc way to indicate failure.
2. strict_strto*() also do not have overflow checks but the name and
comments pretend they do.
3. Both families have only "long long" and "long" variants,
but users want strtou8()
4. Both "simple" and "strict" prefixes are wrong:
Simple doesn't exactly say what's so simple, strict should not exist
because conversion should be strict by default.

The solution is to use "k" prefix and add convertors for more types.
Enter
kstrtoull()
kstrtoll()
kstrtoul()
kstrtol()
kstrtouint()
kstrtoint()

kstrtou64()
kstrtos64()
kstrtou32()
kstrtos32()
kstrtou16()
kstrtos16()
kstrtou8()
kstrtos8()

Include runtime testsuite (somewhat incomplete) as well.

strict_strto*() become deprecated, stubbed to kstrto*() and
eventually will be removed altogether.

Use kstrto*() in code today!

Note: on some archs _kstrtoul() and _kstrtol() are left in tree, even if
they'll be unused at runtime. This is temporarily solution,
because I don't want to hardcode list of archs where these
functions aren't needed. Current solution with sizeof() and
__alignof__ at least always works.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
d04fa5a3ba06c3b7a1c4a6860d0fa4825507a755 23-Jan-2011 Thomas Gleixner <tglx@linutronix.de> locking: Remove deprecated lock initializers

Last users are gone. Remove the left overs.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
3d130fd03e06672f7700e2cb694b29f9a98227ca 13-Jan-2011 Joe Perches <joe@perches.com> checkpatch.pl: add "prefer __packed" check

There's a __packed #define for __attribute__((packed)). Add a checkpatch
to tell people about it.

Signed-off-by: Joe Perches <joe@perches.com>
Cc: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
88f8831c055858179a7844d9dd4ddd7d3621322e 13-Jan-2011 Dave Jones <davej@redhat.com> checkpatch: check for world-writeable sysfs/debugfs files

Exporting world writable sysfs/debugfs files is usually a bad thing. Warn
about it.

Signed-off-by: Dave Jones <davej@redhat.com>
Cc: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
c023e4734c3e8801e0ecb5e81b831d42a374d861 13-Jan-2011 Florian Mickler <florian@mickler.org> checkpatch.pl: fix CAST detection

We should only claim that something is a cast if we did not encouter a
token before, that did set av_pending.

This fixes the operator * in the line below to be detected as binary (vs
unary).

kmalloc(sizeof(struct alphatrack_ocmd) * true_size, GFP_KERNEL);

Reported-by: Audun Hoem <audun.hoem@gmail.com>
Signed-off-by: Florian Mickler <florian@mickler.org>
Cc: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
caf2a54f101a55ec318c2a20253a1977802f7de4 13-Jan-2011 Joe Perches <joe@perches.com> scripts/checkpatch.pl: add check for multiple terminating semicolons and casts of vmalloc

Signed-off-by: Joe Perches <joe@perches.com>
Cc: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
4882720b267b7b1d1b0ce08334b205f0329d4615 07-Sep-2010 Thomas Gleixner <tglx@linutronix.de> semaphore: Remove mutex emulation

Semaphores used as mutexes have been deprecated for years. Now that
all users are either converted to real semaphores or to mutexes remove
the cruft.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Christoph Hellwig <hch@infradead.org>
LKML-Reference: <20100907125057.562399240@linutronix.de>
93ed0e2d07b25aff4db1d61bfbcd1e82074c0ad5 26-Oct-2010 Joe Perches <joe@perches.com> scripts/checkpatch.pl: add check for declaration of pci_device_id

Signed-off-by: Joe Perches <joe@perches.com>
Cc: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
cb710eca6820493add0ddd3d7e8e3ee53f2b6e57 26-Oct-2010 Joe Perches <joe@perches.com> scripts/checkpatch.pl: add warnings for static char that could be static const char

Add warnings for possible missing const uses of
static char foo[] = "bar"
that could be
static const char foo[] = "bar"
and
static const char *foo[] = {"bar", "baz"}
that could be
static const char * const foo[] = {"bar", "baz"}

Signed-off-by: Joe Perches <joe@perches.com>
Cc: Mike Frysinger <vapier.adi@gmail.com>
Cc: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
267ad8f42644c2fa4ff6c2e7596d2b02c7397c85 26-Oct-2010 Andy Whitcroft <apw@canonical.com> checkpatch: version 0.31

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
01464f30a97c5c30bf9633309b27cce055cef8fd 26-Oct-2010 Andy Whitcroft <apw@canonical.com> checkpatch: statement/block context analyser should look at sanitised lines

When tracking context to find a block or statement we need to use the
sanitised lines, else perentheses '(' & ')' and braces '{' & '}' can throw
the scanner out. Also fix up a couple of error outputs which include
those sanitised lines incorrectly.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
3cbf62df3a8ce61cb1aa20b7dae964058988bfdd 26-Oct-2010 Andy Whitcroft <apw@canonical.com> checkpatch: handle EXPORT_SYMBOL for DEVICE_ATTR and similar

Handly definitions similar to below. The definition macro spits out a
symbol with a prefix. Add matching of any identifier prefix:

DEVICE_ATTR(link_power_management_policy, S_IRUGO | S_IWUSR,
ata_scsi_lpm_show, ata_scsi_lpm_put);
EXPORT_SYMBOL_GPL(dev_attr_link_power_management_policy);

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
5eaa20b984eb316533b4a098d8de3912e434df6a 26-Oct-2010 Andy Whitcroft <apw@canonical.com> checkpatch: clean up structure definition macro handline

Handle definitions such as the following correctly, it is not
a complex statement:

#define PREALLOC(NAME, START, END, FLAGS) { \
.name = (NAME), \
.start = (START), \
.end = (END), \
.flags = (FLAGS) \
},

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
015830be9779aeae7de7060b07a3157a8e41bcb4 26-Oct-2010 Andy Whitcroft <apw@canonical.com> checkpatch: update copyright dates

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
03f1df7da5696ddfa6e167b37e0c0ce5aad3de79 26-Oct-2010 Joe Perches <joe@perches.com> checkpatch: Add additional attribute #defines

On Wed, 2010-08-11 at 12:35 -0400, Dave Jones wrote:
> I just got this from a patch I merged..
>
> ERROR: need consistent spacing around '*' (ctx:WxV)
> #121: FILE: arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c:113:
> +static struct pcc_cpu __percpu *pcc_cpu_info;
> ^
> which doesn't seem right.

Perhaps these need to be added to checkpatch.

[apw@canonical.com: added tests]
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Cc: Dave Jones <davej@codemonkey.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
3bf9a009fccea422bc355414a3bdf5f35fff9f36 26-Oct-2010 Rabin Vincent <rabin.vincent@stericsson.com> checkpatch: check for incorrect permissions

Throw an error when a source file has been given execute permissions using
the mode change line present in git diffs. Also alow the filename
matching to use the "diff" line in addition to the "+++" line, since the
mode change lines appear before any "+++" lines.

[apw@canonical.com: simplified filename logic slightly, added tests]
Cc: Andy Whitcroft <apw@canonical.com>
Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9fe287d79b0af983050d24e7916cf3d1f019f553 26-Oct-2010 Andy Whitcroft <apw@canonical.com> checkpatch: ensure kconfig help checks only apply when we are adding help

When checking the length of the help we need to be sure we are seeing the
whole story before erroring. Firstly we only want to check when adding
the help in the first place. Second we need to be sure that we are seeing
the end of the entry, nominally when there is no context below or that
context shows the start of the next entry.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
0c73b4eb7a825a5aff16d8a9701f6c28056de058 26-Oct-2010 Andy Whitcroft <apw@canonical.com> checkpatch: simplify and consolidate "missing space after" checks

Commonise the code for missing spaces after struct, union, and enum such
that they share the same code. Ensure we cover all the common cases in
each case. Check against the sanitised line to ensure we do not report on
comments and strings.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
8cf6de7145943caa38c56c61cd83b17687afd900 26-Oct-2010 Andy Whitcroft <apw@canonical.com> checkpatch: add check for space after struct, union, and enum

Add spacing checks for struct, union, and enum definitions. Check the
spacing after type and before the equals (=) and open brace ({).

Based on a patch by Joe Perches.

Cc: Joe Perches <joe@perches.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
53a3c4487a05b8f26ef72fe434a750a3402c998f 26-Oct-2010 Andy Whitcroft <apw@canonical.com> checkpatch: returning errno typically should be negative

Add a (strict mode only) test to check for non-negative returns of what
appear to be errno values as the majority case these should indeed be
negative.

Suggested-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9446ef569c288e683225fec8337a0b2b81e75cc5 26-Oct-2010 Andy Whitcroft <apw@canonical.com> checkpatch: handle casts better fixing false categorisation of : as binary

The following incantation is triggering categorisation of its colon (:) as
a binary form, which it is not:

return foo ? (s8)bar : baz;

Handle casts differently from types in the categoriser, allowing us to
better track (s8)bar as a value and not a declaration.

Reported-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fb2d2c1b5825503d30fb6f2dc328dbe4a47d9794 26-Oct-2010 Andy Whitcroft <apw@canonical.com> checkpatch: ensure we do not collapse bracketed sections into constants

When determining if a return () sequence is a function style bracketing we
simplify the expression one bracket at a time replacing each with a
constant. However this can trigger a false merge with expressions as
below:

return (foo)0;

Prevent this false merging.

Reported-by: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
d2c0a23514d8ac4ed10a8e742467cfb72ca3bed8 26-Oct-2010 Andy Whitcroft <apw@canonical.com> checkpatch: suggest cleanpatch and cleanfile when appropriate

When we hit types of whitespace which may be fixed by scripts/cleanpatch
and scripts/cleanfile suggest their use in our report.

Suggested-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
e91b6e263ed6735c766cb14bbe63b9c7bd774526 26-Oct-2010 Andy Whitcroft <apw@canonical.com> checkpatch: types may sit on a line on their own

When the following form is used we have a type which fully fills a line.
This means that a type may end at the end of line as well as at the
following identifier.

int **
foo;

Reported-by: Daniel Walker <dwalker@fifo99.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
6b4c5bebcebb0a48d29947e9aa749650751a7696 26-Oct-2010 Andy Whitcroft <apw@canonical.com> checkpatch: fix regressions in "fix handling of leading spaces"

The patch "checkpatch: fix handling of leading spaces" added checks for
leading spaces on lines, but this introduces regressions. Firstly it does
not correctly detect when we are in a comment. Secondly it does not allow
for preprocessor command spacing. Finally it does not allow for label
indentation which is required to be less than one tab. Fix these up:

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
b998e001e6ce6540ea04a264debc50ae44d2db7a 10-Aug-2010 Patrick Pannuto <ppannuto@codeaurora.org> checkpatch: fix extraneous EXPORT_SYMBOL* warnings

These are caused by checkpatch incorrectly parsing its internal
representation of a statement block for struct's (or anything else that is
a statement block encapsulated in {}'s that also ends with a ';'). Fix
this by properly parsing a statement block.

An example:

+struct dummy_type dummy = {
+ .foo = "baz",
+};
+EXPORT_SYMBOL_GPL(dummy);
+
+static int dummy_func(void)
+{
+ return -EDUMMYCODE;
+}
+EXPORT_SYMBOL_GPL(dummy_func);

WARNING: EXPORT_SYMBOL(foo); should immediately \
follow its function/variable
#19: FILE: dummy.c:4:
+EXPORT_SYMBOL_GPL(dummy);

The above warning is issued when it should not be.

Signed-off-by: Patrick Pannuto <ppannuto@codeaurora.org>
Cc: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
09ef87255da0e005dd0ab39ca25714208cf29cb3 10-Aug-2010 Patrick Pannuto <ppannuto@codeaurora.org> checkpatch: warn about unexpectedly long msleep's

As explained in Documentation/timers/timers-howto.txt, msleep's of < 20ms
may sleep for as long as 20ms. Caller's of msleep(1) or msleep(2), etc
are likely not to expect this quirky behavior - warn them.

Signed-off-by: Patrick Pannuto <ppannuto@codeaurora.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1a15a250862fda3fbdf8454cc7131e24de904e7c 10-Aug-2010 Patrick Pannuto <ppannuto@codeaurora.org> checkpatch: prefer usleep_range over udelay

When possible, sleeping is (usually) better than delaying; however, don't
bother callers of udelay < 10us, as those cases are generally not worth
the switch to usleep

[akpm@linux-foundation.org: fix mismatched parentheses]
Signed-off-by: Patrick Pannuto <ppannuto@codeaurora.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
8bbea968f9022c3f66a36902509574597611be99 10-Aug-2010 Joe Perches <joe@perches.com> checkpatch: add more exceptions to 80 char lines

Add new logging functions netdev_<level> and netif_<level>.
Don't complain if the only thing on a line is a quoted string.

Signed-off-by: Joe Perches <joe@perches.com>
Cc: Andy Whitcroft <apw@shadowen.org>
Cc: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
5150bda43c58cdce7eb851c3fe2ca913524459a0 10-Aug-2010 Joe Eloff <kagen101@gmail.com> checkpatch: change externals to globals

Make error message say 'ERROR: do not initialise globals to 0 or NULL'
rather than 'ERROR: do not initialise externals to 0 or NULL'. Makes more
sense in the context since there is an extern keyword in C and that is a
global declaration within the scope of the current file.

Signed-off-by: Joe Eloff <kagen101@gmail.com>
Cc: Andy Whitcroft <apw@shadowen.org>
Cc: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
5f7ddae6104d85e27c0fbcb508cfe8286a01a5e1 10-Aug-2010 Raffaele Recalcati <raffaele.recalcati@bticino.it> checkpatch: fix handling of leading spaces

I've got a false positive when spaces are present at the beginning of a
line.

So I add this check, obviously excluding to check the lines in the middle of
comments.

For instance this code passes the checkpatch test:

+struct davinci_mcbsp_data {
+ unsigned int fmt;
+ int clk_div;
+};
+
+static struct davinci_mcbsp_data mcbsp_data;

Where, before the string "int clk_div", I have 4 spaces (\040
ascii character).

With v2.6.34 scripts/checkpatch.pl script I get:

scripts/checkpatch.pl 0001-ASoC-DaVinci-Added-support-for-stereo-I2S.patch
total: 0 errors, 0 warnings, 201 lines checked
0001-ASoC-DaVinci-Added-support-for-stereo-I2S.patch has no obvious style
problems and is ready for submission.

That is not correct. Instead with the proposed patch I get:

scripts/checkpatch.pl 0001-ASoC-DaVinci-Added-support-for-stereo-I2S.patch
WARNING: please, no space for starting a line,
excluding comments
#63: FILE: sound/soc/davinci/davinci-i2s.c:165:
+ int clk_div;$

WARNING: please, no space for starting a line,
excluding comments
#95: FILE: sound/soc/davinci/davinci-i2s.c:406:
+ return 0;$

total: 0 errors, 2 warnings, 201 lines checked

That is correct.

Signed-off-by: Raffaele Recalcati <raffaele.recalcati@bticino.it>
Cc: Wolfram Sang <w.sang@pengutronix.de>
Cc: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
7840a94cd12559d8aee6382fafb85fbc9eb3a2c2 10-Aug-2010 Wolfram Sang <w.sang@pengutronix.de> checkpatch: refactor 'allowed asm includes' and add memory.h

Change the check suggesting replacement of asm-includes with
linux-includes. Exceptions to this rule are easier to extend now. Add
memory.h because ARM has a custom one.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
d4977c78e9c7dd042f96f4a21d957bc25a561333 24-May-2010 Tobias Klauser <tklauser@distanz.ch> checkpatch: warn on declaration with storage class not at the beginning

The C99 specification states in section 6.11.5:

The placement of a storage-class specifier other than at the beginning
of the declaration specifiers in a declaration is an obsolescent
feature.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Acked-by: Jean Delvare <khali@linux-fr.org>
Cc: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
3354957a4f8b9bb4b43625232acdf0626851c82f 24-May-2010 Andi Kleen <ak@linux.intel.com> checkpatch: add check for too short Kconfig descriptions

I've seen various new Kconfigs with rather unhelpful one liner
descriptions. Add a Kconfig warning for a minimum length of the Kconfig
help section.

Right now I arbitarily chose 4. The exact value can be debated.

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Cc: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1704f47b50b5d9e1b825e43e1baaf2c5897baf03 19-Mar-2010 Peter Zijlstra <peterz@infradead.org> lockdep: Add novalidate class for dev->mutex conversion

The conversion of device->sem to device->mutex resulted in lockdep
warnings. Create a novalidate class for now until the driver folks
come up with separate classes. That way we have at least the basic
mutex debugging coverage.

Add a checkpatch error so the usage is reserved for device->mutex.

[ tglx: checkpatch and compile fix for LOCKDEP=n ]

Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
5e79d96eed306a8b4af67b3f35f6867edfabeebc 05-Mar-2010 Joe Perches <joe@perches.com> checkpatch: warn on unnecessary spaces before quoted newlines

Signed-off-by: Joe Perches <joe@perches.com>
Cc: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
08e4436566250cb98b3f3ac37643b1cf09481256 05-Mar-2010 Alberto Panizzo <maramaopercheseimorto@gmail.com> checkpatch.pl: warn if an adding line introduce spaces before tabs.

Signed-off-by: Alberto Panizzo <maramaopercheseimorto@gmail.com>
Cc: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
79404849e90a41ea2109bd0e2f7c7164b0c4ce73 05-Mar-2010 Emese Revfy <re.emese@gmail.com> checkpatch.pl: extend list of expected-to-be-const structures

Based on Arjan's suggestion, extend the list of ops structures that should
be const.

Signed-off-by: Emese Revfy <re.emese@gmail.com>
Cc: Andy Whitcroft <apw@shadowen.org>
Cc: Arjan van de Ven <arjan@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
22fd2d3e4f75a2596ccdfdcbdfd505c9c60bf346 05-Mar-2010 Stefani Seibold <stefani@seibold.net> checkpatch.pl: add union and struct to the exceptions list

Here is a small code snippet, which will be complained about by
checkpatch.pl:

#define __STRUCT_KFIFO_COMMON(recsize, ptrtype) \
union { \
struct { \
unsigned int in; \
unsigned int out; \
}; \
char rectype[recsize]; \
ptrtype *ptr; \
const ptrtype *ptr_const; \
};

This construct is legal and safe, so checkpatch.pl should accept this. It
should be also true for struct defined in a macro.

Add the `struct' and `union' keywords to the exceptions list of the
checkpatch.pl script, to prevent error message "Macros with multiple
statements should be enclosed in a do - while loop". Otherwise it is not
possible to build a struct or union with a macro.

Signed-off-by: Stefani Seibold <stefani@seibold.net>
Cc: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
52131292c069b74f4b5f3c786ff66ff6e82b0e69 05-Mar-2010 Wolfram Sang <w.sang@pengutronix.de> checkpatch: fix false positive on __initconst

checkpatch falsely complained about '__initconst' because it thought the
'const' needed a space before. Fix this by changing the list of
attributes:

- add '__initconst'
- force plain 'init' to contain a word-boundary at the end

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Cc: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
691e669ba8c64d31ac08d87b1751e6acfa3ff65e 05-Mar-2010 Joe Perches <joe@perches.com> checkpatch.pl: allow > 80 char lines for logging functions not just printk

Signed-off-by: Joe Perches <joe@perches.com>
Cc: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
42bdf74c95b6935f3c09a09ba4bead6cad11b540 05-Mar-2010 Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> checkpatch: trivial fix for trailing statements check

In case if the statement and the conditional are in one line, the line
appears in the report doubly.

And items of this check have no blank line before the next item.

This patch fixes these trivial problems, to improve readability of the
report.

[sample.c]
> if (cond1
> && cond2
> && cond3) func_foo();
>
> if (cond4) func_bar();

Before:
> ERROR: trailing statements should be on next line
> #1: FILE: sample.c:1:
> +if (cond1
> [...]
> + && cond3) func_foo();
> ERROR: trailing statements should be on next line
> #5: FILE: sample.c:5:
> +if (cond4) func_bar();
> +if (cond4) func_bar();
> total: 2 errors, 0 warnings, 5 lines checked

After:
> ERROR: trailing statements should be on next line
> #1: FILE: sample.c:1:
> +if (cond1
> [...]
> + && cond3) func_foo();
>
> ERROR: trailing statements should be on next line
> #5: FILE: sample.c:5:
> +if (cond4) func_bar();
>
> total: 2 errors, 0 warnings, 5 lines checked

Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Cc: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
8f53a9b80f011080555c498d2ca2dc6b1a77c42c 05-Mar-2010 Joe Perches <joe@perches.com> scripts/checkpatch.pl: add WARN on sizeof(&foo)

sizeof(&foo) is frequently an error. Warn on its use.

Signed-off-by: Joe Perches <joe@perches.com>
Cc: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
dbf004d7883b3adb058c0c1a5635bc4ec27651c0 12-Jan-2010 Dave Jones <davej@redhat.com> remove my email address from checkpatch.

Maybe this will stop people emailing me about it.

Signed-off-by: Dave Jones <davej@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
5e8d8f6f2844d4a663415c660ab5cc92e2e2477d 27-Oct-2009 Andy Whitcroft <apw@canonical.com> checkpatch: version 0.30

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2b474a1a566064b40bc7d9a45021ffbc4c894fa3 27-Oct-2009 Andy Whitcroft <apw@canonical.com> checkpatch: fix false EXPORT_SYMBOL warning

Ingo reported that the following lines triggered a false warning,

static struct lock_class_key rcu_lock_key;
struct lockdep_map rcu_lock_map =
STATIC_LOCKDEP_MAP_INIT("rcu_read_lock", &rcu_lock_key);
EXPORT_SYMBOL_GPL(rcu_lock_map);

from kernel/rcutree.c , and the false warning looked like this,

WARNING: EXPORT_SYMBOL(foo); should immediately follow its
function/variable
+EXPORT_SYMBOL_GPL(rcu_lock_map);

We actually should be checking the statement before the EXPORT_* for a
mention of the exported object, and complain where it is not there.

[akpm@linux-foundation.org: coding-style fixes]
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reported-by: Daniel Walker <dwalker@fifo99.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
99423c2065b62fee41cdbd8da7e63bf1f8f9e9b0 27-Oct-2009 Andy Whitcroft <apw@canonical.com> checkpatch: fix __attribute__ matching

In the following code,

union thread_union init_thread_union
__attribute__((__section__(".data.init_task"))) =
{ INIT_THREAD_INFO(init_task) };

There is a non-conforming declaration. It should really be like the
following,

union thread_union init_thread_union
__attribute__((__section__(".data.init_task"))) = {
INIT_THREAD_INFO(init_task)
};

However, checkpatch doesn't catch this right now because it doesn't
correctly evaluate the "__attribute__".

It is not at all clear that we care what preceeds an assignment style
attribute when we find the open brace. Relax the test so we do not need
to check the __attribute__.

Reported-by: Daniel Walker <dwalker@fifo99.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2ceb532b04b7a3b8f534d11a6e839f8b8bff94c1 27-Oct-2009 Andy Whitcroft <apw@canonical.com> checkpatch: fix false errors due to macro concatenation

The macro concatenation (##) sequence can cause false errors when checking
macro's. Checkpatch doesn't currently know about the operator.

For example this line,

+ entry = (struct ftrace_raw_##call *)raw_data; \

is correct but it produces the following error,

ERROR: need consistent spacing around '*' (ctx:WxB)
+ entry = (struct ftrace_raw_##call *)raw_data;\
^

The line above doesn't have any spacing problems, and if you remove the
macro concatenation sequence checkpatch doesn't give any errors.

Extend identifier handling to include ## concatenation within the
definition of an identifier.

Reported-by: Daniel Walker <dwalker@fifo99.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
131edb3418018b6da297ed389b541e697043a8b6 27-Oct-2009 Andy Whitcroft <apw@canonical.com> checkpatch: update copyright dates

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
cc77cdca5209c1199deb33f3a83df191ac32f4d6 27-Oct-2009 Andy Whitcroft <apw@canonical.com> checkpatch: correctly stop scanning at the bottom of a hunk

We are allowing context scanning checks to apply against the first line of
context outside at the end of the hunk. This can lead to false matches to
patch names leading to various perl warnings. Correctly stop at the
bottom of the hunk.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9a974fdbe3fbb4b0f6d552579dc79ac237412c61 27-Oct-2009 Andy Whitcroft <apw@canonical.com> checkpatch: possible types -- prevent illegal modifiers being added

Prevent known non types being detected as modifiers. Ensure we do not
look at any type which starts with a keyword.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
42e41c54d61e32e8a349943607daa53205324d7f 22-Sep-2009 Mike Frysinger <vapier@gentoo.org> checkpatch: add some common Blackfin checks

Add checks for Blackfin-specific issues that seem to crop up from time to
time. In particular, we have helper macros to break a 32bit address into
the hi/lo parts, and we want to make sure people use the csync/ssync
variant that includes fun anomaly workarounds.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Cc: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
0487683096decad0720dfaf80b9d28173d5f6662 22-Sep-2009 Andy Whitcroft <apw@canonical.com> checkpatch: version 0.29

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fb9e9096ba94385b738a8ad6c5864b5778285957 22-Sep-2009 Andy Whitcroft <apw@canonical.com> checkpatch: limit sN/uN matches to actual bit sizes

Limit our type matcher to the s/u/le/be etc sizes that actually exist to
prevent miss categorising s2 as a type. Fix up the spelling of the error
also.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
ea71a0a019f913bdf506103bd90140d93a2b83f0 22-Sep-2009 Andy Whitcroft <apw@canonical.com> checkpatch: format strings should not have brackets in macros

We should not recommend braces for the following:

#define pr_fmt(fmt) "%s: " fmt, __func__

allow things with double quotes round them to avoid this check.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
77f5b10a82bbd832c99ec4b120d5645342a5b140 22-Sep-2009 Hannes Eder <hannes@hanneseder.net> checkpatch: make -f alias --file, add --help, more verbose help message

Impact:
- More verbose help/usage message.
- Make the option -f an alias for --file.
- On -h, --help, and --version display help message and exit(0).
- With no FILE(s) given, exit(1) with "no input files".
- On invalid options display help/usage and exit(1).

Based on a patch by Pavel Machek.

Signed-off-by: Hannes Eder <hannes@hanneseder.net>
Acked-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
30dad6ebecffebddf6b9947d11e31377fa900ff3 22-Sep-2009 Andy Whitcroft <apw@canonical.com> checkpatch: indent checks -- stop when we run out of continuation lines

Ensure we terminate when there are no futher continuation lines when
trying to determine relative indent of conditionals and their blocks.

Reported-by: John Daiker <daikerjohn@gmail.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
113f04a836481e9ecc26e8dee8b0e4d52878a288 22-Sep-2009 Daniel Walker <dwalker@fifo99.com> checkpatch: handle C99 comments correctly (performance issue)

This fixes the sanitation process in checkpatch.pl so that it blocks out
the text after a C99 style comment the same way it does with block style
comments. This prevents the text from getting processed as regular code.

Signed-off-by: Daniel Walker <dwalker@fifo99.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
463f28648586721c2191130c9b3c27589dcc11a0 22-Sep-2009 Andy Whitcroft <apw@canonical.com> checkpatch: possible types -- else cannot start a type

An else cannot start a type, it would have to be within a block after the
else. This can trigger false modifier matching.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
bea5606d08a36a5fdcf815073d3593ddd2c8549e 27-Feb-2009 Andy Whitcroft <apw@canonical.com> checkpatch: version 0.28

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
417495eda3ce50f9c6d28f8e9ddb3bbb25f07f4c 27-Feb-2009 Andy Whitcroft <apw@canonical.com> checkpatch: add __ref as a sparse modifier

Add __ref as a sparse modifier.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9360b0e50e9f3e0fd70a077b4ede9885ebc21720 27-Feb-2009 Andy Whitcroft <apw@canonical.com> checkpatch: extend attribute testing to all modifiers

We should allow testing of all modifiers not just attributes. Extend
testing and test for all the know modifiers.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
667026e7b082ad59eb7194d6b5d159ed6c340e05 27-Feb-2009 Andy Whitcroft <apw@canonical.com> checkpatch: a modifier is not an identifier at the end of a type

We must make sure we do not misrecognise a modifier as an Identifier
when trying to match types. Prevent us matching this:

void * __ref

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
a3340b35787975414d5f6fee83e00640688be2cb 27-Feb-2009 Andy Whitcroft <apw@canonical.com> checkpatch: pointer type star may have modifiers following

We may have any modifier following a pointer type star. Handle this:

void * __user * __user foo;

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
00ef4ece05096a5c523e265b8ce6627fb5e171c2 27-Feb-2009 Andy Whitcroft <apw@canonical.com> checkpatch: correctly handle type spacing in the face of modifiers

We need to handle interspersed modifiers in the middle of pointer types,
for example:

void * __user * __user bar;

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
e2f7aa4b8bc811ebf8afbdf423caf90a5a03cb08 27-Feb-2009 Andy Whitcroft <apw@canonical.com> checkpatch: do not warn about -p0 patches when checking files

We are triggering the -p0 check for our own diffs generated using --file
command line option. Suppress this check for files.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
f4a8773676c21a68b0666fbe48af4fe1af89dfa9 27-Feb-2009 Andy Whitcroft <apw@canonical.com> checkpatch: make in_atomic ok in the core

We say that in_atomic() is ok in the core kernel, but then always report
it regardless of where in the kernel it is. Keep quiet if it is used in
kernel/*.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
db92a6502d4e8cb885e85e862b24ba5c07036fbf 15-Jan-2009 Andy Whitcroft <apw@canonical.com> checkpatch: version: 0.27

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
6903ffb2257266472ef2edd0092d526ae2dc00f7 15-Jan-2009 Andy Whitcroft <apw@canonical.com> checkpatch: struct seq_operations should normally be const

In the general use case struct seq_operations should be a const object.
Check for and warn where it is not.

Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
39667782362becd5527e48d6c976a9f9985b95e6 15-Jan-2009 Andy Whitcroft <apw@canonical.com> checkpatch: if should not continue a preceeding brace

We should not be continuing a braced section with an if, for example:

if (...) {
} if (...) {
}

Detect this and suggest adding a newline.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
63f17f8973ccdb8260e59ce5b1b4e2b2ee0401f0 15-Jan-2009 Andy Whitcroft <apw@canonical.com> checkpatch: allow parentheses on return handle array values

When we allow return to have surrounding parentheses when containing
comparison operators we are not correctly handling the case where the
values contain array sufffixes. Squash them.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
f9a0b3d17a01fe1ba24ce1e9c18666a52052e011 15-Jan-2009 Andy Whitcroft <apw@canonical.com> checkpatch: type/cast spacing should not check prefix spacing

We should not be complaining about the prefix spacing for types and casts.
We are triggering here because the check for spacing between '*'s is
overly loose. Tighten this up.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
a27506459c5e6ccc8437fca0adb6d3759c883c28 15-Jan-2009 Andy Whitcroft <apw@canonical.com> checkpatch: handle missing #if open in context

If the #if opening statement is not in the context then the context stack
can be empty. Handle this by ensuring there is always a blank entry in
the stack.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Tested-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
57b9c6d9c5074a06fda770a7f009d655593e0e29 06-Jan-2009 Andy Whitcroft <apw@canonical.com> checkpatch: version: 0.26

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
21caa13c02d67f755fad50370996c489c34a9b15 06-Jan-2009 Andy Whitcroft <apw@canonical.com> checkpatch: fix the perlcritic errors

Clean up checkpatch using perlcritic.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2b6db5cb65cb1276a7aa363a6e7335b0a8a68393 06-Jan-2009 Andy Whitcroft <apw@canonical.com> checkpatch: struct file_operations should normally be const

In the general use case struct file_operations should be a const object.
Check for and warn where it is not. As suggested by Steven and Ingo.

Acked-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
b53c8e104ed071c47ada2adce194625ab03d9f3d 06-Jan-2009 Andy Whitcroft <apw@canonical.com> checkpatch: ensure we actually detect if assignments split across lines

When checking for assignments within if conditionals we check the whole of
the condition, but the match is performed using a line constrained regular
expression. This means we can miss split conditionals or those on the
second line. Allow the check to span lines.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2d1bafd799ee0442979e6ce4145d58b69d3cade2 06-Jan-2009 Andy Whitcroft <apw@canonical.com> checkpatch: do not report nr_static as a static declaration

Ensure we do not report identifiers containing the word static as static
declarations. For example this should not be reported as an unecessary
assignement of 0:

long nr_static = 0;

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
4635f4fbaf51555509c747eed02a7e7a580ae1e1 06-Jan-2009 Andy Whitcroft <apw@canonical.com> checkpatch: track #ifdef/#else/#endif when tracking blocks

When picking up a complete statement or block for analysis we cannot
simply track open/close/etc parenthesis we must take into account
preprocessor section boundaries.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
8b1b33786b06a222cf3430b1bf942a3681532104 06-Jan-2009 Andy Whitcroft <apw@canonical.com> checkpatch: fix continuation detection when handling spacing on operators

We are miscategorising a continuation fragment following an operator
which may lead to us thinking that there is a space after it when there is
not. Fix this up.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
8054576dca7e76dd1f58c525af3309cfc9c74454 06-Jan-2009 Andy Whitcroft <apw@canonical.com> checkpatch: loosen spacing on typedef function checks

Loosen spacing checks to correctly detect this valid use of a typedef:

typedef struct rcu_data *(*get_data_func)(int);

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
080ba929651a32f1840751d2b862e64c8ee1f0c6 06-Jan-2009 Mike Frysinger <vapier@gentoo.org> checkpatch: try to catch missing VMLINUX_SYMBOL() in vmlinux.lds.h

Seems like every other release we have someone who updates vmlinux.lds.h
and adds C-visible symbols without VMLINUX_SYMBOL() around them. So start
checking the file and reject assignments which have plain symbols on
either side.

[apw@canonical.com: soften the check, add tests]
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
86f9d059c6bc548f6337f01117897a4c823cb4ee 06-Jan-2009 Andy Whitcroft <apw@canonical.com> checkpatch: allow parentheses on return for comparisons

It seems to be a common idiom to include braces on conditionals in all
contexts including return. Allow this exception to the return is not a
function checks. Reported by Kay Sievers.

Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1e85572697b348b1a126520349a29654f2ae6a12 06-Jan-2009 Wolfram Sang <w.sang@pengutronix.de> checkpatch: Add warning for p0-patches

Some people work internally with -p0-patches which has the danger that one
forgets to convert them to -p1 before mainlining. Bitten myself and seen
p0-patches in mailing lists occasionally, this patch adds a warning to
checkpatch.pl in case a patch is -p0. If you really want, you can fool
this check to generate false positives, this is why it just spits a
warning. Making the check 100% proof is trickier than it looks, so let's
start with a version which catches the cases of real use.

[apw@canonical.com: update message language, handle null prefix, add tests]
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2a5a2c25224e26c5ee491af0dc5d39e4a16f619c 06-Jan-2009 Andy Whitcroft <apw@canonical.com> checkpatch: update copyrights

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
50a7dcfb5062a5d9a0dcb28943a1e0cd5f0f60c2 06-Jan-2009 Andy Whitcroft <apw@shadowen.org> checkpatch: version: 0.25

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
65863862ba112bf4d06d5ebc142b9d746d1ee955 06-Jan-2009 Andy Whitcroft <apw@shadowen.org> checkpatch: dissallow spaces between stars in pointer types

Disallow spaces within multiple pointer stars (*) in both casts and
definitions. Both of these would now be reported:

(char * *)
char * *foo;

Also now consistently detects and reports the attributes within these
structures making the error report itself clearer.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fae17daed7312bae708df0cce7e93971308698b5 06-Jan-2009 Andy Whitcroft <apw@shadowen.org> checkpatch: comment ends inside strings is most likely not an open comment

When we are detecting whether a comment is open when we start a hunk we
check for the first comment edge in the hunk and assume its inverse.
However if the hunk contains something like below, then we will assume
that a comment was open. Update this heuristic to see if the comment edge
is obviously within double quotes and ignore it if so:

foo(" */);

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
8e761b04a34288a3b0b29c0f49cdf157d7db8863 06-Jan-2009 Andy Whitcroft <apw@shadowen.org> checkpatch: detect multiple bitfield declarations

Detect the colons (:) which make up secondary bitfield declarations and
apply binary colon checks. For example the following is common idiom:

int foo:1,
bar:1;

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
5fe3af119bed58d240e2097fe76f322ab51902d7 06-Jan-2009 Andy Whitcroft <apw@shadowen.org> checkpatch: __weak is an official attribute

Add __weak as an official attribute. This tends to be used in a location
where the automated attribute detector misses it.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
383099fd636deacf698b91b4c96d0d6d01e6dc79 06-Jan-2009 Andy Whitcroft <apw@shadowen.org> checkpatch: structure member assignments are not complex

Ensure we do not trigger the complex macros checks on structure member
assignment, for example:

#define foo .bar = 10

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
83242e0c239aaa33e757584605f788ac1eca2f0f 06-Jan-2009 Andy Whitcroft <apw@shadowen.org> checkpatch: widen implied comment detection to allow multiple stars

Some people use double star '**' as a comment continuation, and start
comments with complete lines of stars. Widen the implied comment
detection to pick these up.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
721c1cb60e0546d2e71b9aa50426c94e69c6521a 06-Jan-2009 Andy Whitcroft <apw@shadowen.org> checkpatch: comment detection may miss an implied comment on the last hunk

When detecting implied comments from leading stars we may incorrectly
think we have detected an edge one way or the other when we have not if we
drop off the end of the last hunk. Fix this up.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
691d77b6b85c20e4166bafd12bd0131b28f95a16 06-Jan-2009 Andy Whitcroft <apw@shadowen.org> checkpatch: add checks for in_atomic()

in_atomic() is not for driver use so report any such use as an ERROR.
Also in_atomic() is often used to determine if we may sleep, but it is not
reliable in this use model therefore strongly discourage its use.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
f4432c5caec5fa95ea7eefd00f8e6cee17e2e023 20-Oct-2008 Dave Jones <davej@redhat.com> Update email addresses.

Update assorted email addresses and related info to point
to a single current, valid address.

additionally
- trivial CREDITS entry updates. (Not that this file means much any more)
- remove arjans dead redhat.com address from powernow driver

Signed-off-by: Dave Jones <davej@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
6e144ee546b4bb4902524e639dc9c2cd4f7f97a4 16-Oct-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: version: 0.24

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
3fef12d6cb832327a981b03326f8f07abebb51b7 16-Oct-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: allow for comments either side of a brace on case

When specifying case we may have comments and/or braces at the end without
actually having a 'statement'. Allow for these to occur in any order.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
740504c61f79a932564fb7117d79ad53d950b201 16-Oct-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: suspect indent handle macro continuation

When ignoring a macro in the middle of a conditional, we need to ignore
the macro start and any continuation lines.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
bb44ad39c886401e1ffe0876565f8b3fcea64e9d 16-Oct-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: trailing statements ensure we report the end of the line

When reporting some complex trailing statements we report only the
starting line of the error, that tends to imply the shown line is in error
and confuse the reader. As we do know where the actual error is report
that line too with an appropriate gap marker where applicable.

#ERROR: trailing statements should be on next line
#1: FILE: Z202.c:1:
+ for (pbh = page_buffers(bh->b_page); pbh != bh;
+ pbh = pbh->b_this_page, key++);
#ERROR: trailing statements should be on next line
#4: FILE: Z202.c:4:
+ for (pbh = page_buffers(bh->b_page);
[...]
+ pbh = pbh->b_this_page, key++);

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
480120586464e5a8cd2289a90ffbb5c042e66ba0 16-Oct-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: DEFINE_ macros are real definitions for exports

When we want to confirm an export is directly after its definition we need
to allow for DEFINE_ style macros. Add these to the execeptions.
Refactor the exceptions.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
bf30d6ede099c2a31b13bbd05b1022dc0da684d5 16-Oct-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: complex macros checks miss square brackets

We are missing 'simple' values which include square brackets. Refactor to
ensure we handle nesting correctly and detect these simple forms.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
f16fa28f7b3d95e989fc64c8480e44c1bcf4bac3 16-Oct-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: suspect code indent must stop at #else/#elif

When we hit and #else or #elif we know we are meeting an alternative piece
of code. All bets are off on indent if we did not see the open of the
control so stop checking.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
8ed22cad9ce16e3d8915ae75544a133c3050d96f 16-Oct-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: pull out known acceptable typedefs

Within the type checker we have a number of common kernel types which must
be implemented as typedefs. Pull those out so that we can use the same
expressions to trigger exclusions.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
afbe8d283b97b2317dab900fb11d2a8878ee3c23 16-Oct-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: accept any sized le/be type

We are likely going to have 24 bit types. Expand the type matcher to
match any size.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
b132e5d5865325a9aa42b122c4c466903bf48348 16-Oct-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: macros which define structure members are not complex

We often see macros which define structure members, these are not complex
and necessarily do not have braces or brackets. For example:

#define _PLIST_HEAD_INIT(head) \
.prio_list = LIST_HEAD_INIT((head).prio_list), \
.node_list = LIST_HEAD_INIT((head).node_list)

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
170d3a22688f06fda42e353bbccd0f3df89f3d94 16-Oct-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: handle do without braces if we have enough context

If we have sufficient context detect and handle do without braces ({).
Else these incorrectly trigger a trailing statements error for the
associated while.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
a6a84062821738426ed4f58f4d584ecb7feb3dee 16-Oct-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: labels are not possible types

A label is not a candidate for a possible type. Exclude them.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
0776e594606e32a045e0a99bb919b2280b945495 16-Oct-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: do is not a possible type

A do without braces '{' may trigger a false possible type 'do' and then
this may be interpreted as an external definition of foo():

do
foo();
while (bar);

Add do to the type exclusions. Fix up tests so we can check for them.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
5fdd23acf9cd7f658746b119436ed1d787326c46 16-Oct-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: version: 0.23

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
306708547b566ef6a0ccd470c84568807571885c 16-Oct-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: ensure we only apply checks to the lines within hunks

We should only apply source checks to lines within hunks. Checks which
are anchored in the context may falsly trigger in the commentory. Ensure
they only match within valid hunk lines.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
6f779c18ca74358b6ac8eb8f5d502843fa92be4e 16-Oct-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: suspect indent count condition lines correctly

Correct calculation of the number of lines of condition where we have
suspect indent.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
5368df20fb364e394da3ab88d3d60ee3c0a9e5ba 16-Oct-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: check line endings in text format files

Firmware may be included in the kernel as .ihex files. These are
inherantly text, but not source. The line ending checks are applicable to
these kinds of file, allow just these checks to apply to all files.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
81bc0e020232a1e1e7010376382bb59ca82927ac 16-Oct-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: handle comment/quote nesting correctly

Ensure that a close comment cannot incorrectly trigger in the middle of a
string. Reported by Jaswinder Singh.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Cc: Jaswinder Singh <jaswinder@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
dea33496ddc2bf1a50e9def87b4ef14709d8cb6d 16-Oct-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: suppress errors triggered by short patch

When the last hunk of a patch is short it will trigger errors from
checkpatch:

Use of uninitialized value in pattern match (m//)
at /usr/local/bin/checkpatch.pl line 394.
Use of uninitialized value in concatenation (.) or string
at /usr/local/bin/checkpatch.pl line 397.
Use of uninitialized value in pattern match (m//)

Avoid touching beyond the last line. Reported by Julien Brunel.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Cc: Julien Brunel <brunel@diku.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
a1080bf80862c571b5f0a20cb601e24dd90e2026 16-Oct-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: case/default checks should only check changed lines

We should only be checking changes lines for the trailing statement check
on case/default statements.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
dea79cd3dfb4a50e4c3d0dcb7294f6d633b455d1 16-Oct-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: version: 0.22

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
b9ea10d691ecb616ce9e4d7a51400dfd93f52b2d 16-Oct-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: perform indent checks on perl

So that we eat our own dog food ensure the indent checks apply to perl
too.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
f055663c5853aa1d9f4c86351a4637462a0b9041 16-Oct-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: report the correct lines for single statement blocks

Report the correct lines for single statement blocks. Currently we are
reporting the right number of lines, but not skipping the negative lines.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2a1bc5d5c5096f2dfb6f8b18f39ecb718f101535 16-Oct-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: %Lx tests should hand %% as a literal

Ensure that we handle literal %'s correctly when adjacent to a %Lx.

%Lx bad
%%Lx good
%%%Lx bad

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9bd49efe4e4bf88d9c1026db50325fd1b2e59519 16-Oct-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: suspect indent -- skip over preprocessor, label and blank lines

We should skip over and check the lines which follow preprocessor
statements, labels, and blank lines. These all have legitimate reasons to
be indented differently.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
4d001e4d88a57ba8347b43e3a20412cd6b67fbd7 16-Oct-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: report the real first line of all suspect indents

We are currently only reporting syspect indents if the conditional is
modified but the indent missmatch could be generated by the body changing,
make sure we catch both. Also only report the first line of the body, and
more importantly make sure we report the raw copy of the line. Finally
report the indent levels to make it easier to understand what is wrong.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
6ecd967444223cea4a02d55fdc0f0510baa69523 16-Oct-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: report any absolute references to kernel source files

Absolute references to kernel source files are generally only useful
locally to the originator of the patch. Check for any such references and
report them.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
e09dec4831bbb319987215ea0a280b2a620021b7 16-Oct-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: reduce warnings for #include of asm/foo.h to check from arch/bar.c

It is much more likely that an architecture file will want to directly
include asm header files. Reduce this WARNING to a CHECK when the
referencing file is in the arch directory.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
c1ab33269a84d6056d2ffc728d8bbaa26377d3e3 16-Oct-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: include/asm checks should be anchored

It is possible to have other include/asm paths within the tree which are
not subject to the do not edit checks. Ignore those.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
01fa91471e9559d72c0c93ea7cca6f9fe6c2d1c3 16-Oct-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: fix up comment checks search to scan the entire block

We are not counting the lines in the block correctly which causes the
comment scan to stop prematurly and thus miss comments which end at the
end of the block. Fix this up.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
636d140a80912693be466e8d978e658189972989 16-Oct-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: complex macros -- fix up extension handling

Only pull in new extension lines where the current contents ends with a \.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
24e1d81acd447c3a7ec9eb90f24c00edc5a4b09f 16-Oct-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: ____cacheline_aligned et al are modifiers

Add the cacheline alignment modifiers to the attribute lists.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
a1ef277e2c88c80cfa00580469133e2215442c8d 16-Oct-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: add tests for the attribute matcher

Add support for direct testing of the attribute matcher, add basic tests
for it.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1bdab9e5881fde3bf66528db5b91477ce4b35b3b 16-Oct-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: switch indent allow plain return

It is a common and sane idiom to allow a single return on the end of a
case statement:

switch (...) {
case foo: return bar;
}

Add an exception for this.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14b111c158116f02c1c862397075e28ac12d65d6 16-Oct-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: conditional indent -- labels have different indent rules

Labels have different indent rules and must be ignored when checking the
conditional indent levels. Also correct identify labels in single
statement conditionals.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
0d413866c7df63794790518e3fd5890969c206ad 16-Oct-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: values: double ampersand may be unary

It is possible to use double ampersand (&&) in unary context where it
means the address of a goto label. Handle spacing for it.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fe2a7dbc85f37c721133c83c856f845c4ce9b602 16-Oct-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: square brackets -- exemption for array slices in braces

It is wholy reasonable to have square brackets representing array slices
in braces on the same line. These should be spaced.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
33cba0657393a75e18e1781e3e13613303f18124 24-Jul-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: version 0.21

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
234fff6515a11cf3e67c793146689da426787fea 24-Jul-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: types cannot start mid word for pointer tests

When checking spacing for pointer checks the type cannot start in the
middle of a word, ie. this is not 'int * bar':

x = fooint * bar;

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
292f1a9b342d763f94ea3915726a48905be4acd1 24-Jul-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: complex macros need to ignore comments

Ensure we ignore comments in complex macro detection else we incorrectly
report this:

#define PFM_GROUP_PERM_ANY -1 /* any user/group */

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
74048ed811152a995a88945ba9e0dded34adfff4 24-Jul-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: variants -- move the main unary/binary operators to use variants

Now that we have a variants system, move to using that to carry the
unary/binary designation for +, -, &, and *.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1f65f947a6a875e1fe7867dc08e981c4101d435d 24-Jul-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: add checks for question mark and colon spacing

Add checks for the question mark colon operator spacing, and also check
the other uses of colon. Colon means a number of things:

- it introduces the else part of the ?: operator,
- it terminates a goto label,
- it terminates the case value,
- it separates the identifier from the bit size on bit fields, and
- it is used to introduce option types in asm().

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
d2506586586c59f5db0e2ce00d5d31ccec6260b8 24-Jul-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: possible modifiers -- handle multiple modifiers and trailing

Add support for multiple modifiers such as:

int __one __two foo;

Also handle trailing known modifiers when defecting modifiers:

int __one foo __read_mostly;

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
0221f55c142b0ac8baf6f0b6c4e1ec89f0c98e96 24-Jul-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: possible types -- known modifiers cannot be types

Ensure we do not inadvertantly load known modifiers up as possible types.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
8ea3eb9a20f39d5afa52900a34092b4b5f6b55cb 24-Jul-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: handle return types of pointers to functions

Make sure we correctly mark the return type of the pointer to a function
declaration.

const void *(*sb_tag)(struct sysfs_tag_info *info);

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
b8f96a31f38c8e9fc75f0a89c6815e7cbc402858 24-Jul-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: macro complexity checks are meaningless in linker scripts

Exclude vmlinux.lds.h from the macro complexity checks. They will never
apply sanely here.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
d2172eb5bd4b7d06577113ec40635083619ca54a 24-Jul-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: possible modifiers are not being correctly matched

Although we are finding the added modifier in the declaration below
we are not correctly matching it as a type. Fix the declaration.

static void __ref *vmem_alloc_pages(unsigned int order)
{
}

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
7429c6903e3628fc2cfea65ec7e13bac030c7bfe 24-Jul-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: improve type matcher debug

Improve type matcher debug so we can see what it does match. As part
of this move us to to using the common debug framework.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
389a2fe57ffc59a649bea39db4d7e6d2eff2b562 24-Jul-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: allow for type modifiers on multiple declarations

Allow for type modifiers mid declaration on multiple declarations:

struct mxser_mstatus ms, __user *msu = argp;

Reported by Jiri Slaby.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
3c232147a7d5b0418b0a0bae0e5b9a62fb81f4f2 24-Jul-2008 Wolfram Sang <w.sang@pengutronix.de> checkpatch: correct spelling in kfree checks

Correct spelling in the kfree reports.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
4c432a8f0134504814aa8dcce6cc57c89d175604 24-Jul-2008 Greg Kroah-Hartman <gregkh@suse.de> checkpatch: usb_free_urb() can take NULL

usb_free_urb() can take a NULL, so let's check and warn about that.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
f5fe35dd95549b1b419cdeb2ec3fe61fda94fa93 24-Jul-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: condition/loop indent checks

Check to see if the block/statement which a condition or loop introduces
is indented correctly.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
53210168feeff9a3c780bd42f69936d4c12381d5 24-Jul-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: toughen trailing if statement checks and extend them to while and for

Extend the trailing statement checks to report a trailing semi-colon ';'
as we really want it on the next line and indented so it is really really
obvious. Also extend the tests to include while and for.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
8d31cfcecf67563d70cd68616cb8fb4384f24b51 24-Jul-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: check spacing for square brackets

Check on the spacing before square brackets. We should only allow spaces
there if this is part of a type definition or an initialialiser.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
e2a763c20b89890d2153551b1af6962b135de4c0 24-Jul-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: switch -- report trailing statements on case and default

Report trailing statements on case and default lines.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
f4c014c0dede10cc0a8463e748892e738e190699 24-Jul-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: allow printk strings to exceed 80 characters to maintain their searchability

Allow printk strings to break the 80 character width limits, thus keeping
them complete and searchable.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
548596d523d83dff5a670beb84be0daf4c3bcd16 24-Jul-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: trailing statement indent: fix end of statement location

Fix end of statement location. Where the last line of the statement is
replaced we are miss reporting the newly added replacement an incorrectly
indented trailing statement for the negative context. We are also
incorrectly reporting negative statements generally.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
a3bb97a7aba36055d476896ed6393ab35a119d5b 24-Jul-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: macros: fix statement counting block end detection

We are incorrectly counting the lines in a block while accumulating
the trailing lines in a macro statement, leading to false positives.
Fix end of block handling and general counting for negative context lines.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
6ef9b297f6e8850da3be9c9ff5f00385c0977004 24-Jul-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: types: unary -- goto introduces unary context

When we see a goto we enter unary context. For example:

goto *h;

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
beae6332493a40116dba24928154621f2e88b9a9 24-Jul-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: comment detection: ignore macro continuation when detecting associated comments

When looking for an associated comment they may be suffixed by a macro
continuation. Ignore this.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
d3ddcf471ea90d7ff711dbaa371ef379ed625ec0 24-Jul-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: possible types: __asm__ is never a type

We are false matching __asm__ as a type, and then tripping the external
function checks. Squash.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
f3db6639fee577f6ed92c0a1fc881e748c47ec48 24-Jul-2008 Michael Ellerman <michael@ellerman.id.au> checkpatch: add a checkpatch warning for new uses of __initcall().

[apw@shadowen.org: generalise pattern and add tests]
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
c8cb2ca37ed51aa1f3b20e3eff1e72df1c400f70 24-Jul-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: types: some types may also be identifiers

Some types such as typedefs may overlap real identifiers. Be more
targetted about when a type can really exist. Where it cannot let it be
an identifier. This prevents false reporting of the minus '-' in unary
context in the following:

foo[bar->bool - 1];

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fee61c47d15270bdea699a8a3dd867f0825c3541 24-Jul-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: return is not a function -- parentheses for casts are ok too

Casts require parentheses so it is possible to have something like this:

return (int)(*a);

This miss trips the complexity function. Ensure that the two separate
parenthesised sections are not coelesced.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
6cbb2e711128b505209f7c910018aac77335c887 24-Jul-2008 Andy Whitcroft <apw@shadowen.org> checkpatch: Version: 0.20

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
c45dcabd2626c56f8c1235df9db065f584f3ac82 06-Jun-2008 Andy Whitcroft <apw@shadowen.org> update checkpatch.pl to version 0.19

This version is a bit of a whopper. This version brings a few new checks,
improvements to a number of checks mostly through modifications to the
way types are parsed, several fixes to quote/comment handling, as well as
the usual slew of fixes for false positives.

Of note:
- return is not a function and is now reported,
- preprocessor directive detection is loosened to match C99 standard,
- we now intuit new type modifiers, and
- comment handling is much improved

Andy Whitcroft (18):
Version: 0.19
fix up a couple of missing newlines in reports
colon to parenthesis spacing varies on asm
values: #include is a preprocessor statement
quotes: fix single character quotes at line end
add typedef exception for the non-pointer "function types"
kerneldoc parameters must be on one line, relax line length
types: word boundary is not always required
improved #define bracketing reports
uninitialized_var is an annotation not a function name
possible types: add possible modifier handling
possible types: fastcall is a type modifier
types: unsigned is not a modifier on all types
static/external initialisation to zero should allow modifiers
checkpatch: fix recognition of preprocessor directives -- part 2
comments: fix inter-hunk comment tracking
return is not a function
do not report include/asm/foo.h use in include/linux/foo.h
return is not a function -- tighten test

[jengelh@computergmbh.de: fix recognition of preprocessor directives]
Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Cc: Jan Engelhardt <jengelh@computergmbh.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9c9ba34ee3dbc34e829f42e42a5e5273b1183500 29-Apr-2008 Andy Whitcroft <apw@shadowen.org> update checkpatch.pl to version 0.18

This version brings a few fixes for the extern checks, and a couple of
new checks.

Of note:
- false is now recognised as a 0 assignment in static/external
assignments,
- printf format strings including %L are reported,
- a number of fixes for the extern in .c file detector which had
temporarily lost its ability to detect variables; undetected due to
the loss of its test.

Andy Whitcroft (8):
Version: 0.18
false should trip 0 assignment checks
tests: reinstate missing tests
tests: allow specification of the file extension for a test
fix extern checks for variables
check for and report %Lu, %Ld, and %Li
ensure we only start a statement on lines with some content
extern spacing

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
171ae1a491e216ef728436f9cc958e05cccf5a27 29-Apr-2008 Andy Whitcroft <apw@shadowen.org> update checkpatch.pl to version 0.17

This version brings improvements to external declaration detection, fixes to
quote tracking, fixes to unary tracking, some clarification of wording, and
the usual slew of fixes for false positives.

Of note:
- much better unary tracking across preprocessor directives
- UTF8 checks highlight the character at fault
- widening of mutex detection

Andy Whitcroft (17):
Version: 0.17
values: __attribute__ carries through the previous type
quotes: should only follow "positive" lines
clarify the indent tabs over spaces wording
loosen NR_CPUS check for array range initialisers
detect external function declarations without an extern prefix
function declaration arguments should be with the identifier
DEFINE_MUTEX should report in line with struct mutex
NR_CPUS is valid in preprocessor statements
comment detection should not start on the @@ line
types: add support for #undef
tighten mutex/completion reports to usage
allow export of function pointers
values: preprocessor #define is out of line maintain values
values: #define does not always have parentheses
unary '*' may be const
utf8 checks should report location of the invalid character

Wolfram Sang (1):
make checkpatch.pl really skip <asm/irq.h>

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
c2010a3b9e5e98efb7f70d4d73ce4f15508ffa7b 14-Apr-2008 Greg Kroah-Hartman <gregkh@suse.de> checkpatch: usb_free_urb() can take NULL

usb_free_urb() can take a NULL, so let's check and warn about that.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
773647a09add08a6e8165843a338220a6f833705 28-Mar-2008 Andy Whitcroft <apw@shadowen.org> update checkpatch.pl to version 0.16

This version brings proper quote tracking across lines, and brings the
handling of comments into the same mechanism ensuring nesting is correctly
handled. It brings the usual flurry of fixes for false positives. It also
brings a number of new checks. The most contentious change will likely be
the checks for NR_CPUS as this throws some new warnings in kernel/sched.c.

Of note:
- all new quote tracking across lines
- all new comment tracking
- new more direct, less ambigious wording for some warnings
- recommends mutexes and completions over semaphores
- recommends strict_strto* over simple_strto*
- report on direct use of NR_CPUS

Andy Whitcroft (22):
Version: 0.16
string quote tracking should cross line boundaries
check spacing round -> correctly across newlines
checks for linux/ against asm/ include files should be warnings
standardise on 'required' and 'prohibited'
take the first end of condition when parsing statements
values: cope with unbalanced brackets
preprocessor #elif is not a function
preprocessor #if should not trigger trailing statement checks
test: allow us to limit output to a single error
recommend real mutexes over semaphores
asm checks should mirror those for __asm__
warn on semaphores being used in place of completions
trailing ; on control structure should ignore do {} while ();
recommend strict_strtoX over simple_strtoX
redo comment handling as a quote type
use of NR_CPUS is normally wrong
consistant spacing should only be about spaces
if brace check suppression should only apply to the top-levels
use tr/// to align spacing for operators
move to using four parameter form of substr
check and report modifications to include/asm

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
cf655043d4ba6fb3e352d6295a6ad5c2361755c4 04-Mar-2008 Andy Whitcroft <apw@shadowen.org> update checkpatch.pl to version 0.15

This version brings a number of minor fixes updating the type detector and
the unary tracker. It also brings a few small fixes for false positives.
It also reverts the --file warning. Of note:

- limit CVS checks to added lines
- improved type detections
- fixes to the unary tracker

Andy Whitcroft (13):
Version: 0.15
EXPORT_SYMBOL checks need to accept array variables
export checks must match DECLARE_foo and LIST_HEAD
possible types: cleanup debugging missing line
values: track values through preprocessor conditional paths
typeof is actually a type
possible types: detect definitions which cross lines
values: include line numbers on value debug information
values: ensure we find correctly record pending brackets
values: simplify the brace history stack
CVS keyword checks should only apply to added lines
loosen spacing for comments
allow braces for single statement blocks with multiline conditionals

Harvey Harrison (1):
checkpatch: remove fastcall

Ingo Molnar (1):
checkpatch.pl: revert wrong --file message

Uwe Kleine-Koenig (1):
fix typo "goot" -> "good"

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Cc: Randy Dunlap <rdunlap@xenotime.net>
Cc: Joel Schopp <jschopp@austin.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13214adf738abc92b0a00c0763fd3be79eebaa7c 08-Feb-2008 Andy Whitcroft <apw@shadowen.org> update checkpatch.pl to version 0.14

This version brings the remainder of the queued fixes. A number of fixes
for items missed reported by Andrew Morton and others. Also a handful
of new checks and fixes for false positives. Of note:

- new warning associated with --file to try and avoid cleanup only patches,
- corrected handling of completly empty files,
- corrected report handling with multiple files,
- handling of possible types in the face of multiple declarations,
- detection of unnessary braces on complex if statements (where present), and
- all new comment spacing handling.

Andi Kleen (1):
Introduce a warning when --file mode is used

Andy Whitcroft (14):
Version: 0.14
clean up some space violations in checkpatch.pl
a completly empty file should not provoke a whinge
reset report lines buffers between files
unary ++/-- may abutt close braces
__typeof__ is also unary
comments: revamp comment handling
add --summary-file option adding filename to summary line
trailing backslashes are not trailing statements
handle operators passed as parameters such as to ASSERTCMP
possible types -- enhance debugging
check for boolean operations with constants
possible types: handle multiple declarations
detect and report if statements where all branches are single statements

Arjan van de Ven (1):
quiet option should not print the summary on no errors

Bartlomiej Zolnierkiewicz (1):
warn about using __FUNCTION__

Timur Tabi (1):
loosen spacing checks for __asm__

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
c2fdda0dfbe85ad5d68d4799ff7c5af89db8ac19 08-Feb-2008 Andy Whitcroft <apw@shadowen.org> update checkpatch.pl to version 0.13

This version brings a large number of fixes which have built up over
the Christmas period. Mostly these are fixes for false positives, both
through improvments to unary checks and possible type detection. It
also brings new checks for while location and CVS keywords. Of note:

- a number of fixes to unary detection
- detection of a number of new forms of types to improve type matching
- better inline handling
- recognision of '%' as an operator

Andy Whitcroft (28):
Version: 0.13
unary detection: maintain bracket state across lines
move to pre-sanitising the entire file
the text of a #error statement should be treated like it is in quotes
line sanitisation needs to target double backslash correctly
tighten comment guestimation for lines starting ' * '
debug: add a debug framework
prevent unclosed single quotes from spreading
add % as an operator
the text of a #warning statement should be treated like it is in quotes
possible matching applies in typedefs
single statement block checks must not trigger when two or more statements
possible types: local variables may also be const
treat inline as a type attribute to even when out of place
possible types: sparse annotations are valid indicators
possible types: beef up the possible type testing
check for hanging while statements on the wrong line
utf8 checks need to occur against the raw lines
function brace checks should use any whitespece matches
comments should take up space in the line when sanitised
remove debugging from if assignment checks
possible types -- ensure we detect all pointer casts
fix tests for function spacing in the presence of #define
clean up the UTF-8 error message to be clearer
test-lib: invert the status report, output success counts
detect and report CVS keywords
tests: break out tests
Add $Id$ to the CVS keyword checks

Benny Halevy (1):
checkpatch.pl: recognize the #elif preprocessor directive

Geert Uytterhoeven (1):
print the filenames of patches where available

Mauro Carvalho Chehab (1):
Fix missing \n in checkpatch.pl

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
8905a67c63ff3facadad10aa53a8bb159f3ace7b 29-Nov-2007 Andy Whitcroft <apw@shadowen.org> update checkpatch.pl to version 0.12

This version brings a new terse output mode as well as many improvements to
the unary detection and bare type regcognition. It also brings the usual
updates for false positives, though these seem to be slowing markedly
now that the unary detector is no longer just putting its finger in the
air and guessing. Of note:

- new --terse mode producing a single line per report
- loosening of the block brace checks
- new checks for enum/union/struch brace placements
- hugely expanded "bare type" detection
- checks for inline usage
- better handling of already open comment blocks
- handle patches which introduce or remove lines without newlines

Andy Whitcroft (19):
Version: 0.12
style fixes as spotted by checkpatch
add a --terse options of a single line of output per report
block brace checks should only apply for single line blocks
all new bare type detector
check spacing for open braces with enum, union and struct
check for LINUX_VERSION_CODE
macros definition bracketing checks need to ignore -ve context
clean up the mail-back mode, -q et al
expand possible type matching to declarations
allow const and sparse annotations on possible types
handle possible types as regular types everywhere
prefer plain inline over __inline__ and __inline
all new open comment detection
fix up conditional extraction for if assignment checks
add const to the possible type matcher
unary checks: a for loop is a conditional too
possible types: detect function pointer definitions
handle missind newlines at end of file, report addition

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
6c72ffaab9851e3ee380c77169c0cfcba6b58d4c 18-Oct-2007 Andy Whitcroft <apw@shadowen.org> update checkpatch.pl to version 0.11

This version brings a more cautious checkpatch.pl by default. The more
subjective checks are only applied with the --strict option. It also
brings the usual slew of corrections for false positives. Of note:

- new tree detection, the source tree will be found via the executable
- a major revamp of the unary detection to make it more parser like
- a new summary at the bottom of the report
- --strict option for subjective checks
- --file to enable checking on complete files
- support for use in emacs "compile" window

Andy Whitcroft (27):
Version: 0.11
fix up cat_vet for the case where there are no control characters
any cast to a pointer introduces a type
cpp unary operator detection needs to float
attributes are also valid in type definitions
sizeof may be a bareword and makes its argument unary
unary checks for #ifdef et al need to find end of line
add new --file mode to handle raw source files
add --strict/--subjective which enables the subjective tests
add some additional standard type suffixes
cpp #elif is also a unary prefix
case is not a function name
widen asm volatile exceptions
__kprobes is a type attribute
typeof is a unary operator
function open parenthesis checks should check all occurances
expand sizeof() binary exceptions
linux/irq.h should not be recommended
work harder to find the kernel root and add --root=
fix --emacs mode line numbers and string concatenation warnings
add a summary to the bottom of the main report
loosen assignment in if checks
update operator spacing to maintain tabs in output
revamp unary detection
corruption/line wrapped patches need only reporting once
revamp s/u/be/le 8/16/32/64 bit types
handle missing ,1 in uni-diff header

Mike D. Day (2):
Adds support to checkpatch.pl for running in the emacs compile window.
checkpatch: Fix line number reporting

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9c0ca6f9a0a0820da25b64259ea475751f1dd306 17-Oct-2007 Andy Whitcroft <apw@shadowen.org> update checkpatch.pl to version 0.10

This version brings a number of new checks, and a number of bug
fixes. Of note:

- better categorisation and space checks for dual use unary/binary
operators
- warn on deprecated use of {SPIN,RW}_LOCK_UNLOCKED
- check if/for/while with trailing ';' for hanging statements
- detect DOS line endings
- detect redundant casts for kalloc()

Andy Whitcroft (18):
Version: 0.10
asmlinkage is also a storage type
pull out inline specifiers
allow only some operators before a unary operator
parenthesised values may span line ends
add additional attribute matching
handle sparse annotations within pointer type space checks
support alternative function definition syntax for typedefs
check if/for/while with trailing ';' for hanging statements
fix output format for case checks
deprecate SPIN_LOCK_UNLOCKED and RW_LOCK_UNLOCKED
allow complex macros with bracketing braces
detect and report DOS line endings
fastcall is a valid function attribute
bracket spacing is ok for 'for'
categorise operators into unary/binary/definitions
add heuristic to pick up on unannotated types
remove spurious warnings from cat_vet

Dave Jones (1):
Make checkpatch warn about pointless casting of kalloc returns.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
22f2a2ef9b468569cb34a7a056e54d56fdac0b9d 10-Aug-2007 Andy Whitcroft <apw@shadowen.org> update checkpatch.pl to version 0.09

This version brings a number of new checks, and a number of bug
fixes. Of note:

- checks for spacing on round and square bracket combinations
- loosening of the single statement brace checks, to allow
them when they contain comments or where other blocks in a
compound statement have them.
- parks the multple declaration support
- allows architecture defines in architecture specific headers

Andy Whitcroft (21):
Version: 0.09
loosen single statement brace checks
fix up multiple declaration to avoid function arguments
add some function space parenthesis check exceptions
handle EXPORT_'s with parentheses in their names
clean up some warnings in multi-line macro bracketing support
park the multiple declaration checks
make block brace checks count comments as a statement
__volatile__ and __extension__ are not functions
allow architecture specific defined within architecture includes
check spacing on square brackets
check spacing on parentheses
ensure we apply checks to the part before start comment
check #ifdef conditional spacing
handle __init_refok and __must_check
add noinline to inline checks
prevent email addresses from tripping spacing checks
handle typed initialiser spacing
handle line contination as end of line
add bool to the type matcher
refine EXPORT_SYMBOL checks to handle pointers

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
f0a594c1c74fedbd838402e7372030311be8cc6e 19-Jul-2007 Andy Whitcroft <apw@shadowen.org> update checkpatch.pl to version 0.08

This version brings a number of new checks, and a number of bug
fixes. Of note:

- warnings for multiple assignments per line
- warnings for multiple declarations per line
- checks for single statement blocks with braces

This patch includes an update for feature-removal-schedule.txt to
better target checks.

Andy Whitcroft (12):
Version: 0.08
only apply printk checks where there is a string literal
allow suppression of errors for when no patch is found
warn about multiple assignments
warn on declaration of multiple variables
check for kfree() with needless null check
check for single statement braced blocks
check for aggregate initialisation on the next line
handle the => operator
check for spaces between function name and open parenthesis
move to explicit Check: entries in feature-removal-schedule.txt
handle pointer attributes

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
de7d4f0e1172a72277d660fa0be59654ea02bed0 16-Jul-2007 Andy Whitcroft <apw@shadowen.org> update checkpatch.pl to version 0.07

This version brings a number of new checks, fixes for flase
positives, plus a clarification of the output to better guide use. Of
note:

- checks for documentation for new __setup calls
- clearer reporting where braces and parenthesis are involved
- reports for closing brace and semi-colon spacing
- reports on unwanted externs

This patch includes an update to the documentation on checkpatch.pl
itself to clarify when it should be used and to indicate that it
is not intended as the final arbitor of style.

Full changelog:

Andy Whitcroft (19):
Version: 0.07
ensure we do not apply control brace checks to preprocesor directives
add {u,s}{8,16,32,64} to the type matcher
accept lack of spacing after the semicolons in for (;;)
report new externs in .c files
fix up typedef exclusion for function prototypes
else trailing statements check need to account for \ at end of line
add enums to the type matcher
add missing check descriptions
suppress double reporting of ** spacing
report on do{ spacing issues
include an example of the brace/parenthesis in output
check for spacing after closing braces
prevent double reports on pointer spacing issues
handle blank continuation lines on macros
classify all reports error, warning, or check
revamp hanging { checks and apply in context
no spaces after the last ; in a for is ok
check __setup has a corresponding addition to documentation

David Woodhouse (1):
limit character set used in patches and descriptions to UTF-8

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: "Randy.Dunlap" <rdunlap@xenotime.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
d8aaf12142d066d3982475d58a9094c85a06a5a9 24-Jun-2007 Andy Whitcroft <apw@shadowen.org> update checkpatch.pl to version 0.06

Update to checkpatch.pl v0.06. Of note:

- do { and else handled correctly as control structures for { matching
- trailing whitespace correctly tripped when line otherwise empty
- support for const, including const foo * const bar
- multiline macros defining values correctly reported

This version of checkpatch.pl can be found at the following URL:

http://www.kernel.org/pub/linux/kernel/people/apw/checkpatch/checkpatch.pl-0.06

Full Changelog:

Andy Whitcroft (14):
Version: 0.06
cleanup the Type regular expression declarations
fix up block counting
end of line counts as a space for ++ and --
do { needs the same checks as if, for et al
handle "const foo * const a" as a valid type
add spacing checks following ;
complete whitespace lines should trip trailing whitespace check
else is also a block control structure
badly formatted else can trip function declaration
detect and report trailing statements after else
types need to be terminated by a boundary
multiline macros defining values should be surrounded by parentheses
soften the wording of the Signed-off-by: warnings

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Cc: "Randy.Dunlap" <rdunlap@xenotime.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
653d4876b730fedca8473481863cf700245e3582 24-Jun-2007 Andy Whitcroft <apw@shadowen.org> update checkpatch.pl to version 0.05

This version brings a some new tests, and a host of changes to fix
false positives, of particular note:

- detect 'var ++;' and 'var --;' as a bad combination
- multistatement #defines are now checked based on statement count
- multistatement #defines with initialisation correctly reported
- checks the location of the inline keywords
- EXPORT_SYMBOL for variables are now understood
- typedefs are loosened to handle sparse etc

This version of checkpatch.pl can be found at the following URL:

http://www.shadowen.org/~apw/public/checkpatch/checkpatch.pl-0.05

Full Changelog:

Andy Whitcroft (18):
Version: 0.05
macro definition checks should be for a single statement
avoid assignements only in if conditionals
declarations of function pointers need no space
multiline macros which are purely initialisation cannot be wrapped
EXPORT_SYMBOL can also directly follow a variable definition
check on the location of the inline keyword
EXPORT_SYMBOL needs to allow for attributes
ensure we do not find C99 // in strings
handle malformed #include lines
accept the {0,} form
typedefs are sensible for defining function pointer parameters
ensure { handling correctly handles nested switch() statements
trailing whitespace checks are not anchored
typedefs for sparse bitwise annotations make sense
update the type matcher to include sparse annotations
clean up indent and spacing

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
00df344fd06fd6ac71d0665f1ce8cc6870e4f564 08-Jun-2007 Andy Whitcroft <apw@shadowen.org> update checkpatch.pl to version 0.04

This version brings a some new tests, and a host of changes to fix
false positives, of particular note:

- check for and report #if 0
- extend checking of line lengths and spacing for .pl, .sh etc
- extends the pointer type checks to multiple levels
- updates printk handling to track newlines
- adds a wrapped patch detector
- drops the leading component of the filenames
- extends switch indent handling to switch statmentes rooted in
the context
- adds foo * bar single pointer checks

This version of checkpatch.pl can be found at the following URL:

http://www.shadowen.org/~apw/public/checkpatch/checkpatch.pl-0.04

Full Changelog:

Andy Whitcroft (16):
allow checking line lengths and spacing on other source files
clean up that whitespace
sanitise the input line standardising the content of quotes
clean up pointer type * and space checks
fix up the sanitiser so it maintains the line length
apply the printk facility checks only to the first printk in a set
switch/case indent checks may anchor in the context
add a wrapped patch detector
put the #ifdef in C file checks on ice
asm volatile is acceptable
check for and report #if 0
drop the leading component of the filename as patches are -p1
use the original line when reporting operator errors
correct spelling of Joel's name
Version: 0.04
add support for struct foo * bar checks

Geert Uytterhoeven (1):
Fix checkpatch.pl name in usage template

Randy Dunlap (1):
checkpatch: produce fewer lines of output

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Cc: Randy Dunlap <rdunlap@xenotime.net>
Cc: Joel Schopp <jschopp@austin.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
389834b680c13f4727c14f70fa71c2c5678b6081 08-Jun-2007 Randy Dunlap <rdunlap@xenotime.net> checkpatch: produce fewer lines of output

Produce one less line of output per flagged incident.

Change this:

use tabs not spaces
PATCH: /home/rddunlap/arcmsr1200014.patch4:756:
FILE: b/drivers/scsi/arcmsr/arcmsr_hba.c:1843:
+ return PCI_ERS_RESULT_NEED_RESET;$

to this:

use tabs not spaces
#756: FILE: b/drivers/scsi/arcmsr/arcmsr_hba.c:1843:
+ return PCI_ERS_RESULT_NEED_RESET;$

Cc: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
4a0df2ef4569ac57cb18cd97e34c0c4733e829d9 08-Jun-2007 Andy Whitcroft <apw@shadowen.org> update checkpatch.pl to version 0.03

This version brings a host of changes to cure false positives and
bugs detected on patches submitted to lkml and -mm. It also brings
a number of new tests in response to reviews, of particular note:

- catch use of volatile
- allow deprecated functions to be listed in feature-removal-schedule.txt
- warn about #ifdef's in c files
- check that spinlock_t and struct mutex use is commented
- report on architecture specific defines being used
- report memory barriers without an associated comment

Full changelog:

catch use of volatile
convert other quoted string checks to common routine
alloc deprecated functions to be listed in feature-removal-schedule.txt
split out the line length and indent for each line
improve switch block handling
handle GNU diff context lines with no leading space
warn about #ifdef's in c files
tidy up tests for signed-off-by using raw mode
check that spinlock_t and struct mutex use is commented
syntax checks for open brace placement may drop off the bottom of hunk
report memory barriers without an associated comment
when a sign off is present but ugly do not report it missing
do not mistake bitfield definitions for indented labels
report on architecture specific defines being used
major update to the operator checks
prevent switch/if/while etc matching foo_switch
generify assignement in condition error message
introduce an operator context marker
Version: 0.03

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
8381e04b90ce9e7669a2d20aa7aaff3be910e447 07-Jun-2007 Andy Whitcroft <apw@shadowen.org> checkpatch.pl: should be executable

scripts/checkpatch.pl should be executable, make it so.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Acked-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Joel Schopp <jschopp@austin.ibm.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
0a920b5b666d0be8141bd1ce620fffa7de96b81b 01-Jun-2007 Andy Whitcroft <apw@shadowen.org> add a trivial patch style checker

We are seeing increasing levels of minor patch style violations in submissions
to the mailing lists as well as making it into the tree. These detract from
the quality of the submission and cause unnessary work for reviewers.

As a first step package up the current state of the patch style checker and
include it in the kernel tree. Add instructions suggesting running it on
submissions. This adds version v0.01 of the checkpatch.pl script.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Joel Schopp <jschopp@austin.ibm.com>
Cc: Randy Dunlap <rdunlap@xenotime.net>
Cc: Dave Jones <davej@codemonkey.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>