Commit Graph

486 Commits

Author SHA1 Message Date
Ian Maund 85acd58368 Revert "checkpatch: emit a warning on file add/move/delete"
This reverts commit 13f1937ef33950b1112049972249e6191b82e6c9
("checkpatch: emit a warning on file add/move/delete")
We do not use a maintainers file for tracking file owners/maintainers.
Remove this check.

Change-Id: If090c1c0b5fc16d87cd5342b57e3bdfde19a7fd4
Signed-off-by: Ian Maund <imaund@codeaurora.org>
2015-06-25 17:54:58 -07:00
Ian Maund 0fca09d808 checkpatch.pl: Add additional granularity to malformed commit errors
Commit-Ids are expected to be 12 to 40 characters, followed by a
description enclosed by parenthesis. The current error message only
mentions the length requirement, causing confusion when a commit-Id is
formatted properly but the description is not inside parenthesis.

Change-Id: If4c5a9c197146de9ada7c618a1cfff38514e611c
Signed-off-by: Ian Maund <imaund@codeaurora.org>
2015-06-25 17:54:57 -07:00
Ian Maund adc1986d76 Revert "checkpatch.pl: add check for Change-Id"
This reverts commit 7ebd05ef1646e8cbef54e38343722741a4744626.

Our process requires Change-Id lines in our commit text while upstream
considers them to be "noise". Remove the blocking checkpatch error for
having a gerrit Change-Id line in the commit text.

Change-Id: I21c6f0e11ecd94facfc2b9a3bbfee4ed4d39609f
Signed-off-by: Ian Maund <imaund@codeaurora.org>
2015-06-25 17:54:55 -07:00
Jeff Johnson 3158cf332d checkpatch: add support for --noauthor
Commit "scripts: checkpatch.pl: warn on invalid credentials" added
to checkpatch.pl logic to unconditionally check for invalid author
credentials.  Add a flag to allow override of this behavior.

Change-Id: Ib254cc6f73c4de857ba923e6170750262cde01ad
Signed-off-by: Jeff Johnson <jjohnson@codeaurora.org>
2015-06-25 17:54:54 -07:00
Bryan Huntsman 1cbfbe862f scripts: checkpatch.pl: warn on invalid credentials
@quicinc.com identities are not allowed.  Check the "From:" field in the
patch, equivalent to the author in the git commit, and the Signed-off-by
field.

Signed-off-by: Bryan Huntsman <bryanh@codeaurora.org>
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
[imaund@codeaurora.org: Resolved context conflicts]
Signed-off-by: Ian Maund <imaund@codeaurora.org>
2015-06-25 17:54:53 -07:00
Matt Wagantall eefa722455 checkpatch: Excuse reverts from "summary line over 75 characters" check
Rather than forcing authors of reverts to truncate the summary line
because the "Revert" prefix added pushes it over the character limit,
excuse reverts from this rule.

Change-Id: I395dfff3327e360ef935d4a685c38df6577e3867
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:54:51 -07:00
Steve Muckle c118ffb39c checkpatch: recognize only specific tags when ending commit text
There are some very frequently used tags that checkpatch can look
for as an ending to the commit text rather than using a pattern,
which can generate false positives in the "no commit text" rule.

Change-Id: I5b4400017b8273bcd9f5a59b3e28965c0062bef4
Signed-off-by: Steve Muckle <smuckle@codeaurora.org>
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:54:50 -07:00
Steve Muckle 7e43a89699 checkpatch: require commit text
Commit text is almost always necessary to explain why a change is
needed. Exceptions are rare enough that these can be granted through
manual checkpatch overrides.

Change-Id: I926b2276f717940c2fec77a6709fa3088b1bf0c3
Signed-off-by: Steve Muckle <smuckle@codeaurora.org>
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:54:49 -07:00
Pankaj Kumar 536b43b57b checkpatch: Add check for vreg_xxx api in opensource drivers
Vreg API implementation is deprecated. We are using
Linux regulator framework now. Hence vreg API should
not be used.

