summaryrefslogtreecommitdiff
path: root/scripts/checkpatch.pl
AgeCommit message (Collapse)Author
2011-07-25checkpatch.pl: update $logFunctionsJoe Perches
Previous behavior allowed only alphabetic prefixes like pr_info to exceed the 80 column line length limit. ath6kl wants to add a digit into the prefix, so allow numbers as well as digits in the <prefix>_<level> printks. <prefix>_<level>_ratelimited and <prefix>_<level>_once and WARN_RATELIMIT and WARN_ONCE may now exceed 80 cols. Add missing <prefix>_printk type for completeness. Signed-off-by: Joe Perches <joe@perches.com> Cc: Andy Whitcroft <apw@canonical.com> Cc: Kalle Valo <kvalo@qca.qualcomm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-07-25checkpatch: make utf-8 test --strictJoe Perches
Some patches are sent in using ISO-8859 or even Windows codepage 1252. Make checkpatch accept these by default and only emit the "Invalid UTF-8" message when using --strict. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-07-25checkpatch.pl: add ability to ignore various messagesJoe Perches
Some users would like the ability to not emit some of the messages that checkpatch produces. This can make it easier to use checkpatch in other projects and integrate into scm hook scripts. Add command line option to "--ignore" various message types. Add option --show-types to emit the "type" of each message. Categorize all ERROR, WARN and CHK messages with types. Add optional .checkpatch.conf file to store default options. 3 paths are searched for .checkpatch.conf . customized per-tree configurations $HOME user global configuration when per-tree configs don't exist ./scripts lk defaults to override script The .conf file can contain any valid command-line argument and the contents are prepended to any additional command line arguments. Multiple lines may be used, blank lines are ignored, # is a comment. Update "false positive" output for readability. Update version to 0.32 Signed-off-by: Joe Perches <joe@perches.com> Acked-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>
2011-07-25checkpatch: add a "prefer __aligned" checkJoe Perches
Prefer the use of __aligned(size) over __attribute__((__aligned___(size))) Link: http://lkml.kernel.org/r/20110609094526.1571774c.akpm@linux-foundation.org Suggested-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-07-25checkpatch: validate signature styles and To: and Cc: linesJoe Perches
Signatures have many forms and can sometimes cause problems if not in the correct format when using git send-email or quilt. Try to verify the signature tags and email addresses to use the generally accepted "Signed-off-by: Full Name <email@domain.tld>" form. Original idea by Anish Kumar <anish198519851985@gmail.com> Signed-off-by: Joe Perches <joe@perches.com> Cc: Anish Kumar <anish198519851985@gmail.com> Cc: Nick Bowler <nbowler@elliptictech.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-07-25checkpatch: add __rcu as a sparse modifierSven Eckelmann
Fix "need consistent spacing around '*'" error after a __rcu sparse annotation which was caused by the missing __rcu entry in the checkpatch.pl internal list of sparse keywords. Signed-off-by: Sven Eckelmann <sven@narfation.org> Cc: Andy Whitcroft <apw@canonical.com> Cc: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-07-25checkpatch: suggest using min_t or max_tJoe Perches
A common issue with min() or max() is using a cast on one or both of the arguments when using min_t/max_t could be better. Add cast detection to uses of min/max and suggest an appropriate use of min_t or max_t instead. Caveat: This only works for min() or max() on a single line. It does not find min() or max() split across multiple lines. This does find: min((u32)foo, bar); But it does not find: max((unsigned long)foo, bar); Suggested-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-06-15checkpatch: add warning for uses of printk_ratelimitJoe Perches
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>
2011-05-25checkpatch: fix defect in printk(KERN_<LEVEL> 80 column exceptionsJoe Perches
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>
2011-05-25checkpatch: add <foo>_<level> and MODULE_<BAR> to 80 column exceptionsJoe Perches
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>
2011-05-25checkpatch: add check for line continuations in quoted stringsJoe Perches
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>
2011-03-31Fix common misspellingsLucas De Marchi
Fixes generated by 'codespell' and manually reviewed. Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
2011-03-22checkpatch: warn about memset with swapped argumentsDave Jones
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>
2011-03-22scripts/checkpatch.pl: reset rpt_cleaners warningsMike Frysinger
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>
2011-03-22kstrto*: converting strings to integers done (hopefully) rightAlexey Dobriyan
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>
2011-01-27locking: Remove deprecated lock initializersThomas Gleixner
Last users are gone. Remove the left overs. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2011-01-13checkpatch.pl: add "prefer __packed" checkJoe Perches
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>
2011-01-13checkpatch: check for world-writeable sysfs/debugfs filesDave Jones
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>
2011-01-13checkpatch.pl: fix CAST detectionFlorian Mickler
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>
2011-01-13scripts/checkpatch.pl: add check for multiple terminating semicolons and ↵Joe Perches
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>
2010-10-30semaphore: Remove mutex emulationThomas Gleixner
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>
2010-10-26scripts/checkpatch.pl: add check for declaration of pci_device_idJoe Perches
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>
2010-10-26scripts/checkpatch.pl: add warnings for static char that could be static ↵Joe Perches
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>
2010-10-26checkpatch: version 0.31Andy Whitcroft
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>
2010-10-26checkpatch: statement/block context analyser should look at sanitised linesAndy Whitcroft
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>
2010-10-26checkpatch: handle EXPORT_SYMBOL for DEVICE_ATTR and similarAndy Whitcroft
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>
2010-10-26checkpatch: clean up structure definition macro handlineAndy Whitcroft
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>
2010-10-26checkpatch: update copyright datesAndy Whitcroft
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>
2010-10-26checkpatch: Add additional attribute #definesJoe Perches
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>
2010-10-26checkpatch: check for incorrect permissionsRabin Vincent
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>
2010-10-26checkpatch: ensure kconfig help checks only apply when we are adding helpAndy Whitcroft
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>
2010-10-26checkpatch: simplify and consolidate "missing space after" checksAndy Whitcroft
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>
2010-10-26checkpatch: add check for space after struct, union, and enumAndy Whitcroft
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>
2010-10-26checkpatch: returning errno typically should be negativeAndy Whitcroft
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>
2010-10-26checkpatch: handle casts better fixing false categorisation of : as binaryAndy Whitcroft
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>
2010-10-26checkpatch: ensure we do not collapse bracketed sections into constantsAndy Whitcroft
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>
2010-10-26checkpatch: suggest cleanpatch and cleanfile when appropriateAndy Whitcroft
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>
2010-10-26checkpatch: types may sit on a line on their ownAndy Whitcroft
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>
2010-10-26checkpatch: fix regressions in "fix handling of leading spaces"Andy Whitcroft
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>
2010-08-09checkpatch: fix extraneous EXPORT_SYMBOL* warningsPatrick Pannuto
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>
2010-08-09checkpatch: warn about unexpectedly long msleep'sPatrick Pannuto
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>
2010-08-09checkpatch: prefer usleep_range over udelayPatrick Pannuto
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>
2010-08-09checkpatch: add more exceptions to 80 char linesJoe Perches
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>
2010-08-09checkpatch: change externals to globalsJoe Eloff
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>
2010-08-09checkpatch: fix handling of leading spacesRaffaele Recalcati
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>
2010-08-09checkpatch: refactor 'allowed asm includes' and add memory.hWolfram Sang
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>
2010-05-25checkpatch: warn on declaration with storage class not at the beginningTobias Klauser
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>
2010-05-25checkpatch: add check for too short Kconfig descriptionsAndi Kleen
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>
2010-05-21lockdep: Add novalidate class for dev->mutex conversionPeter Zijlstra
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>
2010-03-06checkpatch: warn on unnecessary spaces before quoted newlinesJoe Perches
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>