<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/scripts/checkpatch.pl, branch v4.5</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v4.5</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v4.5'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2016-01-21T01:09:18Z</updated>
<entry>
<title>checkpatch: fix a number of COMPLEX_MACRO false positives</title>
<updated>2016-01-21T01:09:18Z</updated>
<author>
<name>Vladimir Zapolskiy</name>
<email>vz@mleia.com</email>
</author>
<published>2016-01-20T22:59:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=6b10df4257367dd0ead49f88df473972c00a8b5c'/>
<id>urn:sha1:6b10df4257367dd0ead49f88df473972c00a8b5c</id>
<content type='text'>
A simple search over the kernel souce displays a number of correctly
defined multiline macro, which generally are used as an array element
initializer:

% find ../linux -type f | xargs grep -B1 -H '^[:space]*\[.*\\$'

However checkpatch.pl unexpectedly complains about all these macro
definitions:

% ./scripts/checkpatch.pl --types COMPLEX_MACRO -f include/linux/perf/arm_pmu.h

ERROR: Macros with complex values should be enclosed in parentheses
+#define PERF_MAP_ALL_UNSUPPORTED					\
+	 [0 ... PERF_COUNT_HW_MAX - 1] = HW_OP_UNSUPPORTED

The change intends to fix this type of false positives by flattening
only array members and skipping array element designators.

Signed-off-by: Vladimir Zapolskiy &lt;vz@mleia.com&gt;
Acked-by: Joe Perches &lt;joe@perches.com&gt;
Cc: Andy Whitcroft &lt;apw@canonical.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>checkpatch: improve macros with flow control test</title>
<updated>2016-01-21T01:09:18Z</updated>
<author>
<name>Joe Perches</name>
<email>joe@perches.com</email>
</author>
<published>2016-01-20T22:59:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=62e15a6daab0f6b3e8233e976201bce9faecaaf7'/>
<id>urn:sha1:62e15a6daab0f6b3e8233e976201bce9faecaaf7</id>
<content type='text'>
The current test excludes any macro with ## concatenation from being
reported with hidden flow control.

Some macros are used with return or goto statements along with ##args or
##__VA_ARGS__.  A somewhat common case is a logging macro like
pr_info(fmt, ...) then a return or goto statement.

Check the concatenated variable for args or __VA_ARGS__ and allow those
macros to also be reported when they contain a return or goto.

Signed-off-by: Joe Perches &lt;joe@perches.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>checkpatch: warn when casting constants to c90 int or longer types</title>
<updated>2016-01-21T01:09:18Z</updated>
<author>
<name>Joe Perches</name>
<email>joe@perches.com</email>
</author>
<published>2016-01-20T22:59:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=938224b5e596c1c30d968ffd927a578ea7c4f45b'/>
<id>urn:sha1:938224b5e596c1c30d968ffd927a578ea7c4f45b</id>
<content type='text'>
Linus Torvalds wrote:

&gt; I can't but help to react that this:
&gt;  #define IOMMU_ERROR_CODE       (~(unsigned long) 0)
&gt; Not that this *matters*, but it's a bit odd to have to cast constants
&gt; to perfectly regular C types.

So add a test that looks for constants that are cast to
standard C90 int or longer types and suggest using C90
"6.4.4.1 Integer constants" integer-suffixes instead.

Miscellanea:

o Add a --fix option too

Signed-off-by: Joe Perches &lt;joe@perches.com&gt;
Suggested-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>checkpatch: add virt barriers</title>
<updated>2016-01-12T18:47:08Z</updated>
<author>
<name>Michael S. Tsirkin</name>
<email>mst@redhat.com</email>
</author>
<published>2016-01-04T08:00:10Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=43e361f23c49dbddf74f56ddf6cdd85c5dbff6da'/>
<id>urn:sha1:43e361f23c49dbddf74f56ddf6cdd85c5dbff6da</id>
<content type='text'>
Add virt_ barriers to list of barriers to check for
presence of a comment.

Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Acked-by: Julian Calaby &lt;julian.calaby@gmail.com&gt;
Acked-by: Joe Perches &lt;joe@perches.com&gt;
Acked-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
</content>
</entry>
<entry>
<title>checkpatch: check for __smp outside barrier.h</title>
<updated>2016-01-12T18:47:07Z</updated>
<author>
<name>Michael S. Tsirkin</name>
<email>mst@redhat.com</email>
</author>
<published>2016-01-04T07:54:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f4073b0f6e11a5436d1162c623401c8f2f7cf783'/>
<id>urn:sha1:f4073b0f6e11a5436d1162c623401c8f2f7cf783</id>
<content type='text'>
Introduction of __smp barriers cleans up a bunch of duplicate code, but
it gives people an additional handle onto a "new" set of barriers - just
because they're prefixed with __* unfortunately doesn't stop anyone from
using it (as happened with other arch stuff before.)

Add a checkpatch test so it will trigger a warning.