Change-Id: I8e31dac66592d2d195d190b770a436e93206cf8b
Signed-off-by: Pankaj Kumar <pakuma@codeaurora.org>
(cherry picked from commit adfb933a24911e3514a2f1b6fe1b1a9151fec56d)
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:54:47 -07:00
Rohit Vaswani 412d7f4af5 checkpatch: Add check for gpiomux usage in msm board files
MSM has a board-*-gpiomux file where all the gpiomux configs reside.
Warn if a non gpiomux board file tries to add gpiomux configs.
The camera board file is an exception to this rule.

Change-Id: Ibab190dcbd7ea78e7ca150142c68c5ae881e4e06
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
(cherry picked from commit 60d78bb9809e7d4d1c3dc1425cbfd9e649e87c1c)
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:54:46 -07:00
Gregory Bean c892be45bf checkpatch: complain about the use of dsb().
Now that mb() does what we want, dsb() should be discouraged.

Change-Id: Ib8fe8f44f669753c3d91fac3c6e598e117d6d90e
Signed-off-by: Gregory Bean <gbean@codeaurora.org>
(cherry picked from commit 9c0619be7b93ad114d6f33a749d905ddff93df7d)
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:54:45 -07:00
Gregory Bean 649c5e65f6 checkpatch: close filp_open loophole.
filp_open allows people to get around the ban on sys_open.
Close the loophole.

Change-Id: I6e2be62e848cbc064e07008d0886c0d003c8be4b
Signed-off-by: Gregory Bean <gbean@codeaurora.org>
(cherry picked from commit bb181a18a813a70176f71a0c64aa572fcfbef0f0)
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:54:44 -07:00
Gregory Bean cf31d1f177 checkpatch: Handle long multi-line macros better.
Improve parsing of multiline macros which run beyond the available
diff context.  These beyond-the-horizon macros previously caused
two distinct naughty behaviors:
  - The scanner, confused by the trailing backslash, would grab
    the header of the next context hunk and treat it as the last
    line of the preceding macro.
  - The analyzer, unable to fully reduce the macro, would blame
    the patch for submitting an unbalanced or unprotected macro.

Change-Id: I6b7dd3d577c524d30b59dff7b20393bb5135f16d
Signed-off-by: Gregory Bean <gbean@codeaurora.org>
(cherry picked from commit ddd028c47b4d91aa9c0e97445eb584b2de367769)
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:54:42 -07:00
Gregory Bean 3bdbf8adfd checkpatch: deprecate unbounded string functions.
Unbounded string functions are overflow risks.  The 'n'
versions of those functions should be used instead.

Change-Id: Ice0fb3ebdae9aa88cc7e764ffdf68cbed857febf
Signed-off-by: Gregory Bean <gbean@codeaurora.org>
(cherry picked from commit 15e1e97d66dd6a6039c1ec2bd549a632fe361128)
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:54:41 -07:00
Gregory Bean 1c82fe3903 checkpatch: forbid implied-barrier I/O functions.
Forbid read[bwl], write[bwl], in[bwl], and out[bwl], as they
contain a 'stealth barrier' which can harm performance.
Developers are expected to call appropriate __raw_* or *_relaxed
APIs and manage barriers explicitly.

Change-Id: Ie4da221c91a0505917199db9e2fdb704c3e47d44
Signed-off-by: Gregory Bean <gbean@codeaurora.org>
(cherry picked from commit 032fd4ba09e195d9913c08f460130da9905936ef)
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:54:40 -07:00
Gregory Bean 976e4e20d5 checkpatch: Merge continuation-header handling from .38.
This commit is a cherry pick and squash of commits:
85c2ee62d37c19456c6dc83db262123956f010ac
4bc7c6001daba7d4037f54f67bae7fa90f759402

  checkpatch: Handle continuation headers.

  Continuation headers baffle checkpatch, as it can only operate
  on one line of context at a time.  When continuation headers are found,
  put them up with the header they're continuing so the whole thing
  can be parsed in a single line of context.

  checkpatch: Don't treat diffs as patches.

  The patch-header cleanup code assumed that it would only ever
  see patches, which was of course hogwash.  This lead to crazy
  results as it tried to wrap what it thought were continuation
  lines at the beginnings of raw diffs.

