aboutsummaryrefslogtreecommitdiff
path: root/scripts/checkpatch.pl
AgeCommit message (Collapse)Author
2013-09-24checkpatch: make extern in .h prototypes quieterJoe Perches
The use of extern in .h files is a bit contentious. Make the warning be emitted only when --strict is used on the command line. Signed-off-by: Joe Perches <joe@perches.com> Cc: David Howells <dhowells@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-09-11checkpatch: add test for positional misuse of section specifiers like __initdataJoe Perches
As discussed recently on the arm [1] and lm-sensors [2] lists, it is possible to use section markers on variables in a way which gcc doesn't understand (or at least not the way the developer intended): static struct __initdata samsung_pll_clock exynos4_plls[nr_plls] = { does NOT put exynos4_plls in the .initdata section. The __initdata marker can be virtually anywhere on the line, EXCEPT right after "struct". The preferred location is before the "=" sign if there is one, or before the trailing ";" otherwise. [1] http://permalink.gmane.org/gmane.linux.ports.arm.kernel/258149 [2] http://lists.lm-sensors.org/pipermail/lm-sensors/2013-August/039836.html So, update checkpatch to find these misuses and report an error when it's immediately after struct or union, and a warning when it's otherwise not immediately before the ; or =. A similar patch was suggested by Andi Kleen https://lkml.org/lkml/2013/8/5/648 Signed-off-by: Joe Perches <joe@perches.com> Suggested-by: Jean Delvare <khali@linux-fr.org> Tested-by: Guenter Roeck <linux@roeck-us.net> Cc: Andi Kleen <andi@firstfloor.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-09-11checkpatch: fix perl version 5.12 and earlier incompatibilityJoe Perches
A previous patch ("checkpatch: add --types option to report only specific message types") uses a perl syntax introduced in perl version 5.14. Use the backward compatible perl syntax instead. Signed-off-by: Joe Perches <joe@perches.com> Reported-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-09-11checkpatch: reduce runtime/cpu time usedJoe Perches
There are some cases where checkpatch can take a long time to complete. Reduce the likelihood of this long run-time by adding a new test for lines with and without comments and eliminating checks on lines with only comments. This reduces the number of "ctx_statement_block" calls, and also the number of tests of $stat, which is now undefined for these blank lines. One test in particular, the "check for switch/default statements without a break", could take an extremely long time to parse as it tries to skip interleaving comments within the ctx_statement_block/$stat and that could be done multiple times unnecessarily. A small test case taken from cfg80211.h before this patch would take 1000's of seconds to run, now it's just a couple seconds. 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>
2013-09-11checkpatch: better --fix of SPACING errors.Joe Perches
Previous attempt at fixing SPACING errors could make a hash of several defects. This patch should make --fix be a lot better at correcting these defects. Trim left and right sides of these defects appropriately instead of a somewhat random attempt at it. Trim left spaces from any following bit of the modified line when only a single space is required around an operator. Signed-off-by: Joe Perches <joe@perches.com> Cc: Phil Carmody <phil.carmody@partner.samsung.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>
2013-09-11checkpatch: ignore #define TRACE_<foo> macrosJoe Perches
The tracing subsystem uses slightly odd #defines to set path/directory locations for include files. These #defines can cause false positives for the complex macro tests so add exclusions for these specific #defines (TRACE_SYSTEM, TRACE_INCLUDE_FILE, TRACE_INCLUDE_PATH). Signed-off-by: Joe Perches <joe@perches.com> Cc: Sarah Sharp <sarah.a.sharp@linux.intel.com> Cc: Li Zefan <lizefan@huawei.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>
2013-09-11checkpatch: add --types option to report only specific message typesJoe Perches
Add a --types convenience option to show only specific message types. Combined with the --fix option, this can produce specific suggested formatting patches to files. 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>
2013-09-11checkpatch: fix networking kernel-doc block comment defectJoe Perches
checkpatch can generate a false positive when inserting a new kernel-doc block and function above an existing kernel-doc block. Fix it by checking that the context line is also a newly inserted line. Signed-off-by: Joe Perches <joe@perches.com> Reported-by: Darren Hart <dvhart@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-09-11checkpatch: warn when using extern with function prototypes in .h filesJoe Perches
Using the extern keyword on function prototypes is superfluous visual noise so suggest removing it. Using extern can cause unnecessary line wrapping at 80 columns and unnecessarily long multi-line function prototypes. Signed-off-by: Joe Perches <joe@perches.com> Suggested-by: Hannes Frederic Sowa <hannes@stressinduktion.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-09-11checkpatch: check for duplicate signaturesJoe Perches
Emit a warning when a signature is used more than once. 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>
2013-09-11checkpatch: enforce sane perl versionDave Hansen
I got a bug report from a couple of users who said checkpatch.pl was broken for them. It was erroring out on fairly random lines most commonly with messages like: Nested quantifiers in regex; marked by <--HERE in m/(\((?:[^\(\)]++ <-- HERE |(?-1))*\))/ at ./checkpatch.pl line 340. The bug reporter was running a version of perl 5.8 which was end-of-lifed in 2008: http://www.cpan.org/src/. Versions of perl this old are at _best_ quite untested. At worst, they are crusty and known to be completely broken. If folks have a system _that_ old, then we should have mercy on them and give them a half-decent error message rather than fail with nutty error messages. This patch enforces that checkpatch.pl is run with perl 5.10, which was end-of-lifed in 2009. The new --ignore-perl-version command-line switch will let folks override this if they want. Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Cc: 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>
2013-09-11checkpatch: check CamelCase by word, not by $LvalJoe Perches
$Lval is a test for complete name (ie: foo->bar.Baz[1]) If any of this is CamelCase, then the current test uses the entire $Lval. This isn't optimal because it can emit messages with foo->bar.Baz and bar.Baz when Baz is a variable specified in an include file. So instead, break the $Lval into words and check each word for CamelCase uses. 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>
2013-09-11checkpatch: add a few more --fix correctionsJoe Perches
Suggest a few more single-line corrections. Remove DOS line endings Simplify removing trailing whitespace Remove global/static initializations to 0/NULL Convert pr_warning to pr_warn Add space after brace Convert binary constants to hex Remove whitespace after line continuation Use inline not __inline or __inline__ Use __printf and __scanf Use a single ; for statement terminations Convert __FUNCTION__ to __func__ 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>
2013-07-09checkpatch: make the CamelCase cache work for non-git trees tooJoe Perches
Might as well check include timestamps and cache the include file CamelCase uses for the non-git case too. The camelcase cache file is now named: for git: .checkpatch-camelcase.git.<commit_id> for non-git: .checkpatch-camelcase.date.<YYYYMMDDhhmm> All .checkpatch-camelcase* files are deleted if not current. 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>
2013-07-03checkpatch: cache last camelcase hash as .checkpatch-camelcase.<commit>Joe Perches
Add a file to cache the CamelCase variables found by <commit> to reduce the time it takes to scan the include/ directory. Filename is '.checkpatch-camelcase.<commit>' and it is created only only if a .git directory exists. <commit> is determined by the last non-merge commit id in the include/ path. Reduces checkpatch run time by ~12 cpu seconds on my little netbook. 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>
2013-07-03checkpatch: allow longer logging function namesJacob Keller
The current $logFunction regular expression allows names like dev_warn, e_dbg, netdev_info, etc, but some log functions are now written like e_dev_warn, so allow 1 or 2 word blocks with an underscore before the logging level. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> 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>
2013-07-03checkpatch: ignore existing CamelCase uses from include/...Joe Perches
When using --strict, CamelCase uses are described with CHECK: messages. These CamelCase uses may be acceptable and should not generate these messages when the variable is already defined in a file from the include/... path. So, change checkpatch to read all the .h files in include/... and look for preexisting CamelCase #defines, typedefs and function prototypes. Add these to the existing camelcase hash so that any uses in the patch or file can be ignored. There are currently ~3500 files in include/. It takes about 10 cpu seconds on my little netbook to grep for and preseed these existing uses. That's about 4x the time for a similar git grep. This preseeding is only done once when using --strict and only when there is a CamelCase use found. If a .git directory is found, it uses 'git ls-files include' If not, it uses 'find $root/include -name "*.h" 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>
2013-07-03checkpatch: ignore SI unit CamelCase variants like "_uV"Joe Perches
Many existing variable names use SI like variants that should be otherwise obvious and acceptable. Whitelist them from the CamelCase message. Signed-off-by: Joe Perches <joe@perches.com> Suggested-by: Phil Carmody <phil.carmody@partner.samsung.com> Acked-by: Phil Carmody <phil.carmody@partner.samsung.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-07-03checkpatch: move test for space before semicolon after operator spacingJoe Perches
Moving this test allows the --fix option to work better. 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>
2013-07-03checkpatch: create an EXPERIMENTAL --fix option to correct patchesJoe Perches
Some patches have simple defects in whitespace and formatting that checkpatch could correct automatically. Attempt to do so. Add a --fix option to create a "<inputfile>.EXPERIMENTAL-checkpatch-fixes" file that tries to use normal kernel style for some of these formatting errors. Add warnings against using this file without verifying the changes. 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>
2013-07-03checkpatch: improve "no space after cast" testJoe Perches
Some false positives exist on this test. For instance: *va_arg(args, signed char *) = val.s; or memset(foo, 0, sizeof(struct bar *) * baz)); Ignore lines that have an arithmetic operator or assignment after what appears to be a cast to a pointer "(foo *)". Add $Arithmetic convenience variable. 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>
2013-07-03checkpatch: add a --strict test for comparison to true/falseJoe Perches
Comparing to true or false is error prone. Add tests for the various forms of (foo == true) && (false != bar) that are only reported with --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>
2013-07-03checkpatch: don't warn on blank lines before/after braces as oftenJoe Perches
Check to make sure the blank lines aren't comment lines like: bool foo(bool bar) { /* Don't warn on a leading comment */ return !bar; /* Don't warn on a trailing comment either */ } 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>
2013-07-03checkpatch: add a placeholder to check blank lines before declarationsJoe Perches
Figure out first how to determine if this is in a struct declaration or in a function body before enabling this. 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>
2013-07-03checkpatch: reduce false positive rate of "complex macros"Joe Perches
Allow "#define foo struct.member" without bleating a warning. This also allows "#define foo bar.baz->qux" and so on. 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>
2013-07-03checkpatch: warn on comparisons to get_jiffies_64()Joe Perches
Comparing get_jiffies_64() is almost always wrong and time_before64 and time_after64 should be used instead. Warn on any comparison to get_jiffies_64(). 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>
2013-07-03checkpatch: warn on comparisons to jiffiesJoe Perches
Comparing jiffies is almost always wrong and time_before and time_after should be used instead. Warn on any comparison to jiffies. 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>
2013-07-03checkpatch: warn when networking block comment lines don't start with *Joe Perches
Some block comments in network are written as: /* block comment line 1 block comment line 2 */ Emit a warning on the "block comment line 2" because it should be /* block comment line 1 * block comment line 2 */ This warning is only emitted on the second line of a block comment. 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>
2013-07-03checkpatch: improve network block comment test and messageJoe Perches
Show the first line of the comment after a line with just /* to better show where the defective comment style is in the file. 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>
2013-07-03checkpatch: remove quote from CamelCase testJoe Perches
Commit be987d9f80 ("checkpatch: improve CamelCase test for Page") added it but it shouldn't be there. Must have been my fault. Make sure that the tested variable doesn't contain a constant. 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>
2013-07-03checkpatch: add --strict preference for p = kmalloc(sizeof(*p)...Joe Perches
Add another test for memory allocation style to follow Documentation/CodingStyle: Chapter 14: Allocating memory The preferred form for passing a size of a struct is the following: p = kmalloc(sizeof(*p), ...); 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>
2013-07-03checkpatch: warn when using gcc's binary constant ("0b") extensionJoe Perches
The gcc extension for binary constants that start with 0b is only supported with gcc version 4.3 or higher. The kernel can still be compiled with earlier versions of gcc, so have checkpatch emit a warning for these constants. Restructure checkpatch's constant finding code a bit to support finding these binary constants. Signed-off-by: Joe Perches <joe@perches.com> Suggested-by: Andrew Morton <akpm@linux-foundation.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>
2013-07-03checkpatch: change CamelCase test and make it --strictJoe Perches
Do not bleat a message on nominally acceptable CamelCase uses that are separated by an _ like drm_core_has_MTRR. CamelCase tests are also a bit noisy against certain types of code acceptable to some kernel developers. Make the test applicable only with --strict. 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>
2013-04-29checkpatch: add Suggested-by as a standard signatureMugunthan V N
As people started using Suggested-by as standard signature, adding "Suggested-by" to the standard signature so that checkpatch won't generate warning when Suggested-by is used in patch signature Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com> 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>
2013-04-29checkpatch: only warn for empty lines before closing braces by themselvesMatthijs Kooijman
This check was intended to catch extra newlines at the end of a function definition, but it would trigger on any closing brace, including those of inline functions and macro definitions, triggering false positives. Now, only closing braces on a line by themselves trigger this check. Tested with: $ cat test.h /* test.h - Test file */ static inline int foo(void) { return 0; } static inline int bar(void) { return 1; } $ ./scripts/checkpatch.pl --strict -f test.h # Before this commit CHECK: Blank lines aren't necessary before a close brace '}' + +static inline int foo(void) { return 0; } CHECK: Blank lines aren't necessary before a close brace '}' + +} total: 0 errors, 0 warnings, 2 checks, 9 lines checked $ ./scripts/checkpatch.pl --strict -f test.h # After this commit CHECK: Blank lines aren't necessary before a close brace '}' + +} total: 0 errors, 0 warnings, 1 checks, 9 lines checked Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl> Cc: Andy Whitcroft <apw@canonical.com> Acked-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-04-29checkpatch: warn on space before semicolonJoe Perches
Make space before semicolon a warning instead of a --strict CHK test. 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>
2013-04-29checkpatch: complain about executable filesJoe Perches
Complain about files with an executable bit set that are not in a scripts/ directory and are not type .pl, .py, .awk, or .sh Based on an initial patch from Stephen. Signed-off-by: Joe Perches <joe@perches.com> Acked-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-04-29checkpatch: Prefer seq_puts to seq_printfJoe Perches
Add a check for seq_printf use with a constant format without additional arguments. Suggest seq_puts instead. Signed-off-by: Joe Perches <joe@perches.com> Suggested-by: Bjorn Helgaas <bhelgaas@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-04-29checkpatch: add check for reuse of krealloc argJoe Perches
On Thu, 2013-03-14 at 13:30 +0000, David Woodhouse wrote: > If krealloc() returns NULL, it *doesn't* free the original. So any code > of the form 'foo = krealloc(foo, …);' is almost certainly a bug. So add a check for it to checkpatch. Signed-off-by: Joe Perches <joe@perches.com> Tested-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Guenter Roeck <linux@roeck-us.net> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Andy Whitcroft <apw@canonical.com> Cc: Jean Delvare <khali@linux-fr.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-04-17checkpatch: fix stringification macro defectJoe Perches
Fix checkpatch misreporting defect with stringification macros ERROR: Macros with complex values should be enclosed in parenthesis #27: FILE: arch/arm/include/asm/kgdb.h:41: +#define ___to_string(X) #X Signed-off-by: Joe Perches <joe@perches.com> Reported-by: Vincent Stehlé <v-stehle@ti.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-02-27checkpatch: improve CamelCase test for PageJoe Perches
Add the ClearPage/SetPage/TestClearPage/TestSetPage variants to the not reported Page CamelCase variables. 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>
2013-02-21checkpatch: fix USLEEP_RANGE testBruce Allan
Do not test udelay() for a value less than 10usec when passed a variable instead of a hard-coded number; there is no way for checkpatch to know the value of the variable. As it is today, it will complain about variables with alphanumeric characters plus '_', e.g. foo_bar, but not variables with other characters, eg. foo->bar. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> 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>
2013-02-21checkpatch: Add check for kcalloc argument orderJoe Perches
kcalloc is sometimes misused with the first and second arguments switched. Same issue with kmalloc_array too. Bleat if sizeof is the first argument 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>
2013-02-21checkpatch: don't emit the CamelCase warning for PageFooJoe Perches
I'm getting a ton of these: WARNING: Avoid CamelCase: <PageTransHuge> #140: FILE: mm/migrate.c:1576: + if (PageTransHuge(page) && page_count(page) != 3) { So exclude anything which starts with "Page". Tested-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-02-21checkpatch: warn on unnecessary __dev<foo> section markingsJoe Perches
Get people to stop adding __devinit and __devexit section markings. Signed-off-by: Joe Perches <joe@perches.com> Acked-by: Andy Whitcroft <apw@canonical.com> Cc: Greg KH <greg@kroah.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-02-21checkpatch: prefer dev_<level>( to dev_printk(KERN_<LEVEL>Joe Perches
Add YA check to printk style. dev_<level> uses are functions and generate smaller object code than dev_printk(KERN_<LEVEL>. 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>
2013-02-05checkpatch: fix $Float creation of match variablesJoe Perches
Commit 74349bccedb3 ("checkpatch: add support for floating point constants") added an unnecessary match variable that caused tests that used a $Constant or $LvalOrFunc to have one too many matches. This causes problems with usleep_range, min/max and other extended tests. Avoid using match variables in $Float. Avoid using match variables in $Assignment too. 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>
2012-12-20checkpatch: warn on uapi #includes that #include <uapi/...Joe Perches
Avoid specifying internal uapi #include paths with uapi/... as userspace should not use and never see that. Neaten message line wrapping above. Signed-off-by: Joe Perches <joe@perches.com> Acked-by: David Howells <dhowells@redhat.com> Acked-by: Andy Whitcroft <apw@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-12-17checkpatch: warn on CamelCase variable namesJoe Perches
Store the camelcase variables in a hash and only emit a warning on the first use of each new variable. 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>
2012-12-17checkpatch: add support for floating point constantsJoe Perches
Even though the kernel doesn't support using floating point constants, add a regex for them. Support forms like: 0x123p1, 123e-1, 1.23, 1.5e23f 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>