Reported-by: Russell King &lt;linux@arm.linux.org.uk&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Acked-by: Julian Calaby &lt;julian.calaby@gmail.com&gt;
Acked-by: Joe Perches &lt;joe@perches.com&gt;
Acked-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
</content>
</entry>
<entry>
<title>checkpatch.pl: add missing memory barriers</title>
<updated>2016-01-12T18:47:07Z</updated>
<author>
<name>Michael S. Tsirkin</name>
<email>mst@redhat.com</email>
</author>
<published>2016-01-04T07:39:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=402c2553a24729688ba32453a9f6889e12754147'/>
<id>urn:sha1:402c2553a24729688ba32453a9f6889e12754147</id>
<content type='text'>
SMP-only barriers were missing in checkpatch.pl

Refactor code slightly to make adding more variants easier.

Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Acked-by: Julian Calaby &lt;julian.calaby@gmail.com&gt;
Acked-by: Joe Perches &lt;joe@perches.com&gt;
Acked-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
</content>
</entry>
<entry>
<title>checkpatch: improve the unnecessary initialisers tests</title>
<updated>2015-11-07T01:50:42Z</updated>
<author>
<name>Joe Perches</name>
<email>joe@perches.com</email>
</author>
<published>2015-11-07T00:31:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=6d32f7a391466ed89d8a1018fdff5330766cc272'/>
<id>urn:sha1:6d32f7a391466ed89d8a1018fdff5330766cc272</id>
<content type='text'>
Global and static variables don't need to be initialized to 0.

There is already a test for this but the output message doesn't
mention booleans initialized to false.

Improve the output message and the test by adding various forms
with possible specific integer types and possible multiple zeros.

Miscellanea:

o Use a variable to hold the possible 0 test

Signed-off-by: Joe Perches &lt;joe@perches.com&gt;
Signed-off-by: Shailendra Verma &lt;shailendra.v@samsung.com&gt;
Tested-by: Shailendra Verma &lt;shailendra.v@samsung.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>checkpatch: improve tests for fixes:, long lines and stack dumps in commit log</title>
<updated>2015-11-07T01:50:42Z</updated>
<author>
<name>Joe Perches</name>
<email>joe@perches.com</email>
</author>
<published>2015-11-07T00:31:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=369c8dd390baffd77b892b563d03f800e65d2dfa'/>
<id>urn:sha1:369c8dd390baffd77b892b563d03f800e65d2dfa</id>
<content type='text'>
Including BUG and stack dumps in commit logs makes checkpatch produce some
false positive warning messages.

checkpatch has multiple types of false positives:

o Commit message lines &gt; 75 chars
o Stack dump address are mistaken for git commit IDs
o Link: and Fixes: lines are allowed to be &gt; 75 chars.
o Fixes: style doesn't require ("&lt;commit_description&gt;")
  parentheses and double quotes like other uses of
  git commit ID and description.

Fix these.

Miscellanea:

o Move the test for checking $commit_log_possible_stack_dump
  above the test for a long line commit message
o Add test for hex address surrounded by square or angle brackets

Signed-off-by: Joe Perches &lt;joe@perches.com&gt;
Reported-by: Stephen Smalley &lt;sds@tycho.nsa.gov&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>checkpatch: add constant comparison on left side test</title>
<updated>2015-09-10T20:29:01Z</updated>
<author>
<name>Joe Perches</name>
<email>joe@perches.com</email>
</author>
<published>2015-09-09T22:37:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c5595fa2f1ce3c1a74dbd2ddc949257e80d81dc0'/>
<id>urn:sha1:c5595fa2f1ce3c1a74dbd2ddc949257e80d81dc0</id>
<content type='text'>
"CONST &lt;comparison&gt; variable" checks like:

        if (NULL != foo)
and
        while (0 &lt; bar(...))

where a constant (or what appears to be a constant like an upper case
identifier) is on the left of a comparison are generally preferred to be
written using the constant on the right side like:

        if (foo != NULL)
and
        while (bar(...) &gt; 0)

Add a test for this.

Add a --fix option too, but only do it when the code is immediately
surrounded by parentheses to avoid misfixing things like "(0 &lt; bar() +
constant)"

Signed-off-by: Joe Perches &lt;joe@perches.com&gt;
Cc: Nicolas Morey Chaisemartin &lt;nmorey@kalray.eu&gt;
Cc: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Cc: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>checkpatch: add __pmem to $Sparse annotations</title>
<updated>2015-09-10T20:29:01Z</updated>
<author>
<name>Joe Perches</name>
<email>joe@perches.com</email>
</author>
<published>2015-09-09T22:37:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=54507b5183cc4f8e4f1a58a312e1f30c130658b7'/>
<id>urn:sha1:54507b5183cc4f8e4f1a58a312e1f30c130658b7</id>
<content type='text'>
commit 61031952f4c8 ("arch, x86: pmem api for ensuring durability of
persistent memory updates") added a new __pmem annotation for sparse
verification.  Add __pmem to the $Sparse variable so checkpatch can
appropriately ignore uses of this attribute too.

Signed-off-by: Joe Perches &lt;joe@perches.com&gt;
Reviewed-by: Ross Zwisler &lt;ross.zwisler@linux.intel.com&gt;
Acked-by: Andy Whitcroft &lt;apw@canonical.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
</feed>