Signed-off-by: Gregory Bean <gbean@codeaurora.org>
(cherry picked from commit 57d50ae730a057ee1099a94a397475bfd147d97b)
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:54:38 -07:00
Gregory Bean e13b42689d checkpatch: forbid filesystem accesses from within the kernel.
Use of the sys_open/close/read/write system calls from within
kernel code is inappropriate, and now triggers errors.

Change-Id: I98e20513c257d0664684b7144585853f617d771a
Signed-off-by: Gregory Bean <gbean@codeaurora.org>
(cherry picked from commit ee62f2afcac1bcb180b2f0dddf2c8f5cda54bc5b)
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
[abhimany: resolve trivial merge conflicts]
Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org>
2015-06-25 17:54:37 -07:00
Gregory Bean 70bc57d900 Don't complain about MIME headers.
When patches contain extended character sets, patches will contain
MIME headers after the subject line, which should not be confused
for a too-long summary line.

Signed-off-by: Gregory Bean <gbean@codeaurora.org>
(cherry picked from commit 8e6b9d3790595198a34320f1c3f4504cd258fed1)
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:54:36 -07:00
Patrick Pannuto e55a98fb8c Checkpatch: Print location when catching return code error
Display context so users can see where there error was

OLD:
	ERROR: illegal return value, please use an error code

NEW:
	ERROR: illegal return value, please use an error code
	#152: test.c:5:
	+	return -1;

Change-Id: I098004d9a5dbeb6c39b35b84ac94fd7a861849d7
Signed-off-by: Patrick Pannuto <ppannuto@codeaurora.org>
(cherry picked from commit 8d09803de5d629f3ebc9cb357a40b5937a5d171e)
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:54:35 -07:00
Patrick Pannuto 2757b2a8a5 checkpatch: Check for illegal return codes
The only legal integer return is 0, anything else
following "return" should be -ERRCODE or a function.

http://lkml.org/lkml/2010/7/23/318
  There's lots of "return -1;" statements in this patch - it's obscene
  that this is used to indicate "some error occurred" in kernel space
  rather than a real errno value - even when an existing function
  (eg, request_irq) gave you an error code already.

  Please note this for the future - and please review patches on this
  point internally first.

Change-Id: I16268b2ee034f0b3b899115e45c28acfa734ddec
Signed-off-by: Patrick Pannuto <ppannuto@codeaurora.org>
(cherry picked from commit 39531a47164294315b5a7256b520fe22d6e87013)
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:54:33 -07:00
Israel Schlesinger 928356ee45 checkpatch: remove column limit for checkpatch patches
Currently checkpatch is enforcing an 80 character column
limit. This should not be applied for patches modifying
checkpatch.

Change-Id: I8e8935e633d79a7ee535ce6a90e54447a22d9a91
Signed-off-by: Israel Schlesinger <israels@codeaurora.org>
(cherry picked from commit 4aa1b864119e2d0e49efefcd6dba7349f13c3939)
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:54:32 -07:00
Israel Schlesinger e853b1705b checkpatch: Add warnings for use of mdelay()
Signed-off-by: Israel Schlesinger <israels@codeaurora.org>
(cherry picked from commit 084af58596758be6e51ef060aefa2cd622dc9205)
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:54:31 -07:00
Matt Wagantall 52e38125a2 checkpatch: Exceptions for CLK_* macros and some spaces in macros
Add CLK_* macros used in MSM clock drivers to the list of exceptions
for the "Macros with complex values should be enclosed in parenthesis"
test.

Also, allow spaces following open branckets for macros where the
macro is the first token on the line, the space preceds a decimal
number, and the line ends with ")," or ")". Such arrangements can
be useful for aligning numerical columns of tables when the rows
are described by macros.

Change-Id: I7701119ada2ea8fd646e5448eae51786bbf1e8fa
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
(cherry picked from commit ed6d6ed1c6b8f6016ea5676d075331e31b7ac1f8)
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:54:29 -07:00
Richard Adams 3a00583cf9 checkpatch: warn on subject line not followed by blank line
Fixed case when no warning generated for long subject line that is
wrapped to more than one line, and all lines are less than line limit.

