All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] checkpatch: add a rule to check devinitconst mistakes
@ 2013-08-05 22:10 Andi Kleen
  2013-08-05 23:30 ` Joe Perches
  2013-09-15 20:26 ` [PATCH] checkpatch: add rules to check init attribute and const defects Joe Perches
  0 siblings, 2 replies; 6+ messages in thread
From: Andi Kleen @ 2013-08-05 22:10 UTC (permalink / raw)
  To: apw; +Cc: joe, linux-kernel, Andi Kleen

From: Andi Kleen <ak@linux.intel.com>

Check for const __devinitdata and non const __devinitconst

People get this regularly wrong and it breaks the LTO builds,
as it causes a section attribute conflict.

This doesn't catch all mistakes -- spreading over multiple lines,
getting const pointers wrong, but hopefully the common ones.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 scripts/checkpatch.pl | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 2ee9eb7..5d68d9c 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2676,6 +2676,15 @@ sub process {
 			}
 		}
 
+# check for __devinitdata with const or const without __devintconst
+# XXX should scan multiple lines and handle misplaced consts for pointers
+		if ($line =~ /const/ && $line =~ /__(dev)?initdata/) {
+		    ERROR("DEVINITCONST", "const init definition must use __devinitconst");
+		}
+		if ($line =~ /__(dev)?initconst/ && $line !~ /\Wconst\W/) {
+		    ERROR("DEVINITCONST", "__devinitconst must have have const definition");
+		}
+
 # check for spacing round square brackets; allowed:
 #  1. with a type on the left -- int [] a;
 #  2. at the beginning of a line for slice initialisers -- [0...10] = 5,
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-09-16  2:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-05 22:10 [PATCH] checkpatch: add a rule to check devinitconst mistakes Andi Kleen
2013-08-05 23:30 ` Joe Perches
2013-09-15 20:26 ` [PATCH] checkpatch: add rules to check init attribute and const defects Joe Perches
2013-09-15 21:04   ` Andi Kleen
2013-09-16  2:34     ` [PATCH v2] " Joe Perches
2013-09-16  2:41       ` [untested checkpatch patch] treewide: Convert __initdata and __initconst misuses Joe Perches

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.