New warning message added:
"non-blank line after summary line"
Now there are two warnings possible for the subject line, the original
line over limit and the new one. Depending on the error(s) any
combination of the two warnings are possible.

Commit text requirements now:
1) Must be less than 75 characters
2) Must be followed by blank line.

Signed-off-by: Richard Adams <c_adams@quicinc.com>
(cherry picked from commit 78d0db4aa1212e00696e25b7daa9fc4ecd86f954)
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:54:28 -07:00
Abhijeet Dharmapurikar 2b7a4e2acd checkpatch: check for #if 0/#if 1
Warn if #if 1 or #if 0 is present.

Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
(cherry picked from commit a81f92c9abe442ad5b00e8df31172f145a14af3f)
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:54:27 -07:00
Steve Muckle 7596d57aa8 checkpatch: warn on long summary, commit text lines
Warn on summary or commit text lines greater than 75 characters.
The summary and commit text are indented and may wrap on a terminal
if they are longer than 75 characters.

Signed-off-by: Steve Muckle <smuckle@quicinc.com>
(cherry picked from commit e2638df6005402597085a58e01b6dd1cf2bdb8a4)
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:54:26 -07:00
Joe Perches bac9c2ceb3 checkpatch: warn on logging functions with KERN_<LEVEL>
Warn on probable misuses of logging functions with KERN_<LEVEL>
like pr_err(KERN_ERR "foo\n");

Change-Id: If428f261e64d77d0c3ee11c4d1469906000c39b1
Signed-off-by: Joe Perches <joe@perches.com>
Suggested-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>
Git-commit: f78d98f6ce66fc7cc0be714d56b0240923a8b4f4
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:44:00 -07:00
Joe Perches b36bde5fe9 checkpatch: add exception to return then else test
Add an exception to the return before else warning when the line
following it is also a return like:

	if (foo)
		return bar;
	else
		return baz;

This form of a test then return is at least as readable as

	if (foo)
		return bar;
	return baz;

so don't emit a warning on the first form.

Change-Id: I3566694561164fdcc2751efe6ab55ed7f893745b
Signed-off-by: Joe Perches <joe@perches.com>
Reported-by: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Elshad Mustafayev <elshadimo@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Git-commit: 840080a08492bd2bb3314077b672b59c88bbe0e6
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:43:58 -07:00
Kees Cook 26e98ee685 checkpatch: look for common misspellings
Check for misspellings, based on Debian's lintian list.  Several false
positives were removed, and several additional words added that were
common in the kernel:

	backword backwords
	invalide valide
	recieves
	singed unsinged

While going back and fixing existing spelling mistakes isn't a high
priority, it'd be nice to try to catch them before they hit the tree.

In the 13830 commits between 3.15 and 3.16, the script would have noticed
560 spelling mistakes. The top 25 are shown here:

$ git log --pretty=oneline v3.15..v3.16 | wc -l
13830
$ git log --format='%H' v3.15..v3.16 | \
   while read commit ; do \
     echo "commit $commit" ; \
     git log --format=email --stat -p -1 $commit | \
       ./scripts/checkpatch.pl --types=typo_spelling --no-summary - ; \
   done | tee spell_v3.15..v3.16.txt | grep "may be misspelled" | \
   awk '{print $2}' | tr A-Z a-z | sort | uniq -c | sort -rn
     21 'seperate'
     17 'endianess'
     15 'sucess'
     13 'noticable'
     11 'occured'
     11 'accomodate'
     10 'interrup'
      9 'prefered'
      8 'unecessary'
      8 'explicitely'
      7 'supress'
      7 'overriden'
      7 'immediatly'
      7 'funtion'
      7 'defult'
      7 'childs'
      6 'succesful'
      6 'splitted'
      6 'specifc'
      6 'reseting'
      6 'recieve'
      6 'changable'
      5 'tmis'
      5 'singed'
      5 'preceeding'

Thanks to Joe Perches for rewrites, suggestions, additional misspelling
entries, and testing.

Change-Id: I449f512eda763dfeddd212bba24de723297d7004
Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Joe Perches <joe@perches.com>
Cc: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Git-commit: 66b47b4a9dad00e45c049d79966de9a3a1f4d337
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:43:57 -07:00
Joe Perches dc6e2c6d06 checkpatch: warn on macros with flow control statements
Macros with flow control statements (goto and return) are not very nice to
read as any flow movement is unexpected.

Try to highlight them and emit a warning on their definition.

Avoid warning on macros that use argument concatenation as those macros
commonly create another function where the concatenation is used in the
function name definition like:

	#define FOO_FUNC(name, rtn_type)	\
	rtn_type func##name(arg1, ...)		\
	{					\
		rtn_type rtn;			\
		[code...]			\
		return rtn;			\
	}

Change-Id: I8eb96e09a088a16d219a082de5ef9575060e367a
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>
Git-commit: 08a2843e77fc581d204c1e83de4678b746cdbd6e
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:43:55 -07:00
Joe Perches 0ec9c96ac1 checkpatch: remove unnecessary + after {8,8}
There's a useless "+" use that needs to be removed as perl 5.20 emits a
"Useless use of greediness modifier '+'" message each time it's hit.

Change-Id: I7789c81968e840f36aa4f526a4280ff3a7131b8b
Signed-off-by: Joe Perches <joe@perches.com>
Reported-by: Greg KH <gregkh@linuxfoundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Git-commit: d2207ccbc59900311c88bb9150b24253cd4ddd49
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:43:53 -07:00
Joe Perches a96cdd33e0 checkpatch: add --strict test for concatenated string elements
Using a space between concatenated string elements is easier for a human
to read.

ie:
	"String"FOO"bar"

is easier to read as:

	"String" FOO "bar"

So suggest this style with a --strict command line option.

Change-Id: I1fd78a48f948a940e3cbd6a5b2aa4f5c1bb7d419
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>
Git-commit: f17dba4fc0496eb0daf018074fccebdc85993c75
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:43:52 -07:00
Vadim Bendebury 23397a057f checkpatch: allow optional shorter config descriptions
This script is used by many other projects, and in some of them the
requirement of at least 4 line long description for all Kconfig items is
excessive.  This patch adds a command line option to control the required
minimum length.

Tested running this script over a patch including a two line config
description.  The script generated a warning when invoked as is, and did
not generate it when invoked with --min-conf-desc-length=2.

Change-Id: I5983651d1bda56438451a40f55872e8965f2ef08
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
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>
Git-commit: 56193274ef54265afc93fd282655836595fcff9d
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:43:50 -07:00
Geert Uytterhoeven 2dda6389f9 checkpatch: enable whitespace checks for DTS files
When run on *.dtsi or *.dts files, the whitespace checks were skipped,
while they are valid for DTS files.  Hence stop skipping them.

I ran checkpatch on all in-tree DTS files, and didn't notice any error or
warning messages that are inappropriate for DTS files.

Change-Id: Icf4ab7fe8a1eaa18dac8faa281aa88ba5ca6b260
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
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>
Git-commit: de4c924c265049e576036d1ee6fc9dfefeb5ae87
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:43:48 -07:00
Sergey Ryazanov 63c037275e checkpatch: update $allowed_asm_includes macros, add reboot.h and time.h
Several architectures (e.g.  x86, MIPS, Blackfin) have asm/reboot.h and
asm/time.h header files, which are not included in linux/reboot.h and
linux/time.h headers.  This lead to generation of false positive errors.

Change-Id: Ia6138ec1802b8ac5876db7cae825b27971bddb2a
Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.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>
Git-commit: cdcee686ee9047185b7a484614f6c2faa5c4a7bb
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:43:46 -07:00
Joe Perches 087de3116e checkpatch: remove debugging message
An unnecessary --fix debugging left-over is removed.

Change-Id: I9fe0a94f67a64b1e0305d35cb522bfcef4ba3e65
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>
Git-commit: 72c231cb70eddb56e7e532f64dc22301044486dc
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:43:45 -07:00
Andrew Morton 49409c28fa checkpatch: fix spello
The plural of parenthesis is parentheses.

Change-Id: Idc465d5505ff00ebc4fce76b2ae1b798f1e9b0e4
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Git-commit: 388982b55e3290d4970e4c2951f3f6348fd0c54b
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:43:43 -07:00
Joe Perches e3089bac9f checkpatch: allow commit descriptions on separate line from commit id
The general form for commit id and description is

  'Commit <12+hexdigits> ("commit description/subject line")'

but commit logs often have relatively long commit ids and the commit
description emds on the next line like:

  Some explanation as to why commit <12+hexdigits>
  ("commit foo description/subject line") is improved.

Allow this form.

Change-Id: Idaa70aa9410c83c955a78595419d9435a6dc951a
Signed-off-by: Joe Perches <joe@perches.com>
Suggested-by: Joe Lawrence <joe.lawrence@stratus.com>
Tested-by: Joe Lawrence <joe.lawrence@stratus.com>
Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Git-commit: 66881735071e54283df38ffbd9584c63e3661b9f
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:43:41 -07:00
Joe Perches 297d63bb12 checkpatch: relax check for length of git commit IDs
Checkpatch currently warns if a git commit ID (in the changelog,
usually) is less than 12 characters or more than 16.  The "more than 16"
is excessive.  Change the check so we accept IDs from 12 to 40 chars in
length.

Change-Id: I8529e7f66be94a576a6185c54c954384624050b7
Cc: Geert Uytterhoeven <geert@linux-m68k.org
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Git-commit: 3f6316b4378e64e96acfe55b499648dc0e6b9603
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:43:39 -07:00
Joe Perches db1341aef5 checkpatch: update $declaration_macros, add uninitialized_var
Using uninitialized_var reports a false positive for "Missing blank line
after declarations".

Fix it by adding uninitialized_var to the $declaration_macros exceptions
list.

Move the macro list after $Type is declared.

Add optional prefixes to DECLARE_<FOO> and DEFINE_<BAR>
macro declarations to allow forms like:
	MLX4_DECLARE_DOORBELL_LOCK

Change-Id: I32098b9c57ac153b220df02d7434047d14675e85
Signed-off-by: Joe Perches <joe@perches.com>
Reported-by: Dotan Barak <dotanb@mellanox.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Git-commit: f84223087402c45179be5e7060c5736c17a7b271
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:43:37 -07:00
Dan Carpenter 7fba05be25 checkpatch: warn on missing spaces in broken up quoted
Checkpatch already complains when people break up quoted strings but
it's still pretty common.  One mistake that people often make is they
leave out the space character between the two strings.

This check adds around 450 new warnings and has a low rate of false
positives.

Change-Id: I9f5c001db68543ede41cc435b4abd7b60006a99a
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
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>
Git-commit: ece9659f16e369d344fe4325d87fab3bb50d1fe2
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:43:36 -07:00
Joe Perches e0daf82540 checkpatch: fix false positives for --strict "space after cast" test
Commit 89da401f6cff ("checkpatch: improve "no space after cast" test")
in -next improved the cast test for non pointer types, but also
introduced false positives for some types of static inlines.

Add a test for an open brace to the exclusions to avoid these false
positives.

Change-Id: I1d406f90b16aaeac0fa6f4d8d2ee5bdf5cb368da
Signed-off-by: Joe Perches <joe@perches.com>
Reported-by: Hartley Sweeten <HartleyS@visionengravers.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Git-commit: 308cc8d8f0deab2c5a5162316277ced556acc71f
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:43:34 -07:00
Joe Perches 5eae304120 checkpatch: fix false positive MISSING_BREAK warnings with --file
Using --file mode can give false positives with MISSING_BREAK
fall-through warnings on simple but long multiple consecutive case
statements.

Look for all lines before a case statement for a switch or a statement
when using --file mode.

Fix a misspelling of preceded while there.

Change-Id: I3611d1aa76fa38cc9c8070c6d4322aac53b4c75d
Signed-off-by: Joe Perches <joe@perches.com>
Reported-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Git-commit: e81f239b4db2ad6c4b029ed92f0222601ce42abe
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:43:32 -07:00
Joe Perches 99ec6ca7fd checkpatch: add test for native c90 types in unusual order
c90 section "6.7.2 Type Specifiers" says:
    "type specifiers may occur in any order"

That means that:
    short int is the same as int short
    unsigned short int is the same as int unsigned short
    etc...

checkpatch currently parses only a subset of these allowed types.

For instance: "unsigned short" and "signed short" are found by
checkpatch as a specific type, but none of the or "int short" or "int
signed short" variants are found.

Add another table for the "kernel style misordered" variants.

Add this misordered table to the findable types.

Warn when the misordered style is used.

This improves the "Missing a blank line after declarations" test as it
depends on the correct parsing of the $Declare variable which looks for
"$Type $Ident;" (ie: declarations like "int foo;").

Change-Id: If90e05d793270095d9b71148866335ca277a7966
Signed-off-by: Joe Perches <joe@perches.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>
Git-commit: 1813087dbc54ff1485bcc84b66d34052eaf23387
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:43:31 -07:00
Joe Perches 5a0c503893 checkpatch: add signed generic types
Current generic types are unsigned or unspecified.  Add signed to the
types.

Reorder the types to find the longest match first.

Change-Id: I6e902db549ff258537fc72fe73c162016cc07695
Signed-off-by: Joe Perches <joe@perches.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>
Git-commit: 0c773d9d66684aefd919c4b4550fe16003c54c0e
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:43:29 -07:00
Joe Perches 9b98368fbd checkpatch: add short int to c variable types
short int is one of the 6.7.2 c90 types.
Find it appropriately.

This fixes a defect in checkpatch where it suggests that a line break
after declaration is required using an input like:

	int foo;
	short int bar;

Without this change, it warns on the short int line.

Change-Id: I4b81aea32a4587ff956c033564bc56bbac8b4e40
Signed-off-by: Joe Perches <joe@perches.com>
Reported-by: Hartley Sweeten <HartleyS@visionengravers.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>
Git-commit: 3f7bc4e1fcfab05f3e8b49134cfb3e16b8876aae
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:43:27 -07:00
Joe Perches ed4080dd23 checkpatch: add for_each tests to indentation and brace tests
All the various for_each loop macros were not tested for trailing brace
on the following lines and for bad indentation.

Add them.

Change-Id: Ie70972cc131d0e5070fc8fbf0016fa4d292ec4f8
Signed-off-by: Joe Perches <joe@perches.com>
Reported-by: Greg KH <gregkh@linuxfoundation.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>
Git-commit: 0fe3dc2bc554b849c27c0ebc36daedf032514200
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:43:26 -07:00
Joe Perches 92522066d2 checkpatch: fix brace style misuses of else and while
Add --fix corrections for ELSE_AFTER_BRACE and WHILE_AFTER_BRACE
misuses.

	if (x) {
		...
	}
	else {
		...
	}

is corrected to

	if (x) {
		...
	} else {
		...
	}

and

	do {
		...
	}
	while (x);

is corrected to

	do {
		...
	} while (x);

Change-Id: I3ab9ffb674cfffeab40449b9da3144ca9312ac66
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>
Git-commit: 8b8856f4b102ce148611322465f2ff8932664411
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:43:24 -07:00
Joe Perches 0dcab23748 checkpatch: add --fix option for a couple OPEN_BRACE misuses
Style misuses of these types are corrected:

  typedef struct foo
  {
        int bar;
  };

  int foo(int bar) { return bar+1;
  }

  int foo(int bar) {
        return bar+1;
  }

Change-Id: I0cf1de43d14eafae626938e624c80229c684fb28
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>
Git-commit: 8d1824780f2f1786db5e0e7a54bbae75340c655c
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:43:22 -07:00
Joe Perches f0d1750bb7 checkpatch: use the correct indentation for which()
I copied the which subroutine from get_maintainer.pl.

Unfortunately, get_maintainer uses a 4 space indentation so use the
proper tab indentation instead.

Change-Id: I5950f5a1acd5bbe8882a4bafe67103c1df661065
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>
Git-commit: bd474ca076af8ac6fa8c5f4167f6024b446a08c8
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2015-06-25 17:43:21 -07:00